|
|
@ -37,27 +37,27 @@ func RandLotteryUserIds(users []int64) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func GetLotteryUserIds(repeat string, activityId, ruleId, ladderId, rehearsalId, areaId interface{}) ([]int64, error) { |
|
|
|
func GetLotteryUserIds(repeat string, activityId, ruleId, ladderId, rehearsalId, areaId, archId interface{}) ([]int64, error) { |
|
|
|
var err error |
|
|
|
userIds := make([]int64, 0) |
|
|
|
recordIds := make([]int64, 0) |
|
|
|
if repeat == define.MODULE_BESIDE_REPEAT { |
|
|
|
// 去除同规则中将用户
|
|
|
|
err = core.GetXormAuto().Table(new(models.LotteryDrawRecord)).Select("user_id"). |
|
|
|
Where("lottery_draw_rule_id=? and rehearsal_id=? and area_id=? and is_delete=0", |
|
|
|
ruleId, rehearsalId, areaId).Find(&recordIds) |
|
|
|
Where("lottery_draw_rule_id=? and rehearsal_id=? and area_id=? and arch_id=? and is_delete=0", |
|
|
|
ruleId, rehearsalId, areaId, archId).Find(&recordIds) |
|
|
|
} else { |
|
|
|
// 去除同规则中将用户
|
|
|
|
err = core.GetXormAuto().Table(new(models.LotteryDrawRecord)).Select("user_id"). |
|
|
|
Where("lottery_draw_rule_ladder_id=? and rehearsal_id=? and area_id=? and is_delete=0", |
|
|
|
ladderId, rehearsalId, areaId).Find(&recordIds) |
|
|
|
Where("lottery_draw_rule_ladder_id=? and rehearsal_id=? and area_id=? and arch_id=? and is_delete=0", |
|
|
|
ladderId, rehearsalId, areaId, archId).Find(&recordIds) |
|
|
|
} |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
err = core.GetXormAuto().Table(new(models.SignHistory)).Select("user_id"). |
|
|
|
Where("is_delete=0 and rehearsal_id=? and area_id=? and activity_id=?", |
|
|
|
rehearsalId, areaId, activityId).NotIn("user_id", recordIds).Find(&userIds) |
|
|
|
Where("is_delete=0 and rehearsal_id=? and area_id=? and activity_id=? and arch_id=?", |
|
|
|
rehearsalId, areaId, activityId, archId).NotIn("user_id", recordIds).Find(&userIds) |
|
|
|
|
|
|
|
return userIds, nil |
|
|
|
} |
|
|
|