package models import ( "git.ouxuan.net/tommy/osmanthuswine/src/core" ) const LotteryDrawRuleTableName = TableNamePrefix + "lottery_draw_rule" //抽奖活动规则 type LotteryDrawRule struct { Model `xorm:"extends"` LotteryDrawActivityId int `json:"lottery_draw_activity_id" description:"红包轮次的id"` LotteryDrawRuleLadders []*LotteryDrawRuleLadder `json:"lottery_draw_rule_ladder" xorm:"-" description:"阶梯"` AreaId int `json:"area_id" description:"地区id"` AreaStatus string `json:"area_status" description:"多地区[开启,关闭]"` UseTimes int `json:"use_times" description:"使用次数"` PrizeNum int `json:"prize_num" xorm:"-" description:"奖品总数"` } func (t *LotteryDrawRule) TableName() string { return LotteryDrawRuleTableName } func GetLDRuleIdsByLDActivityId(ids []int) ([]int, error) { ruleIds := make([]int, 0) err := core.GetXormAuto().Table(new(LotteryDrawRule)).Select("id"). Where("is_delete=0").In("lottery_draw_activity_id", ids).Find(&ruleIds) return ruleIds, err } //func UpdateLDRuleStatusByLDActiviytIds(ids []int) (int, error) { // return core.GetXormAuto().Where("is_delete=0").In("lottery_draw_activity_id", ids). // Update(&LotteryDrawRule{LotteryDrawStatus: define.StatusNotBegin}) //}