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, }) }