package models import ( "time" "git.ouxuan.net/tommy/osmanthuswine/src/core" ) const LotteryDrawActivityTableName = TableNamePrefix + "lottery_draw_activity" //抽奖活动 type LotteryDrawActivity struct { Id int `json:"id" xorm:"not null pk autoincr INT(11)"` ActivityId int `json:"activity_id" description:"主活动的id"` CreatorId int `json:"creator_id" description:"创建者id"` LotteryDrawActivityName string `json:"lottery_draw_activity_name" description:"抽奖轮次名称"` LotteryDrawRule *LotteryDrawRule `json:"lottery_draw_rule" xorm:"-" description:"抽奖活动规则"` IsDelete bool `json:"-" xorm:"default(0)"` CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"` UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"` } func (t *LotteryDrawActivity) TableName() string { return LotteryDrawActivityTableName } func GetLDActivityIdsByActivityId(aid int) ([]int, error) { lotteryIds := make([]int, 0) err := core.GetXormAuto().Table(new(LotteryDrawActivity)).Select("id"). Where("is_delete=0 and activity_id=?", aid).Find(&lotteryIds) return lotteryIds, err }