diff --git a/cv/cp_cv/rank.go b/cv/cp_cv/rank.go index c3e6af4e3c96e5c5a6c3fc2da92db4cb0add7608..d1308a10f2583c93b19d2784d5d71911d4aac430 100644 --- a/cv/cp_cv/rank.go +++ b/cv/cp_cv/rank.go @@ -11,7 +11,7 @@ type CvCp struct { User2 *user_cv.CvUserBase `json:"user2"` // user2 Score uint32 `json:"score"` // 分值 CpLevel CvCpLevel `json:"cpLevel"` // cp等级 - //Ranking int `json:"ranking"` // 排名 + Ranking string `json:"ranking"` // 排名 } type CvCpAchievement struct { diff --git a/route/cp_r/rank.go b/route/cp_r/rank.go index f697fb5e28216bab5a9b3d85c006f986b5481fca..9330607cd62b339f1fb8903a32e2b77d644dbf4d 100644 --- a/route/cp_r/rank.go +++ b/route/cp_r/rank.go @@ -1,6 +1,7 @@ package cp_r import ( + "fmt" "git.hilo.cn/hilo-common/domain" "git.hilo.cn/hilo-common/mycontext" "git.hilo.cn/hilo-common/resource/mysql" @@ -70,13 +71,13 @@ func CpRank(c *gin.Context) (*mycontext.MyContext, error) { return myCtx, err } cpLevels := cp_m.MGetCpLevel(model, cpIds) - for _, rank := range ranks { + for i, rank := range ranks { response = append(response, cp_cv.CvCp{ - CpId: rank.CpId, - User1: userBase[rank.UserId1], - User2: userBase[rank.UserId2], - Score: rank.Score, - //Ranking: i + 1 + offset, + CpId: rank.CpId, + User1: userBase[rank.UserId1], + User2: userBase[rank.UserId2], + Score: rank.Score, + Ranking: fmt.Sprintf("%d", i+1+offset), CpLevel: cp_cv.CvCpLevel{ Level: cpLevels[rank.CpId].Level, //Points: cp_e.CpLevelPoints[cpLevel] + curPoints, @@ -149,6 +150,7 @@ func CpMy(c *gin.Context) (*mycontext.MyContext, error) { } if relation.UserId2 > 0 { response.User2 = userBases[relation.UserId2] + response.Ranking = "99+" } resp.ResponseOk(c, response) return myCtx, nil