sync: soul-api 接口逻辑 | 原因: 后端接口逻辑修改

This commit is contained in:
卡若
2026-03-08 15:40:58 +08:00
parent 12f7296f06
commit 37a80228ce

View File

@@ -21,11 +21,11 @@ func DBMatchRecordsList(c *gin.Context) {
var todayMatches int64
db.Model(&model.MatchRecord{}).Where("created_at >= CURDATE()").Count(&todayMatches)
type TypeCount struct {
MatchType string `json:"matchType"`
Count int64 `json:"count"`
MatchType string `json:"matchType" gorm:"column:match_type"`
Count int64 `json:"count" gorm:"column:count"`
}
var byType []TypeCount
db.Model(&model.MatchRecord{}).Select("match_type as match_type, count(*) as count").Group("match_type").Scan(&byType)
db.Raw("SELECT match_type, COUNT(*) as count FROM match_records GROUP BY match_type").Scan(&byType)
var uniqueUsers int64
db.Raw("SELECT COUNT(DISTINCT user_id) FROM match_records WHERE user_id IS NOT NULL AND user_id != ''").Scan(&uniqueUsers)