Commit d1591ff1 authored by hujiebin's avatar hujiebin

cpLvel

parent 934c9fe0
...@@ -18,6 +18,7 @@ type CvCpAchievement struct { ...@@ -18,6 +18,7 @@ type CvCpAchievement struct {
CpId uint64 `json:"cpId"` // cpId CpId uint64 `json:"cpId"` // cpId
User1 *user_cv.UserTiny `json:"user1"` // user1 User1 *user_cv.UserTiny `json:"user1"` // user1
User2 *user_cv.UserTiny `json:"user2"` // user2 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:日榜最高 Type cp_e.CpAchievement `json:"type"` // 成就类型 1:等级 2:空间访问人数 3:月榜最高 4:周榜最高 5:日榜最高
TypeDesc string `json:"typeDesc"` // 成就类型翻译 TypeDesc string `json:"typeDesc"` // 成就类型翻译
Score uint32 `json:"score"` // 分值 Score uint32 `json:"score"` // 分值
......
...@@ -259,19 +259,23 @@ func CpAchievement(c *gin.Context) (*mycontext.MyContext, error) { ...@@ -259,19 +259,23 @@ func CpAchievement(c *gin.Context) (*mycontext.MyContext, error) {
} }
achievements := cp_m.GetCpAchievements(model) achievements := cp_m.GetCpAchievements(model)
var userIds []uint64 var userIds []uint64
var cpIds []uint64
for _, v := range achievements { for _, v := range achievements {
userIds = append(userIds, v.UserId1) userIds = append(userIds, v.UserId1)
userIds = append(userIds, v.UserId2) userIds = append(userIds, v.UserId2)
cpIds = append(cpIds, v.CpId)
} }
users, err := user_m.GetUserMapByIds(model, userIds) users, err := user_m.GetUserMapByIds(model, userIds)
if err != nil { if err != nil {
return myCtx, err return myCtx, err
} }
cpLevels := cp_m.MGetCpLevel(model, cpIds)
for _, a := range achievements { for _, a := range achievements {
response = append(response, cp_cv.CvCpAchievement{ response = append(response, cp_cv.CvCpAchievement{
CpId: a.CpId, CpId: a.CpId,
User1: user_cv.UserToTiny(users[a.UserId1]), User1: user_cv.UserToTiny(users[a.UserId1]),
User2: user_cv.UserToTiny(users[a.UserId2]), User2: user_cv.UserToTiny(users[a.UserId2]),
CpLevel: cpLevels[a.CpId].Level,
Type: a.Type, Type: a.Type,
TypeDesc: cp_m.GetTranslate(TypeDescMap[a.Type], lang), TypeDesc: cp_m.GetTranslate(TypeDescMap[a.Type], lang),
Score: a.Score, Score: a.Score,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment