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

37 lines
1.5 KiB

5 years ago
  1. package models
  2. import (
  3. "github.com/ouxuanserver/osmanthuswine/src/core"
  4. "hudongzhuanjia/utils/define"
  5. "time"
  6. )
  7. const LotteryDrawRuleLadderTableName = TableNamePrefix + "lottery_draw_rule_ladder"
  8. //抽奖活动规则阶梯
  9. type LotteryDrawRuleLadder struct {
  10. Id int64 `json:"id"`
  11. LotteryDrawRuleId int64 `json:"lottery_draw_rule_id" description:"红包轮次的id"`
  12. PrizeName string `json:"prize_name" description:"奖品名字"`
  13. PrizeNumber int `json:"prize_number" description:"奖品数量"`
  14. Probability float64 `json:"probability" description:"概率"`
  15. PrizeImg string `json:"prize_img" description:"奖品图片"`
  16. Status string `json:"status" xorm:"not null default('未开始') comment('状态未开始进行中已结束') VARCHAR(3)"`
  17. Des string `json:"des" xorm:"-" description:"规则描述"`
  18. IsDelete bool `json:"-" xorm:"default(0)" description:"是否删除"`
  19. CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"`
  20. UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"`
  21. }
  22. func (t *LotteryDrawRuleLadder) TableName() string {
  23. return LotteryDrawRuleLadderTableName
  24. }
  25. func (t *LotteryDrawRuleLadder) Alias(name string) string {
  26. return AliasTableName(t, name)
  27. }
  28. func UpdateLDLadderStatusByLDRuleIds(ids []int64) (int64, error) {
  29. return core.GetXormAuto().Where("is_delete=0").In("lottery_draw_rule_id", ids).
  30. Update(&LotteryDrawRuleLadder{Status: define.StatusNotBegin})
  31. }