Commit 57269151d78d3dbf7c959263c2022ba5f6c441e9
1 parent
ef5a4bc0
Exists in
master
fix:房间排行bi用的玩家评级修改
Showing
2 changed files
with
19 additions
and
20 deletions
Show diff stats
service/roomrank/handle.go
| @@ -140,8 +140,6 @@ func HandleGetSettleAward(req *models.ReqRoomRankGetSettleAward) (code string, r | @@ -140,8 +140,6 @@ func HandleGetSettleAward(req *models.ReqRoomRankGetSettleAward) (code string, r | ||
| 140 | player.Name = req.PlayerName | 140 | player.Name = req.PlayerName |
| 141 | player.Icon = req.PlayerIcon | 141 | player.Icon = req.PlayerIcon |
| 142 | 142 | ||
| 143 | - oldUserClass := player.UserClass | ||
| 144 | - | ||
| 145 | // 采用分布式锁 | 143 | // 采用分布式锁 |
| 146 | lockKey := getLockKey(gameId, req.TopType) | 144 | lockKey := getLockKey(gameId, req.TopType) |
| 147 | opt := zredislock.GetOptionLimitRetry(RoomLockLinearBackoff, RoomLockMaxCount) | 145 | opt := zredislock.GetOptionLimitRetry(RoomLockLinearBackoff, RoomLockMaxCount) |
| @@ -173,7 +171,8 @@ func HandleGetSettleAward(req *models.ReqRoomRankGetSettleAward) (code string, r | @@ -173,7 +171,8 @@ func HandleGetSettleAward(req *models.ReqRoomRankGetSettleAward) (code string, r | ||
| 173 | // 查找玩家所在的房间 | 171 | // 查找玩家所在的房间 |
| 174 | room, hasRoom := TryGetRoom(gameId, req.TopType, player, confActivity) | 172 | room, hasRoom := TryGetRoom(gameId, req.TopType, player, confActivity) |
| 175 | if hasRoom { | 173 | if hasRoom { |
| 176 | - rsp.Tops = GetTopsInfoFromRoom(room, confActivity) | 174 | + //// 这里使用旧的用户评级 客户端用来打点 |
| 175 | + rsp.UserClass, rsp.Tops = GetTopsInfoFromRoom(room, confActivity) | ||
| 177 | } | 176 | } |
| 178 | } | 177 | } |
| 179 | } | 178 | } |
| @@ -184,7 +183,6 @@ func HandleGetSettleAward(req *models.ReqRoomRankGetSettleAward) (code string, r | @@ -184,7 +183,6 @@ func HandleGetSettleAward(req *models.ReqRoomRankGetSettleAward) (code string, r | ||
| 184 | rsp.SettleRank = player.SettleRank | 183 | rsp.SettleRank = player.SettleRank |
| 185 | rsp.SettleScore = player.SettleScore | 184 | rsp.SettleScore = player.SettleScore |
| 186 | //rsp.UserClass = player.SettleUserClass | 185 | //rsp.UserClass = player.SettleUserClass |
| 187 | - rsp.UserClass = oldUserClass // 这里使用旧的用户评级 客户端用来打点 | ||
| 188 | rsp.AwardText = player.SettleAward | 186 | rsp.AwardText = player.SettleAward |
| 189 | player.SettleAward = "" | 187 | player.SettleAward = "" |
| 190 | player.ActivityId = 0 | 188 | player.ActivityId = 0 |
service/roomrank/player.go
| @@ -138,25 +138,26 @@ func GetInfoFromRoom(gameId string, player *Player, room *Room, config *confroom | @@ -138,25 +138,26 @@ func GetInfoFromRoom(gameId string, player *Player, room *Room, config *confroom | ||
| 138 | return info | 138 | return info |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | -func GetTopsInfoFromRoom(room *Room, config *confroomrank.ActivityConfig) []models.RoomRankTopNode { | ||
| 142 | - info := make([]models.RoomRankTopNode, 0) | ||
| 143 | - for i := 0; i < len(room.Details.Players); i++ { | ||
| 144 | - p := room.Details.Players[i] | ||
| 145 | - rank := i + 1 | ||
| 146 | - node := models.RoomRankTopNode{ | ||
| 147 | - Rank: rank, | ||
| 148 | - Uid: p.Uid, | ||
| 149 | - Score: p.Score, | ||
| 150 | - Name: p.Name, | ||
| 151 | - Icon: p.Icon, | ||
| 152 | - IsRobot: p.IsRobot(), | ||
| 153 | - } | ||
| 154 | - if confRoom, hasConfRoom := config.Room[room.ConfigId]; hasConfRoom { | 141 | +func GetTopsInfoFromRoom(room *Room, config *confroomrank.ActivityConfig) (oldUserClass int, tops []models.RoomRankTopNode) { |
| 142 | + tops = make([]models.RoomRankTopNode, 0) | ||
| 143 | + if confRoom, hasConfRoom := config.Room[room.ConfigId]; hasConfRoom { | ||
| 144 | + oldUserClass = confRoom.UserClass | ||
| 145 | + for i := 0; i < len(room.Details.Players); i++ { | ||
| 146 | + p := room.Details.Players[i] | ||
| 147 | + rank := i + 1 | ||
| 148 | + node := models.RoomRankTopNode{ | ||
| 149 | + Rank: rank, | ||
| 150 | + Uid: p.Uid, | ||
| 151 | + Score: p.Score, | ||
| 152 | + Name: p.Name, | ||
| 153 | + Icon: p.Icon, | ||
| 154 | + IsRobot: p.IsRobot(), | ||
| 155 | + } | ||
| 155 | if confAward, hasConfAward := confRoom.Awards[zconvert.IntToStr(rank)]; hasConfAward { | 156 | if confAward, hasConfAward := confRoom.Awards[zconvert.IntToStr(rank)]; hasConfAward { |
| 156 | node.Award = confAward | 157 | node.Award = confAward |
| 157 | } | 158 | } |
| 159 | + tops = append(tops, node) | ||
| 158 | } | 160 | } |
| 159 | - info = append(info, node) | ||
| 160 | } | 161 | } |
| 161 | - return info | 162 | + return |
| 162 | } | 163 | } |