Commit 57269151d78d3dbf7c959263c2022ba5f6c441e9

Authored by 王家文
1 parent ef5a4bc0
Exists in master

fix:房间排行bi用的玩家评级修改

service/roomrank/handle.go
... ... @@ -140,8 +140,6 @@ func HandleGetSettleAward(req *models.ReqRoomRankGetSettleAward) (code string, r
140 140 player.Name = req.PlayerName
141 141 player.Icon = req.PlayerIcon
142 142  
143   - oldUserClass := player.UserClass
144   -
145 143 // 采用分布式锁
146 144 lockKey := getLockKey(gameId, req.TopType)
147 145 opt := zredislock.GetOptionLimitRetry(RoomLockLinearBackoff, RoomLockMaxCount)
... ... @@ -173,7 +171,8 @@ func HandleGetSettleAward(req *models.ReqRoomRankGetSettleAward) (code string, r
173 171 // 查找玩家所在的房间
174 172 room, hasRoom := TryGetRoom(gameId, req.TopType, player, confActivity)
175 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 183 rsp.SettleRank = player.SettleRank
185 184 rsp.SettleScore = player.SettleScore
186 185 //rsp.UserClass = player.SettleUserClass
187   - rsp.UserClass = oldUserClass // 这里使用旧的用户评级 客户端用来打点
188 186 rsp.AwardText = player.SettleAward
189 187 player.SettleAward = ""
190 188 player.ActivityId = 0
... ...
service/roomrank/player.go
... ... @@ -138,25 +138,26 @@ func GetInfoFromRoom(gameId string, player *Player, room *Room, config *confroom
138 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 156 if confAward, hasConfAward := confRoom.Awards[zconvert.IntToStr(rank)]; hasConfAward {
156 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 }
... ...