黄梓健
5 years ago
7 changed files with 101 additions and 80 deletions
-
15controllers/client/login.go
-
28controllers/client/sign.go
-
7controllers/pc/sign.go
-
2models/base.go
-
102models/real_sign_history.go
-
26models/sign_history.go
-
1models/sign_up.go
@ -1,56 +1,50 @@ |
|||||
package models |
package models |
||||
|
|
||||
import ( |
|
||||
"time" |
|
||||
|
|
||||
"github.com/ouxuanserver/osmanthuswine/src/core" |
|
||||
) |
|
||||
|
|
||||
const RealSignHistoryTN = TableNamePrefix + "real_sign_history" |
|
||||
|
|
||||
type RealSignHistory struct { |
|
||||
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"` |
|
||||
ActivityId int64 `json:"activity_id" xorm:"not null default 0 comment('主活动') INT(11)"` |
|
||||
UserId int64 `json:"user_id" xorm:"not null default 0 comment('用户id') INT(11)"` |
|
||||
Nickname string `json:"nickname" xorm:"not null default('') comment('微信昵称') VARCHAR(128)"` |
|
||||
RehearsalId int64 `json:"rehearsal_id" xorm:"not null default 0 comment('彩排id') INT(11)"` |
|
||||
Content string `json:"content" xorm:"not null comment('提交审核的内容') TEXT"` |
|
||||
Status int64 `json:"status" xorm:"not null default 0 comment('是否通过审核') TINYINT(1)"` |
|
||||
IsDelete int `json:"is_delete" xorm:"not null default(0) comment('是否删除') TINYINT(1)"` |
|
||||
CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"` |
|
||||
UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') TIMESTAMP"` |
|
||||
} |
|
||||
|
|
||||
func (t *RealSignHistory) TableName() string { |
|
||||
return RealSignHistoryTN |
|
||||
} |
|
||||
|
|
||||
func (t *RealSignHistory) Info(uid, aid, rid int64) (bool, error) { |
|
||||
return core.GetXormAuto().Where("is_delete=0 and user_id=? and activity_id=? and rehearsal_id=?", |
|
||||
uid, aid, rid).Get(t) |
|
||||
} |
|
||||
|
|
||||
func (t *RealSignHistory) Check(uid, aid, rid int64) (bool, error) { |
|
||||
return core.GetXormAuto().Where("is_delete=0 and user_id=? and activity_id=? and rehearsal_id=? and status=1", |
|
||||
uid, aid, rid).Get(t) |
|
||||
} |
|
||||
|
|
||||
func (t *RealSignHistory) UpdateById(ids interface{}, fields ...string) (err error) { |
|
||||
if len(fields) > 0 { |
|
||||
_, err = core.GetXormAuto().In("id", ids).Cols(fields...).Update(t) |
|
||||
} else { |
|
||||
_, err = core.GetXormAuto().In("id", ids).AllCols().Update(t) |
|
||||
} |
|
||||
return err |
|
||||
} |
|
||||
func (t *RealSignHistory) Insert() error { |
|
||||
_, err := core.GetXormAuto().InsertOne(t) |
|
||||
return err |
|
||||
} |
|
||||
|
|
||||
func GetRealSignHistories(aid interface{}, rid interface{}) ([]*RealSignHistory, error) { |
|
||||
results := make([]*RealSignHistory, 0) |
|
||||
err := core.GetXormAuto().Where("is_delete=0 and activity_id=? and rehearsal_id=? and status=0", |
|
||||
aid, rid).Asc("updated_at").Find(&results) |
|
||||
return results, err |
|
||||
} |
|
||||
|
//const RealSignHistoryTN = TableNamePrefix + "real_sign_history"
|
||||
|
|
||||
|
//type RealSignHistory struct {
|
||||
|
// Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
|
||||
|
// ActivityId int64 `json:"activity_id" xorm:"not null default 0 comment('主活动') INT(11)"`
|
||||
|
// UserId int64 `json:"user_id" xorm:"not null default 0 comment('用户id') INT(11)"`
|
||||
|
// Nickname string `json:"nickname" xorm:"not null default('') comment('微信昵称') VARCHAR(128)"`
|
||||
|
// RehearsalId int64 `json:"rehearsal_id" xorm:"not null default 0 comment('彩排id') INT(11)"`
|
||||
|
// Content string `json:"content" xorm:"not null comment('提交审核的内容') TEXT"`
|
||||
|
// Status int64 `json:"status" xorm:"not null default 0 comment('是否通过审核') TINYINT(1)"`
|
||||
|
// IsDelete int `json:"is_delete" xorm:"not null default(0) comment('是否删除') TINYINT(1)"`
|
||||
|
// CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"`
|
||||
|
// UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') TIMESTAMP"`
|
||||
|
//}
|
||||
|
|
||||
|
//func (t *RealSignHistory) TableName() string {
|
||||
|
// return RealSignHistoryTN
|
||||
|
//}
|
||||
|
//
|
||||
|
//func (t *RealSignHistory) Info(uid, aid, rid int64) (bool, error) {
|
||||
|
// return core.GetXormAuto().Where("is_delete=0 and user_id=? and activity_id=? and rehearsal_id=?",
|
||||
|
// uid, aid, rid).Get(t)
|
||||
|
//}
|
||||
|
//
|
||||
|
//func (t *RealSignHistory) Check(uid, aid, rid int64) (bool, error) {
|
||||
|
// return core.GetXormAuto().Where("is_delete=0 and user_id=? and activity_id=? and rehearsal_id=? and status=1",
|
||||
|
// uid, aid, rid).Get(t)
|
||||
|
//}
|
||||
|
//
|
||||
|
//func (t *RealSignHistory) UpdateById(ids interface{}, fields ...string) (err error) {
|
||||
|
// if len(fields) > 0 {
|
||||
|
// _, err = core.GetXormAuto().In("id", ids).Cols(fields...).Update(t)
|
||||
|
// } else {
|
||||
|
// _, err = core.GetXormAuto().In("id", ids).AllCols().Update(t)
|
||||
|
// }
|
||||
|
// return err
|
||||
|
//}
|
||||
|
//func (t *RealSignHistory) Insert() error {
|
||||
|
// _, err := core.GetXormAuto().InsertOne(t)
|
||||
|
// return err
|
||||
|
//}
|
||||
|
//
|
||||
|
//func GetRealSignHistories(aid interface{}, rid interface{}) ([]*RealSignHistory, error) {
|
||||
|
// results := make([]*RealSignHistory, 0)
|
||||
|
// err := core.GetXormAuto().Where("is_delete=0 and activity_id=? and rehearsal_id=? and status=0",
|
||||
|
// aid, rid).Asc("updated_at").Find(&results)
|
||||
|
// return results, err
|
||||
|
//}
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue