diff --git a/src/actions/CapsuleAction.lua b/src/actions/CapsuleAction.lua index 238407b..c40b93f 100644 --- a/src/actions/CapsuleAction.lua +++ b/src/actions/CapsuleAction.lua @@ -216,7 +216,7 @@ function _M.specialRewardRpc(agent, data) local role = agent.role local msg = MsgPack.unpack(data) local capsuleId = msg.capsule_id - local typ = msg.typ --0=独享,1= 公开 + local typ = msg.typ or 1 --0=独享,1= 公开 local roleId = role:getProperty("id") local ret diff --git a/src/models/Capsule.lua b/src/models/Capsule.lua index aea777e..9f99089 100644 --- a/src/models/Capsule.lua +++ b/src/models/Capsule.lua @@ -428,12 +428,11 @@ function Capsule:getCore(record, recordAmount,now) - local np = special["np"] - if np > recordAmount then return nil end + local count = special["np"] + if count > recordAmount then return nil end - local left = math.ceil((np - recordAmount)/2) or 0 - local count = np + local left = math.ceil((count - recordAmount)/2) or 0 local roleRecord = {} for i, v in ipairs(record) do if count <= 0 then break end @@ -475,8 +474,7 @@ function Capsule:getLast(record,now) table.sort(record, function(a, b) return a.create_time > b.create_time end) - local np = special["np"] - local count = np + local count = special["np"] local roleRecord = {} for _, v in ipairs(record) do if count <= 0 then break end @@ -665,7 +663,13 @@ function Capsule:checkIncentive(roleId, name, now) end end - table.insert(incentiveByRole, notify) + for k, v in pairs(notify) do + if not incentiveByRole[k] then + incentiveByRole[k] = v + else + incentiveByRole[k].amount = incentiveByRole[k].amount + v.amount + end + end incentiveRecord[roleId] = incentiveByRole self:setProperty("incentiveRecord", incentiveRecord) -- libgit2 0.21.2