package models import ( "time" "git.ouxuan.net/tommy/osmanthuswine/src/core" ) const OrderDrawRuleTableName = TableNamePrefix + "order_draw_rule" //订单抽奖抽奖规则 type OrderDrawRule struct { Id int `json:"id" xorm:"not null autoincr pk INT(11)"` OrderDrawActivityId int `json:"order_lottery_draw_activity_id" description:"订单抽奖活动的的id"` OrderDrawRuleLadders []*OrderDrawRuleLadder `json:"order_draw_rule_ladders" xorm:"-"` AreaId int `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 Alias(t, name) } func GetODRuleIdsByODActivityIds(ids []int) ([]int, error) { ruleIds := make([]int, 0) err := core.GetXormAuto().Table(new(OrderDrawRule)).Select("id"). Where("is_delete=0").In("order_draw_activity_id", ids).Find(&ruleIds) return ruleIds, err }