Commit 08d7833df61fbf4eedaf0185d99de749a94c1d2d
1 parent
533fde9c
Exists in
master
and in
1 other branch
feat✨:排行榜返回数据里加上了自己的评级
Showing
3 changed files
with
4 additions
and
0 deletions
Show diff stats
models/roomrank.go
| @@ -30,6 +30,7 @@ type RoomRankTopNode struct { | @@ -30,6 +30,7 @@ type RoomRankTopNode struct { | ||
| 30 | type RoomRankInfo struct { | 30 | type RoomRankInfo struct { |
| 31 | SettleHas bool `form:"settle_has" json:"settle_has"` // 有结算内容未领取 | 31 | SettleHas bool `form:"settle_has" json:"settle_has"` // 有结算内容未领取 |
| 32 | SettleAward string `form:"settle_award" json:"settle_award"` // 结算奖励内容 | 32 | SettleAward string `form:"settle_award" json:"settle_award"` // 结算奖励内容 |
| 33 | + UserClass int `form:"user_class" json:"user_class"` // 用户评级 | ||
| 33 | SelfRank int `form:"self_rank" json:"self_rank"` // 自己排名 | 34 | SelfRank int `form:"self_rank" json:"self_rank"` // 自己排名 |
| 34 | SelfScore int64 `form:"self_score" json:"self_score"` // 自己积分 | 35 | SelfScore int64 `form:"self_score" json:"self_score"` // 自己积分 |
| 35 | Tops []RoomRankTopNode `form:"tops" json:"tops"` // 排行榜数据列表 | 36 | Tops []RoomRankTopNode `form:"tops" json:"tops"` // 排行榜数据列表 |
| @@ -61,6 +62,7 @@ type ReqRoomRankGetSettleAward struct { | @@ -61,6 +62,7 @@ type ReqRoomRankGetSettleAward struct { | ||
| 61 | // RspRoomRankGetSettleAward 返回 领取上期结算奖励 | 62 | // RspRoomRankGetSettleAward 返回 领取上期结算奖励 |
| 62 | type RspRoomRankGetSettleAward struct { | 63 | type RspRoomRankGetSettleAward struct { |
| 63 | AwardText string `form:"award_text" json:"award_text"` // 上期结算奖励内容 | 64 | AwardText string `form:"award_text" json:"award_text"` // 上期结算奖励内容 |
| 65 | + UserClass int `form:"user_class" json:"user_class"` // 用户评级 | ||
| 64 | } | 66 | } |
| 65 | 67 | ||
| 66 | // ReqRoomRankAddScore 请求 房间排行增加积分 | 68 | // ReqRoomRankAddScore 请求 房间排行增加积分 |
service/roomrank/handle.go
| @@ -133,6 +133,7 @@ func HandleGetSettleAward(req *models.ReqRoomRankGetSettleAward) (code string, r | @@ -133,6 +133,7 @@ func HandleGetSettleAward(req *models.ReqRoomRankGetSettleAward) (code string, r | ||
| 133 | 133 | ||
| 134 | // 领取奖励 | 134 | // 领取奖励 |
| 135 | rsp.AwardText = player.SettleAward | 135 | rsp.AwardText = player.SettleAward |
| 136 | + rsp.UserClass = player.UserClass | ||
| 136 | player.SettleHas = false | 137 | player.SettleHas = false |
| 137 | player.SettleAward = "" | 138 | player.SettleAward = "" |
| 138 | player.ActivityId = config.Id | 139 | player.ActivityId = config.Id |
service/roomrank/player.go
| @@ -78,6 +78,7 @@ func GetInfoFromSettle(player *Player, conf *confroomrank.ActivityConfig) models | @@ -78,6 +78,7 @@ func GetInfoFromSettle(player *Player, conf *confroomrank.ActivityConfig) models | ||
| 78 | // GetInfoFromRoom 活动信息 从房间 | 78 | // GetInfoFromRoom 活动信息 从房间 |
| 79 | func GetInfoFromRoom(player *Player, room *Room) models.RoomRankInfo { | 79 | func GetInfoFromRoom(player *Player, room *Room) models.RoomRankInfo { |
| 80 | info := models.RoomRankInfo{} | 80 | info := models.RoomRankInfo{} |
| 81 | + info.UserClass = player.UserClass | ||
| 81 | for i := 0; i < len(room.Details.Players); i++ { | 82 | for i := 0; i < len(room.Details.Players); i++ { |
| 82 | p := room.Details.Players[i] | 83 | p := room.Details.Players[i] |
| 83 | rank := i + 1 | 84 | rank := i + 1 |