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
40 lines
2.5 KiB
package models
|
|
|
|
import (
|
|
"github.com/ouxuanserver/osmanthuswine/src/core"
|
|
"time"
|
|
)
|
|
|
|
const OrderDrawRecordTableName = TableNamePrefix + "order_draw_record"
|
|
|
|
type OrderDrawRecord struct {
|
|
Id int `json:"id" xorm:"not null pk autoincr"`
|
|
UserPrizeId int `json:"user_prize_id" xorm:"not null comment('用户奖品表id') INT(11)"`
|
|
ActivityId int `json:"activity_id" xorm:"not null comment('主活动id')"`
|
|
RehearsalId int `json:"rehearsal_id" xorm:"not null default(0) comment('彩排id/0正式')"`
|
|
OrderDrawActivityId int `json:"order_draw_activity_id" xorm:"not null comment('订单抽奖活动id')"`
|
|
OrderDrawRuleId int `json:"order_draw_rule_id" xorm:"not null comment('订单抽奖规则id')"`
|
|
OrderDrawRuleLadderId int `json:"order_draw_rule_ladder_id" xorm:"not null comment('订单规则阶梯id')"`
|
|
OrderDrawRuleLadder *OrderDrawRuleLadder `json:"order_draw_rule_ladder" xorm:"-"`
|
|
CustomerOrderId int `json:"customer_order_id" xorm:"not null default 0 comment('订单号') INT(11)"`
|
|
UserId int `json:"user_id" xorm:"not null comment('用户id')"`
|
|
ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"`
|
|
User *User `json:"user" xorm:"-"`
|
|
PrizeName string `json:"prize_name" xorm:"not null comment('奖品名字')"`
|
|
OrderEntryPersonName string `json:"order_entry_person_name" xorm:"not null default 0 comment('录入人员') VARCHAR(128)"`
|
|
AreaId int `json:"area_id" xorm:"not null default(0) comment('地区id') BIGINT(20)"`
|
|
AreaName string `json:"area_name" xorm:"not null default('') comment('地区id')"`
|
|
IsDelete bool `json:"-" xorm:"default(0)"`
|
|
CreatedAt time.Time `json:"-" xorm:"created"`
|
|
UpdatedAt time.Time `json:"-" xorm:"updated"`
|
|
}
|
|
|
|
func (t *OrderDrawRecord) TableName() string {
|
|
return OrderDrawRecordTableName
|
|
}
|
|
|
|
func (t *OrderDrawRecord) Count(ladderId, rehearsalId, archId interface{}) (int64, error) {
|
|
count, err := core.GetXormAuto().NoAutoCondition().Where("order_draw_rule_ladder_id=? and "+
|
|
" rehearsal_id=? and arch_id=? and is_delete=0", ladderId, rehearsalId, archId).Count(t)
|
|
return count, err
|
|
}
|