From fca061d2e781fe61ac212c421fffc1a37fe3efd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E8=8B=A5?= Date: Sun, 8 Mar 2026 11:26:20 +0800 Subject: [PATCH] =?UTF-8?q?sync:=20soul-api=20=E6=8E=A5=E5=8F=A3=E9=80=BB?= =?UTF-8?q?=E8=BE=91=20|=20=E5=8E=9F=E5=9B=A0:=20=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- soul-api/internal/handler/match.go | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) 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