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

5 years ago
  1. package models
  2. import (
  3. "github.com/ouxuanserver/osmanthuswine/src/core"
  4. "time"
  5. )
  6. const OrderDrawRuleTableName = TableNamePrefix + "order_draw_rule"
  7. //订单抽奖抽奖规则
  8. type OrderDrawRule struct {
  9. Id int64 `json:"id"`
  10. OrderDrawActivityId int64 `json:"order_lottery_draw_activity_id" description:"订单抽奖活动的的id"`
  11. OrderDrawRuleLadders []*OrderDrawRuleLadder `json:"order_draw_rule_ladders" xorm:"-"`
  12. AreaId int64 `json:"area_id" description:"地区id"`
  13. UseTimes int `json:"use_times" description:"使用次数"`
  14. Name string `json:"name"`
  15. PrizeNum int `json:"prize_num" xorm:"-"`
  16. HaveEditRule bool `json:"have_edit_rule"`
  17. IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"`
  18. CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"`
  19. UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"`
  20. }
  21. func (t *OrderDrawRule) TableName() string {
  22. return OrderDrawRuleTableName
  23. }
  24. func (t *OrderDrawRule) Alias(name string) string {
  25. return AliasTableName(t, name)
  26. }
  27. func GetODRuleIdsByODActivityIds(ids []int64) ([]int64, error) {
  28. ruleIds := make([]int64, 0)
  29. err := core.GetXormAuto().Table(new(OrderDrawRule)).Select("id").
  30. Where("is_delete=0").In("order_draw_activity_id", ids).Find(&ruleIds)
  31. return ruleIds, err
  32. }