From e843d51f38b4864d820232f8e09380c1f37f719b Mon Sep 17 00:00:00 2001 From: hujiebin Date: Fri, 16 Jun 2023 14:55:45 +0800 Subject: [PATCH] fix: --- 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 57bcbe9..50083f7 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{}).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).Find(&achievements).Error; err != nil { model.Log.Errorf("GetAchievements fail:%v", err) } return achievements -- 2.22.0