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

40 lines
2.5 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. package models
  2. import (
  3. "github.com/ouxuanserver/osmanthuswine/src/core"
  4. "time"
  5. )
  6. const OrderDrawRecordTableName = TableNamePrefix + "order_draw_record"
  7. type OrderDrawRecord struct {
  8. Id int `json:"id" xorm:"not null pk autoincr"`
  9. UserPrizeId int `json:"user_prize_id" xorm:"not null comment('用户奖品表id') INT(11)"`
  10. ActivityId int `json:"activity_id" xorm:"not null comment('主活动id')"`
  11. RehearsalId int `json:"rehearsal_id" xorm:"not null default(0) comment('彩排id/0正式')"`
  12. OrderDrawActivityId int `json:"order_draw_activity_id" xorm:"not null comment('订单抽奖活动id')"`
  13. OrderDrawRuleId int `json:"order_draw_rule_id" xorm:"not null comment('订单抽奖规则id')"`
  14. OrderDrawRuleLadderId int `json:"order_draw_rule_ladder_id" xorm:"not null comment('订单规则阶梯id')"`
  15. OrderDrawRuleLadder *OrderDrawRuleLadder `json:"order_draw_rule_ladder" xorm:"-"`
  16. CustomerOrderId int `json:"customer_order_id" xorm:"not null default 0 comment('订单号') INT(11)"`
  17. UserId int `json:"user_id" xorm:"not null comment('用户id')"`
  18. ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"`
  19. User *User `json:"user" xorm:"-"`
  20. PrizeName string `json:"prize_name" xorm:"not null comment('奖品名字')"`
  21. OrderEntryPersonName string `json:"order_entry_person_name" xorm:"not null default 0 comment('录入人员') VARCHAR(128)"`
  22. AreaId int `json:"area_id" xorm:"not null default(0) comment('地区id') BIGINT(20)"`
  23. AreaName string `json:"area_name" xorm:"not null default('') comment('地区id')"`
  24. IsDelete bool `json:"-" xorm:"default(0)"`
  25. CreatedAt time.Time `json:"-" xorm:"created"`
  26. UpdatedAt time.Time `json:"-" xorm:"updated"`
  27. }
  28. func (t *OrderDrawRecord) TableName() string {
  29. return OrderDrawRecordTableName
  30. }
  31. func (t *OrderDrawRecord) Count(ladderId, rehearsalId, archId interface{}) (int64, error) {
  32. count, err := core.GetXormAuto().NoAutoCondition().Where("order_draw_rule_ladder_id=? and "+
  33. " rehearsal_id=? and arch_id=? and is_delete=0", ladderId, rehearsalId, archId).Count(t)
  34. return count, err
  35. }