Commit e1b1f689a6fe0e9a454e10262aee9331cd7cb004

Authored by zhangqijia
1 parent e66080dd

fix: 记录用户跟设备信息, openItem协议的错误返回加上返回码

Showing 1 changed file with 6 additions and 3 deletions   Show diff stats
src/actions/RoleAction.lua
... ... @@ -83,6 +83,9 @@ function _M.loginRpc( agent, data )
83 83 end
84 84 end
85 85  
  86 + -- 设备记录
  87 + redisproxy:sadd(string_format("device:%d", roleId), msg.device)
  88 +
86 89 local now = skynet.timex()
87 90 local role = agent.role
88 91 -- 2
... ... @@ -614,11 +617,11 @@ function _M.openItemRpc(agent, data)
614 617 local msg = MsgPack.unpack(data)
615 618 local itemId = msg.itemId
616 619 local count = msg.count
617   - if math.illegalNum(count, 1, role:getItemCount(itemId)) then return end
  620 + if math.illegalNum(count, 1, role:getItemCount(itemId)) then return 1 end
618 621 local itemData = csvdb["itemCsv"][itemId]
619   - if itemData.use_type ~= 2 then return end
  622 + if itemData.use_type ~= 2 then return 2 end
620 623 local randomData = csvdb["item_randomCsv"][tonumber(itemData.use_effect)]
621   - if not randomData or randomData.openTime > 0 then return end
  624 + if not randomData or randomData.openTime > 0 then return 3 end
622 625  
623 626 local reward = {}
624 627 for _i = 1, count do
... ...