From 413e3730014670bbe679bf3ca04816f62e3283a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E8=8B=A5?= Date: Sun, 8 Mar 2026 16:40:13 +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/admin_dashboard.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/soul-api/internal/handler/admin_dashboard.go b/soul-api/internal/handler/admin_dashboard.go index 18e65ade..3eba866f 100644 --- a/soul-api/internal/handler/admin_dashboard.go +++ b/soul-api/internal/handler/admin_dashboard.go @@ -104,6 +104,13 @@ func AdminDashboardOverview(c *gin.Context) { }) } + // 匹配统计 + var totalMatches int64 + db.Raw("SELECT COUNT(*) FROM match_records").Scan(&totalMatches) + var matchRevenue float64 + db.Model(&model.Order{}).Where("product_type = ? AND status IN ?", "match", []string{"paid", "completed", "success"}). + Select("COALESCE(SUM(amount),0)").Scan(&matchRevenue) + c.JSON(http.StatusOK, gin.H{ "success": true, "totalUsers": totalUsers, @@ -113,6 +120,8 @@ func AdminDashboardOverview(c *gin.Context) { "conversionRate": conversionRate, "recentOrders": recentOut, "newUsers": newUsersOut, + "totalMatches": totalMatches, + "matchRevenue": matchRevenue, }) }