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

package models
import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"hudongzhuanjia/utils/define"
"time"
)
const OrderDrawRuleLadderTableName = TableNamePrefix + "order_draw_rule_ladder"
//订单抽奖抽奖规则梯子
type OrderDrawRuleLadder struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
OrderDrawRuleId int64 `json:"order_draw_rule_id" xorm:"not null comment('订单轮次的id') INT(11)"`
PrizeLevel string `json:"prize_level" xorm:"not null default('1') comment('奖品等级') VARCHAR(128)"`
PrizeName string `json:"prize_name" xorm:"not null comment('奖品名字') VARCHAR(255)"`
PrizeNumber int `json:"prize_number" xorm:"not null default(0) comment('奖品数量') INT(11)"`
Probability float64 `json:"probability" xorm:"not null default(10.00) comment('概率') DECIMAL(10)"`
PrizeImg string `json:"prize_img" xorm:"not null comment('奖品图片') VARCHAR(255)"`
Status string `json:"status" xorm:"not null default('未开始') comment('订单状态未开始,进行中,已结束') VARCHAR(3)"`
Des string `json:"desc" xorm:"-" description:"描述"`
IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('软删除') TINYINT(1)"`
CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"`
UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') DATETIME"`
}
func (t *OrderDrawRuleLadder) TableName() string {
return OrderDrawRuleLadderTableName
}
func (t *OrderDrawRuleLadder) Alias(name string) string {
return AliasTableName(t, name)
}
func UpdateODLadderStatusByODRuleIds(ids []int64) (int64, error) {
return core.GetXormAuto().Where("is_delete=0").In("order_draw_rule_id", ids).
Update(&OrderDrawRuleLadder{Status: define.StatusNotBegin})
}