diff --git a/domain/model/cp_m/achievement.go b/domain/model/cp_m/achievement.go index 57bcbe93d122ce420dae8015baf4e70c248d5f36..50083f71759250403eae5e4bed3a9fea51cd932f 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