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

5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. package models
  2. import (
  3. "git.ouxuan.net/tommy/osmanthuswine/src/core"
  4. )
  5. const LotteryDrawRuleTableName = TableNamePrefix + "lottery_draw_rule"
  6. //抽奖活动规则
  7. type LotteryDrawRule struct {
  8. Model `xorm:"extends"`
  9. LotteryDrawActivityId int `json:"lottery_draw_activity_id" description:"红包轮次的id"`
  10. LotteryDrawRuleLadders []*LotteryDrawRuleLadder `json:"lottery_draw_rule_ladder" xorm:"-" description:"阶梯"`
  11. AreaId int `json:"area_id" description:"地区id"`
  12. AreaStatus string `json:"area_status" description:"多地区[开启,关闭]"`
  13. UseTimes int `json:"use_times" description:"使用次数"`
  14. PrizeNum int `json:"prize_num" xorm:"-" description:"奖品总数"`
  15. }
  16. func (t *LotteryDrawRule) TableName() string {
  17. return LotteryDrawRuleTableName
  18. }
  19. func GetLDRuleIdsByLDActivityId(ids []int) ([]int, error) {
  20. ruleIds := make([]int, 0)
  21. err := core.GetXormAuto().Table(new(LotteryDrawRule)).Select("id").
  22. Where("is_delete=0").In("lottery_draw_activity_id", ids).Find(&ruleIds)
  23. return ruleIds, err
  24. }
  25. //func UpdateLDRuleStatusByLDActiviytIds(ids []int) (int, error) {
  26. // return core.GetXormAuto().Where("is_delete=0").In("lottery_draw_activity_id", ids).
  27. // Update(&LotteryDrawRule{LotteryDrawStatus: define.StatusNotBegin})
  28. //}