package models import ( "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/utils/define" "time" ) const LotteryDrawRuleLadderTableName = TableNamePrefix + "lottery_draw_rule_ladder" //抽奖活动规则阶梯 type LotteryDrawRuleLadder struct { Id int64 `json:"id"` LotteryDrawRuleId int64 `json:"lottery_draw_rule_id" description:"红包轮次的id"` RollNum int `json:"roll_num" xorm:"not null default 0 comment('滚动次数') INT(11)"` PrizeName string `json:"prize_name" description:"奖品名字"` PrizeNumber int `json:"prize_number" description:"奖品数量"` Probability float64 `json:"probability" description:"概率"` PrizeImg string `json:"prize_img" description:"奖品图片"` Status string `json:"status" xorm:"not null default('未开始') comment('状态未开始进行中已结束') VARCHAR(3)"` Des string `json:"des" xorm:"-" description:"规则描述"` IsDelete bool `json:"-" xorm:"default(0)" description:"是否删除"` CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"` UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"` } func (t *LotteryDrawRuleLadder) TableName() string { return LotteryDrawRuleLadderTableName } func (t *LotteryDrawRuleLadder) Alias(name string) string { return AliasTableName(t, name) } func UpdateLDLadderStatusByLDRuleIds(ids []int64) (int64, error) { return core.GetXormAuto().Where("is_delete=0"). In("lottery_draw_rule_id", ids). Update(&LotteryDrawRuleLadder{Status: define.StatusNotBegin}) } func GetLotteryDrawLadderByRuleId(ruleId interface{}) ([]*LotteryDrawRuleLadder, error) { list := make([]*LotteryDrawRuleLadder, 0) err := core.GetXormAuto().Where("is_delete=0 and lottery_draw_rule_id=?", ruleId).Find(&list) return list, err }