Commit 1e2c53169cf317161a9655b97a4403fc66ce159f

Authored by zhangqijia
1 parent 7fe1158c

fix: 修改昵称,餐厅/电波塔/拾荒排行榜对应用户昵称未修改的bug

【ID1232549】 【拂晓的拾荒团-国服】【餐厅】【当玩家修改名字后排行榜未能及时更新数据】
src/actions/RoleAction.lua
@@ -493,6 +493,10 @@ function _M.changeNameRpc(agent, data) @@ -493,6 +493,10 @@ function _M.changeNameRpc(agent, data)
493 ["name"] = newName, 493 ["name"] = newName,
494 }) 494 })
495 495
  496 + role.dinerData:updateRankRoleName(newName)
  497 + role:updateTowerRankName(newName)
  498 + role:updateAdvRankName(newName)
  499 +
496 role:changeCrossServerPvpSelfInfo("name") 500 role:changeCrossServerPvpSelfInfo("name")
497 role:checkTaskEnter("Rename", {}) 501 role:checkTaskEnter("Rename", {})
498 SendPacket(actionCodes.Role_changeNameRpc, MsgPack.pack({result = 0})) 502 SendPacket(actionCodes.Role_changeNameRpc, MsgPack.pack({result = 0}))
src/models/Diner.lua
@@ -394,6 +394,18 @@ function Diner:getPopularRank() @@ -394,6 +394,18 @@ function Diner:getPopularRank()
394 return {list = list, rank = rank} 394 return {list = list, rank = rank}
395 end 395 end
396 396
  397 +function Diner:updateRankRoleName(name)
  398 + if name:len() <= 0 then return end
  399 +
  400 + local roleId = self.owner:getProperty("id")
  401 + local redret = redisproxy:hget(RANK_DINER_INFO, roleId)
  402 + if redret:len() > 0 then
  403 + local player = MsgPack.unpack(redret)
  404 + player.name = name
  405 + redisproxy:hset(RANK_DINER_INFO, roleId, MsgPack.pack(player))
  406 + end
  407 +end
  408 +
397 function Diner:data() 409 function Diner:data()
398 local properties = { 410 local properties = {
399 "buildL", 411 "buildL",
src/models/RolePlugin.lua
@@ -1697,6 +1697,30 @@ function RolePlugin.bind(Role) @@ -1697,6 +1697,30 @@ function RolePlugin.bind(Role)
1697 end 1697 end
1698 end 1698 end
1699 1699
  1700 + function Role:updateTowerRankName(name)
  1701 + if name:len() <= 0 then return end
  1702 + local roleId = self:getProperty("id")
  1703 + for _, info in pairs(TowerRankInfo) do
  1704 + local data = redisproxy:hget(info.rankInfo, roleId)
  1705 + if data then
  1706 + local player = MsgPack.unpack(data)
  1707 + player.name = name
  1708 + redisproxy:hset(info.rankInfo, roleId, MsgPack.pack(player))
  1709 + end
  1710 + end
  1711 + end
  1712 +
  1713 + function Role:updateAdvRankName(name)
  1714 + if name:len() <= 0 then return end
  1715 + local roleId = self:getProperty("id")
  1716 + local data = redisproxy:hget(RANK_ADV_INFO, roleId)
  1717 + if data then
  1718 + local player = MsgPack.unpack(data)
  1719 + player.name = name
  1720 + redisproxy:hset(RANK_ADV_INFO, roleId, MsgPack.pack(player))
  1721 + end
  1722 + end
  1723 +
1700 function Role:addAdvLvExp(exp) 1724 function Role:addAdvLvExp(exp)
1701 local advL = self:getProperty("advL") 1725 local advL = self:getProperty("advL")
1702 local level = advL[1] 1726 local level = advL[1]