互动
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.

35 lines
1.4 KiB

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})
//}