diff --git a/cv/cp_cv/rank.go b/cv/cp_cv/rank.go index fe57ef96ca0cefe7f54a266481a0d410dbe49fd2..f03c1f38ece55d78b679367f4bccf57a4539f24f 100644 --- a/cv/cp_cv/rank.go +++ b/cv/cp_cv/rank.go @@ -18,6 +18,7 @@ type CvCpAchievement struct { CpId uint64 `json:"cpId"` // cpId User1 *user_cv.UserTiny `json:"user1"` // user1 User2 *user_cv.UserTiny `json:"user2"` // user2 + CpLevel cp_e.CpLevel `json:"cpLevel"` // cpLevel Type cp_e.CpAchievement `json:"type"` // 成就类型 1:等级 2:空间访问人数 3:月榜最高 4:周榜最高 5:日榜最高 TypeDesc string `json:"typeDesc"` // 成就类型翻译 Score uint32 `json:"score"` // 分值 diff --git a/route/cp_r/rank.go b/route/cp_r/rank.go index 233b807fee542307bc0ea8f8d3851a44e18e4b94..850b3801c4f0dc5d1aef43b89890739b161f31e6 100644 --- a/route/cp_r/rank.go +++ b/route/cp_r/rank.go @@ -259,19 +259,23 @@ func CpAchievement(c *gin.Context) (*mycontext.MyContext, error) { } achievements := cp_m.GetCpAchievements(model) var userIds []uint64 + var cpIds []uint64 for _, v := range achievements { userIds = append(userIds, v.UserId1) userIds = append(userIds, v.UserId2) + cpIds = append(cpIds, v.CpId) } users, err := user_m.GetUserMapByIds(model, userIds) if err != nil { return myCtx, err } + cpLevels := cp_m.MGetCpLevel(model, cpIds) for _, a := range achievements { response = append(response, cp_cv.CvCpAchievement{ CpId: a.CpId, User1: user_cv.UserToTiny(users[a.UserId1]), User2: user_cv.UserToTiny(users[a.UserId2]), + CpLevel: cpLevels[a.CpId].Level, Type: a.Type, TypeDesc: cp_m.GetTranslate(TypeDescMap[a.Type], lang), Score: a.Score,