|
|
@ -7,20 +7,20 @@ import ( |
|
|
|
"github.com/ouxuanserver/osmanthuswine/src/core" |
|
|
|
) |
|
|
|
|
|
|
|
func GetOrderLotteryUserIds(repeat string, activityId, ruleId, ladderId, rehearsalId, areaId interface{}) ([]int, error) { |
|
|
|
func GetOrderLotteryUserIds(repeat string, activityId, ruleId, ladderId, rehearsalId, areaId, archId interface{}) ([]int, error) { |
|
|
|
var err error |
|
|
|
var userIds = make([]int, 0) |
|
|
|
var recordIds = make([]int, 0) |
|
|
|
if repeat == define.MODULE_BESIDE_REPEAT { |
|
|
|
//查询已经中奖的用户,剔除已经中奖的用户
|
|
|
|
err = core.GetXormAuto().Table(new(models.OrderDrawRecord)).Select("user_id"). |
|
|
|
Where("order_draw_rule_id=? and rehearsal_id=? and is_delete=0", |
|
|
|
ruleId, rehearsalId).Find(&recordIds) |
|
|
|
Where("order_draw_rule_id=? and rehearsal_id=? and arch_id=? and is_delete=0", |
|
|
|
ruleId, rehearsalId, archId).Find(&recordIds) |
|
|
|
} else { |
|
|
|
// 不去除
|
|
|
|
err = core.GetXormAuto().Table(new(models.OrderDrawRecord)).Select("user_id"). |
|
|
|
Where("order_draw_rule_ladder_id=? and rehearsal_id=?", |
|
|
|
ladderId, rehearsalId).Find(&recordIds) |
|
|
|
Where("order_draw_rule_ladder_id=? and rehearsal_id=? and arch_id=? and is_delete=0", |
|
|
|
ladderId, rehearsalId, archId).Find(&recordIds) |
|
|
|
} |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
@ -28,8 +28,8 @@ func GetOrderLotteryUserIds(repeat string, activityId, ruleId, ladderId, rehears |
|
|
|
|
|
|
|
err = core.GetXormAuto().Table(new(models.CustomerOrder)). |
|
|
|
Select("buyer_id as user_id").Distinct("buyer_id"). |
|
|
|
Where("activity_id=? and rehearsal_id=? and area_id=? and is_delete=0", |
|
|
|
activityId, rehearsalId, areaId).NotIn("buyer_id", recordIds). |
|
|
|
Where("activity_id=? and rehearsal_id=? and area_id=? and arch_id=? and is_delete=0", |
|
|
|
activityId, rehearsalId, areaId, archId).NotIn("buyer_id", recordIds). |
|
|
|
Find(&userIds) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|