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

package models
import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time"
)
const LotteryDrawRuleTableName = TableNamePrefix + "lottery_draw_rule"
//抽奖活动规则
type LotteryDrawRule struct {
Id int64 `json:"id"`
LotteryDrawActivityId int64 `json:"lottery_draw_activity_id" description:"红包轮次的id"`
LotteryDrawRuleLadders []*LotteryDrawRuleLadder `json:"lottery_draw_rule_ladder" xorm:"-" description:"阶梯"`
AreaId int64 `json:"area_id" description:"地区id"`
AreaStatus string `json:"area_status" description:"多地区[开启,关闭]"`
UseTimes int64 `json:"use_times" description:"使用次数"`
PrizeNum int `json:"prize_num" xorm:"-" description:"奖品总数"`
IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"`
CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"`
UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"`
}
func (t *LotteryDrawRule) TableName() string {
return LotteryDrawRuleTableName
}
func GetLDRuleIdsByLDActivityId(ids []int64) ([]int64, error) {
ruleIds := make([]int64, 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 []int64) (int64, error) {
// return core.GetXormAuto().Where("is_delete=0").In("lottery_draw_activity_id", ids).
// Update(&LotteryDrawRule{LotteryDrawStatus: define.StatusNotBegin})
//}