sync: soul-api 接口逻辑 | 原因: 后端接口逻辑修改
This commit is contained in:
@@ -28,13 +28,23 @@ func DBMatchRecordsList(c *gin.Context) {
|
||||
db.Model(&model.MatchRecord{}).Select("match_type as match_type, count(*) as count").Group("match_type").Scan(&byType)
|
||||
var uniqueUsers int64
|
||||
db.Model(&model.MatchRecord{}).Distinct("user_id").Count(&uniqueUsers)
|
||||
|
||||
// 匹配收益:product_type=match 且 status=paid 的订单金额总和
|
||||
var matchRevenue float64
|
||||
db.Model(&model.Order{}).Where("product_type = ? AND status = ?", "match", "paid").
|
||||
Select("COALESCE(SUM(amount), 0)").Scan(&matchRevenue)
|
||||
var paidMatchCount int64
|
||||
db.Model(&model.Order{}).Where("product_type = ? AND status = ?", "match", "paid").Count(&paidMatchCount)
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"success": true,
|
||||
"data": gin.H{
|
||||
"totalMatches": totalMatches,
|
||||
"todayMatches": todayMatches,
|
||||
"byType": byType,
|
||||
"uniqueUsers": uniqueUsers,
|
||||
"totalMatches": totalMatches,
|
||||
"todayMatches": todayMatches,
|
||||
"byType": byType,
|
||||
"uniqueUsers": uniqueUsers,
|
||||
"matchRevenue": matchRevenue,
|
||||
"paidMatchCount": paidMatchCount,
|
||||
},
|
||||
})
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user