From c0cd45cb8b1be4771fdd7c2e03b11d695f25e747 Mon Sep 17 00:00:00 2001 From: hujiebin Date: Fri, 16 Jun 2023 14:57:00 +0800 Subject: [PATCH] Update achievement.go --- domain/model/cp_m/achievement.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domain/model/cp_m/achievement.go b/domain/model/cp_m/achievement.go index 50083f7..d192370 100644 --- a/domain/model/cp_m/achievement.go +++ b/domain/model/cp_m/achievement.go @@ -45,7 +45,7 @@ func UpdateCpAchievement(model *domain.Model, cpId, userId1, userId2 mysql.ID, T func GetCpAchievements(model *domain.Model) []CpAchievement { var achievements []CpAchievement subQuery := model.DB().Table("cp_achievement a").Joins("JOIN cp_relation r ON a.cp_id = r.id").Select("type,MAX(score) AS max_score").Group("type") - if err := model.DB().Model(CpAchievement{}).Joins("INNER JOIN cp_relation r ON cp_id = r.id").Where("(type, score) IN (?)", subQuery).Find(&achievements).Error; err != nil { + if err := model.DB().Model(CpAchievement{}).Joins("INNER JOIN cp_relation r ON cp_id = r.id").Where("(type, score) IN (?)", subQuery).Order("type ASC").Find(&achievements).Error; err != nil { model.Log.Errorf("GetAchievements fail:%v", err) } return achievements -- 2.22.0