互动
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.9 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 OrderDrawRuleLadderTableName = TableNamePrefix + "order_draw_rule_ladder"
  8. //订单抽奖抽奖规则梯子
  9. type OrderDrawRuleLadder struct {
  10. Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
  11. OrderDrawRuleId int64 `json:"order_draw_rule_id" xorm:"not null comment('订单轮次的id') INT(11)"`
  12. PrizeLevel string `json:"prize_level" xorm:"not null default('1') comment('奖品等级') VARCHAR(128)"`
  13. PrizeName string `json:"prize_name" xorm:"not null comment('奖品名字') VARCHAR(255)"`
  14. PrizeNumber int `json:"prize_number" xorm:"not null default(0) comment('奖品数量') INT(11)"`
  15. Probability float64 `json:"probability" xorm:"not null default(10.00) comment('概率') DECIMAL(10)"`
  16. PrizeImg string `json:"prize_img" xorm:"not null comment('奖品图片') VARCHAR(255)"`
  17. Status string `json:"status" xorm:"not null default('未开始') comment('订单状态未开始,进行中,已结束') VARCHAR(3)"`
  18. Des string `json:"desc" xorm:"-" description:"描述"`
  19. IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('软删除') TINYINT(1)"`
  20. CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"`
  21. UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') DATETIME"`
  22. }
  23. func (t *OrderDrawRuleLadder) TableName() string {
  24. return OrderDrawRuleLadderTableName
  25. }
  26. func (t *OrderDrawRuleLadder) Alias(name string) string {
  27. return AliasTableName(t, name)
  28. }
  29. func UpdateODLadderStatusByODRuleIds(ids []int64) (int64, error) {
  30. return core.GetXormAuto().Where("is_delete=0").In("order_draw_rule_id", ids).
  31. Update(&OrderDrawRuleLadder{Status: define.StatusNotBegin})
  32. }