diff --git a/soul-api/internal/handler/match.go b/soul-api/internal/handler/match.go index 1e06ccbe..5e5e88ef 100644 --- a/soul-api/internal/handler/match.go +++ b/soul-api/internal/handler/match.go @@ -183,7 +183,7 @@ func MatchUsers(c *gin.Context) { } // 读取 poolSettings 配置决定匹配范围 var cfg model.SystemConfig - poolSource := "vip" + poolSources := []string{"vip"} requirePhone := true requireNickname := false requireAvatar := false @@ -192,8 +192,15 @@ func MatchUsers(c *gin.Context) { var cfgMap map[string]interface{} if json.Unmarshal(cfg.ConfigValue, &cfgMap) == nil { if ps, ok := cfgMap["poolSettings"].(map[string]interface{}); ok { - if v, ok := ps["poolSource"].(string); ok { - poolSource = v + if arr, ok := ps["poolSource"].([]interface{}); ok && len(arr) > 0 { + 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 { 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