From d1591ff1aa39f4ee4c456224feba4a856f1c5721 Mon Sep 17 00:00:00 2001 From: hujiebin Date: Fri, 16 Jun 2023 11:26:44 +0800 Subject: [PATCH] cpLvel --- cv/cp_cv/rank.go | 1 + route/cp_r/rank.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/cv/cp_cv/rank.go b/cv/cp_cv/rank.go index fe57ef9..f03c1f3 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 233b807..850b380 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, -- 2.22.0