sync: soul-api 接口逻辑 | 原因: 后端接口逻辑修改
This commit is contained in:
@@ -236,17 +236,30 @@ func MatchUsers(c *gin.Context) {
|
||||
if len(todayMatchedIDs) > 0 {
|
||||
q = q.Where("id NOT IN ?", todayMatchedIDs)
|
||||
}
|
||||
// 按池子来源筛选
|
||||
switch poolSource {
|
||||
case "vip":
|
||||
q = q.Where("is_vip = 1 AND vip_expire_date > NOW()")
|
||||
case "complete":
|
||||
q = q.Where("((phone IS NOT NULL AND phone != '') AND (nickname IS NOT NULL AND nickname != ''))")
|
||||
default:
|
||||
// 按池子来源筛选(多选取并集)
|
||||
if hasSource("all") {
|
||||
q = q.Where("((wechat_id IS NOT NULL AND wechat_id != '') OR (phone IS NOT NULL AND phone != ''))")
|
||||
} else {
|
||||
var orConds []string
|
||||
if hasSource("vip") {
|
||||
orConds = append(orConds, "(is_vip = 1 AND vip_expire_date > NOW())")
|
||||
}
|
||||
if hasSource("complete") {
|
||||
orConds = append(orConds, "((phone IS NOT NULL AND phone != '') AND (nickname IS NOT NULL AND nickname != ''))")
|
||||
}
|
||||
if len(orConds) > 0 {
|
||||
combined := "(" + orConds[0]
|
||||
for i := 1; i < len(orConds); i++ {
|
||||
combined += " OR " + orConds[i]
|
||||
}
|
||||
combined += ")"
|
||||
q = q.Where(combined)
|
||||
} else {
|
||||
q = q.Where("is_vip = 1 AND vip_expire_date > NOW()")
|
||||
}
|
||||
}
|
||||
// partner 类型强制 VIP
|
||||
if body.MatchType == "partner" && poolSource != "vip" {
|
||||
if body.MatchType == "partner" && !hasSource("vip") && !hasSource("all") {
|
||||
q = q.Where("is_vip = 1 AND vip_expire_date > NOW()")
|
||||
}
|
||||
// 按完善程度筛选
|
||||
|
||||
Reference in New Issue
Block a user