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

5 years ago
  1. package models
  2. import (
  3. "github.com/ouxuanserver/osmanthuswine/src/core"
  4. "time"
  5. )
  6. const LotteryDrawRuleTableName = TableNamePrefix + "lottery_draw_rule"
  7. //抽奖活动规则
  8. type LotteryDrawRule struct {
  9. Id int64 `json:"id"`
  10. LotteryDrawActivityId int64 `json:"lottery_draw_activity_id" description:"红包轮次的id"`
  11. LotteryDrawRuleLadders []*LotteryDrawRuleLadder `json:"lottery_draw_rule_ladder" xorm:"-" description:"阶梯"`
  12. AreaId int64 `json:"area_id" description:"地区id"`
  13. AreaStatus string `json:"area_status" description:"多地区[开启,关闭]"`
  14. UseTimes int64 `json:"use_times" description:"使用次数"`
  15. PrizeNum int `json:"prize_num" xorm:"-" description:"奖品总数"`
  16. IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"`
  17. CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"`
  18. UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"`
  19. }
  20. func (t *LotteryDrawRule) TableName() string {
  21. return LotteryDrawRuleTableName
  22. }
  23. func GetLDRuleIdsByLDActivityId(ids []int64) ([]int64, error) {
  24. ruleIds := make([]int64, 0)
  25. err := core.GetXormAuto().Table(new(LotteryDrawRule)).Select("id").
  26. Where("is_delete=0").In("lottery_draw_activity_id", ids).Find(&ruleIds)
  27. return ruleIds, err
  28. }
  29. //func UpdateLDRuleStatusByLDActiviytIds(ids []int64) (int64, error) {
  30. // return core.GetXormAuto().Where("is_delete=0").In("lottery_draw_activity_id", ids).
  31. // Update(&LotteryDrawRule{LotteryDrawStatus: define.StatusNotBegin})
  32. //}