|
|
@ -1,8 +1,6 @@ |
|
|
|
package models |
|
|
|
|
|
|
|
import ( |
|
|
|
"time" |
|
|
|
|
|
|
|
"github.com/ouxuanserver/osmanthuswine/src/core" |
|
|
|
) |
|
|
|
|
|
|
@ -10,7 +8,12 @@ const SignHistoryTN = TableNamePrefix + "sign_history" |
|
|
|
|
|
|
|
//签到历史表
|
|
|
|
type SignHistory struct { |
|
|
|
Id int `json:"id" xorm:"pk autoincr comment('主键') INT(11)"` |
|
|
|
Model `xorm:"extends"` |
|
|
|
//Id int `json:"id" xorm:"pk autoincr comment('主键') INT(11)"`
|
|
|
|
//IsDelete bool `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('更新时间') DATETIME"`
|
|
|
|
|
|
|
|
AreaId int `json:"area_id" xorm:"not null default 0 comment('地区id') INT(11)"` |
|
|
|
ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"` |
|
|
|
ActivityId int `json:"activity_id" xorm:"not null default 0 comment('主活动id') INT(11)"` |
|
|
@ -22,9 +25,6 @@ type SignHistory struct { |
|
|
|
Content string `json:"content" xorm:"json comment('提交审核的内容') TEXT"` |
|
|
|
Nickname string `json:"nickname" xorm:"not null default('') comment('微信昵称') VARCHAR(128)"` |
|
|
|
Status int `json:"status" xorm:"not null default 0 comment('是否通过审核[0未通过审核1申请审核2通过审核]') TINYINT(1)"` |
|
|
|
IsDelete bool `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('更新时间') DATETIME"` |
|
|
|
} |
|
|
|
|
|
|
|
func (t *SignHistory) TableName() string { |
|
|
@ -58,3 +58,20 @@ func GetApplyRealSigns(activityId, archId, rehearsalId interface{}) ([]*SignHist |
|
|
|
" and status=1", activityId, archId, rehearsalId).Asc("updated_at").Find(&results) |
|
|
|
return results, err |
|
|
|
} |
|
|
|
|
|
|
|
type SignHistoryAndUser struct { |
|
|
|
SignHistory `xorm:"extends"` |
|
|
|
User *User `json:"user" xorm:"extends"` |
|
|
|
} |
|
|
|
|
|
|
|
func GetSignHistories(activityId, rehearsalId, archId, page, size int) (total int64, result []*SignHistoryAndUser, err error) { |
|
|
|
session := core.GetXormAuto().Table(new(SignHistory)).Alias("h"). |
|
|
|
Join("LEFT", new(User).Alias("u"), "h.user_id=u.id and u.is_delete=0"). |
|
|
|
Where("h.is_delete=0 and h.activity_id=? and rehearsal_id=? and arch_id=?", |
|
|
|
activityId, rehearsalId, archId) |
|
|
|
if size > 0 { // 增加分页
|
|
|
|
session.Limit(size, page*size) |
|
|
|
} |
|
|
|
total, err = session.FindAndCount(&result) |
|
|
|
return |
|
|
|
} |