From 1a1a6375b30324c451cd629e2dcc7b41156458d7 Mon Sep 17 00:00:00 2001 From: gaofengduan Date: Mon, 1 Jul 2019 20:23:50 +0800 Subject: [PATCH] fix lua warning --- src/actions/RoleAction.lua | 1 - src/models/RolePlugin.lua | 11 +++-------- src/shared/ModelBase.lua | 10 +++++----- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/actions/RoleAction.lua b/src/actions/RoleAction.lua index 07b3bf1..c2b8ccf 100644 --- a/src/actions/RoleAction.lua +++ b/src/actions/RoleAction.lua @@ -114,7 +114,6 @@ function _M.loginRpc( agent, data ) end end SERV_OPEN = redisproxy:hget("autoincrement_set", "server_start") - local ltime = role:getProperty("ltime") role:changeStructVersion() -- 数据结构 版本更新 diff --git a/src/models/RolePlugin.lua b/src/models/RolePlugin.lua index 713d954..8706801 100644 --- a/src/models/RolePlugin.lua +++ b/src/models/RolePlugin.lua @@ -18,7 +18,6 @@ function RolePlugin.bind(Role) end function Role:onCrossDay(now, notify) - local roleId = self:getProperty("id") local ltime = self:getProperty("ltime") if isCrossDay(ltime, now) then @@ -56,8 +55,6 @@ function RolePlugin.bind(Role) end end end - -- 其他 - return count end @@ -76,7 +73,7 @@ function RolePlugin.bind(Role) local itemTypeAward = { [ItemType.Hero] = function() pms.type = itemId - ItemStartId.Hero - for i = 1, count do + for _= 1, count do self:addHero(pms) end end, @@ -85,7 +82,7 @@ function RolePlugin.bind(Role) end, } -- 对数量筛查 - local count = checkItemCount(self, itemId, count) + count = checkItemCount(self, itemId, count) if count ~= 0 then if itemIdAward[itemId] then itemIdAward[itemId]() @@ -277,9 +274,7 @@ function RolePlugin.bind(Role) function Role:addHero(params) local roleId = self:getProperty("id") local heroId = tonum(redisproxy:hincrby(string.format(R_INCR, roleId), "hero", 1)) - local heroType = params.type - local unitData = csvdb["unitCsv"][heroType] redisproxy:sadd(string.format(R_HEROS, roleId), heroId) @@ -303,7 +298,7 @@ function RolePlugin.bind(Role) end end - function Role:delHero(params) + function Role:delHero(heroId) local roleId = self:getProperty('id') local hero = self.heros[heroId] if not hero then return end diff --git a/src/shared/ModelBase.lua b/src/shared/ModelBase.lua index 80ea8a0..faee246 100644 --- a/src/shared/ModelBase.lua +++ b/src/shared/ModelBase.lua @@ -28,7 +28,7 @@ function ModelBase:ctor(properties) if not self:isValidKey() then print(string_format("%s [%s:key] should be give in new(ctor)", tostring(self), self.class.__cname)) - return + return end if type(properties) ~= "table" then properties = {} end @@ -46,13 +46,13 @@ end --减少缓存引用计数 为时写入, 无参数 强制刷新所有缓存 function ModelBase:endCache( ... ) - args = { ... } - params = {} + local args = { ... } + local params = {} - function doOneCache(field) + local function doOneCache(field) local propname = field .. "_" table_insert(params, field) - if self.class.schema[fieldName][1] == "table" then + if self.class.schema[field][1] == "table" then table_insert(params, MsgPack.pack(self[propname])) else table_insert(params, self[propname]) -- libgit2 0.21.2