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

package models
import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time"
)
const OrderDrawRuleTableName = TableNamePrefix + "order_draw_rule"
//订单抽奖抽奖规则
type OrderDrawRule struct {
Id int64 `json:"id"`
OrderDrawActivityId int64 `json:"order_lottery_draw_activity_id" description:"订单抽奖活动的的id"`
OrderDrawRuleLadders []*OrderDrawRuleLadder `json:"order_draw_rule_ladders" xorm:"-"`
AreaId int64 `json:"area_id" description:"地区id"`
UseTimes int `json:"use_times" description:"使用次数"`
Name string `json:"name"`
PrizeNum int `json:"prize_num" xorm:"-"`
HaveEditRule bool `json:"have_edit_rule"`
IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"`
CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"`
UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"`
}
func (t *OrderDrawRule) TableName() string {
return OrderDrawRuleTableName
}
func (t *OrderDrawRule) Alias(name string) string {
return AliasTableName(t, name)
}
func GetODRuleIdsByODActivityIds(ids []int64) ([]int64, error) {
ruleIds := make([]int64, 0)
err := core.GetXormAuto().Table(new(OrderDrawRule)).Select("id").
Where("is_delete=0").In("order_draw_activity_id", ids).Find(&ruleIds)
return ruleIds, err
}