互动
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.6 KiB

package models
import (
"time"
"github.com/ouxuanserver/osmanthuswine/src/core"
)
const InvitationLetterTableName = TableNamePrefix + "invitation_letter"
type InvitationLetter struct {
Id int64 `json:"id" xorm:"pk autoincr" description:"主键"`
UserId int64 `json:"user_id" xorm:"not null default(0) comment('用户id') INT(11)"`
ActivityId int64 `json:"activity_id" xorm:"not null default(0) comment('主活动id') INT(11)"`
InvitationId int64 `json:"invitation_id" xorm:"not null default(0) comment('邀请函id') INT(11)"`
RehearsalId int64 `json:"rehearsal_id" xorm:"not null default 0 comment('彩排id') INT(11)"`
ExtraData string `json:"extra_data" xorm:"comment('邀请函信息') TEXT"`
IsDelete bool `json:"is_delete" xorm:"default(0)" description:"删除"`
CreatedAt time.Time `json:"created_at" xorm:"created" description:"创建"`
UpdatedAt time.Time `json:"updated_at" xorm:"updated" description:"更新"`
}
func (t *InvitationLetter) TableName() string {
return InvitationLetterTableName
}
func (t *InvitationLetter) Alias(name string) string {
return AliasTableName(t, name)
}
func (t *InvitationLetter) GetByUserIdAndActivityId(uid, aid, rid int64) (bool, error) {
return core.GetXormAuto().Where("user_id=? and activity_id=? and rehearsal_id=? and is_delete=0", uid, aid, rid).Get(t)
}
func (t *InvitationLetter) Count(activityId, rehearsalId interface{}) (int64, error) {
return core.GetXormAuto().Where("is_delete=0 and activity_id=? and rehearsal_id=?", activityId, rehearsalId).
Count(t)
}