Commit 6a9c06e5a8b45cb0f3b4e6b7e49c06374cf909d2

Authored by zhangqijia
1 parent 7cbae6f3

fix: 加入del字段后,loginRpc协议,内存中还是del=1的角色,应该重新加载角色数据

Showing 1 changed file with 15 additions and 2 deletions   Show diff stats
src/actions/RoleAction.lua
... ... @@ -100,6 +100,18 @@ function _M.loginRpc( agent, data )
100 100 role:startActionUcode()
101 101 else
102 102 role:reloadWhenLogin()
  103 + if role:getProperty("del") == 1 then
  104 + local ret, res= roleByUid(role:getProperty("uid"))
  105 + if not ret then
  106 + response.result = "NOT_EXIST"
  107 + SendPacket(actionCodes.Role_loginRpc, MsgPack.pack(response))
  108 + end
  109 + role = require("models.Role").new({key = tostring(res["id"])})
  110 + role:load()
  111 + role:loadAll()
  112 + role:startActionUcode()
  113 + agent.role = role
  114 + end
103 115 end
104 116  
105 117  
... ... @@ -490,7 +502,7 @@ function _M.createRpc(agent, data)
490 502 skynet.error("[ERROR] cbbackd cant call center uid: " .. uid .. " roleId:" .. roleId)
491 503 end
492 504 end)
493   -
  505 +
494 506 -- cb1活跃回馈
495 507 onCb1Back(newRole)
496 508  
... ... @@ -506,7 +518,8 @@ function _M.unRegisterRpc(agent, data)
506 518 return 0
507 519 end
508 520  
509   - if not roleUnRegister(roleId) then return 1 end
  521 + role:setProperty("del", 1)
  522 + --if not roleUnRegister(roleId) then return 1 end
510 523 SendPacket(actionCodes.Role_unRegisterRpc, MsgPack.pack({}))
511 524 return true
512 525 end
... ...