From 9ecbcc5df761f4e43821dfd6e9ed7b06933371c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E8=8B=A5?= Date: Sun, 8 Mar 2026 10:33:31 +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_records.go | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/soul-api/internal/handler/match_records.go b/soul-api/internal/handler/match_records.go index c46e8936..35c9133e 100644 --- a/soul-api/internal/handler/match_records.go +++ b/soul-api/internal/handler/match_records.go @@ -131,3 +131,26 @@ func DBMatchRecordsList(c *gin.Context) { "total": total, "page": page, "pageSize": pageSize, "totalPages": totalPages, }) } + +// DBMatchPoolCounts GET /api/db/match-pool-counts 返回各匹配池的用户人数 +func DBMatchPoolCounts(c *gin.Context) { + db := database.DB() + var vipCount int64 + db.Model(&model.User{}).Where("is_vip = 1 AND vip_expire_date > NOW()").Count(&vipCount) + var completeCount int64 + db.Model(&model.User{}).Where( + "(phone IS NOT NULL AND phone != '') AND (nickname IS NOT NULL AND nickname != '')", + ).Count(&completeCount) + var allCount int64 + db.Model(&model.User{}).Where( + "((wechat_id IS NOT NULL AND wechat_id != '') OR (phone IS NOT NULL AND phone != ''))", + ).Count(&allCount) + c.JSON(http.StatusOK, gin.H{ + "success": true, + "data": gin.H{ + "vip": vipCount, + "complete": completeCount, + "all": allCount, + }, + }) +}