From e1b1f689a6fe0e9a454e10262aee9331cd7cb004 Mon Sep 17 00:00:00 2001 From: zqj <582132116@qq.com> Date: Wed, 8 Sep 2021 12:02:26 +0800 Subject: [PATCH] fix: 记录用户跟设备信息, openItem协议的错误返回加上返回码 --- src/actions/RoleAction.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/actions/RoleAction.lua b/src/actions/RoleAction.lua index 0fe6933..e14fead 100644 --- a/src/actions/RoleAction.lua +++ b/src/actions/RoleAction.lua @@ -83,6 +83,9 @@ function _M.loginRpc( agent, data ) end end + -- 设备记录 + redisproxy:sadd(string_format("device:%d", roleId), msg.device) + local now = skynet.timex() local role = agent.role -- 2 @@ -614,11 +617,11 @@ function _M.openItemRpc(agent, data) local msg = MsgPack.unpack(data) local itemId = msg.itemId local count = msg.count - if math.illegalNum(count, 1, role:getItemCount(itemId)) then return end + if math.illegalNum(count, 1, role:getItemCount(itemId)) then return 1 end local itemData = csvdb["itemCsv"][itemId] - if itemData.use_type ~= 2 then return end + if itemData.use_type ~= 2 then return 2 end local randomData = csvdb["item_randomCsv"][tonumber(itemData.use_effect)] - if not randomData or randomData.openTime > 0 then return end + if not randomData or randomData.openTime > 0 then return 3 end local reward = {} for _i = 1, count do -- libgit2 0.21.2