sync: soul-api 接口逻辑 | 原因: 后端接口逻辑修改
This commit is contained in:
@@ -183,7 +183,7 @@ func MatchUsers(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
// 读取 poolSettings 配置决定匹配范围
|
// 读取 poolSettings 配置决定匹配范围
|
||||||
var cfg model.SystemConfig
|
var cfg model.SystemConfig
|
||||||
poolSource := "vip"
|
poolSources := []string{"vip"}
|
||||||
requirePhone := true
|
requirePhone := true
|
||||||
requireNickname := false
|
requireNickname := false
|
||||||
requireAvatar := false
|
requireAvatar := false
|
||||||
@@ -192,8 +192,15 @@ func MatchUsers(c *gin.Context) {
|
|||||||
var cfgMap map[string]interface{}
|
var cfgMap map[string]interface{}
|
||||||
if json.Unmarshal(cfg.ConfigValue, &cfgMap) == nil {
|
if json.Unmarshal(cfg.ConfigValue, &cfgMap) == nil {
|
||||||
if ps, ok := cfgMap["poolSettings"].(map[string]interface{}); ok {
|
if ps, ok := cfgMap["poolSettings"].(map[string]interface{}); ok {
|
||||||
if v, ok := ps["poolSource"].(string); ok {
|
if arr, ok := ps["poolSource"].([]interface{}); ok && len(arr) > 0 {
|
||||||
poolSource = v
|
poolSources = make([]string, 0, len(arr))
|
||||||
|
for _, v := range arr {
|
||||||
|
if s, ok := v.(string); ok {
|
||||||
|
poolSources = append(poolSources, s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if v, ok := ps["poolSource"].(string); ok {
|
||||||
|
poolSources = []string{v}
|
||||||
}
|
}
|
||||||
if v, ok := ps["requirePhone"].(bool); ok {
|
if v, ok := ps["requirePhone"].(bool); ok {
|
||||||
requirePhone = v
|
requirePhone = v
|
||||||
@@ -210,6 +217,14 @@ func MatchUsers(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
hasSource := func(s string) bool {
|
||||||
|
for _, v := range poolSources {
|
||||||
|
if v == s {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// 排除当天已匹配过的用户
|
// 排除当天已匹配过的用户
|
||||||
var todayMatchedIDs []string
|
var todayMatchedIDs []string
|
||||||
|
|||||||
Reference in New Issue
Block a user