Commit f66891bea5913b24c7ee4179b53085197cd40215

Authored by zhangqijia
1 parent da20e384

fix: 一番赏 打开激励奖导致抽奖逻辑性阻塞的bug

Showing 2 changed files with 12 additions and 8 deletions   Show diff stats
src/actions/CapsuleAction.lua
@@ -216,7 +216,7 @@ function _M.specialRewardRpc(agent, data) @@ -216,7 +216,7 @@ function _M.specialRewardRpc(agent, data)
216 local role = agent.role 216 local role = agent.role
217 local msg = MsgPack.unpack(data) 217 local msg = MsgPack.unpack(data)
218 local capsuleId = msg.capsule_id 218 local capsuleId = msg.capsule_id
219 - local typ = msg.typ --0=独享,1= 公开 219 + local typ = msg.typ or 1 --0=独享,1= 公开
220 local roleId = role:getProperty("id") 220 local roleId = role:getProperty("id")
221 221
222 local ret 222 local ret
src/models/Capsule.lua
@@ -428,12 +428,11 @@ function Capsule:getCore(record, recordAmount,now) @@ -428,12 +428,11 @@ function Capsule:getCore(record, recordAmount,now)
428 428
429 429
430 430
431 - local np = special["np"]  
432 - if np > recordAmount then return nil end 431 + local count = special["np"]
  432 + if count > recordAmount then return nil end
433 433
434 434
435 - local left = math.ceil((np - recordAmount)/2) or 0  
436 - local count = np 435 + local left = math.ceil((count - recordAmount)/2) or 0
437 local roleRecord = {} 436 local roleRecord = {}
438 for i, v in ipairs(record) do 437 for i, v in ipairs(record) do
439 if count <= 0 then break end 438 if count <= 0 then break end
@@ -475,8 +474,7 @@ function Capsule:getLast(record,now) @@ -475,8 +474,7 @@ function Capsule:getLast(record,now)
475 474
476 table.sort(record, function(a, b) return a.create_time > b.create_time end) 475 table.sort(record, function(a, b) return a.create_time > b.create_time end)
477 476
478 - local np = special["np"]  
479 - local count = np 477 + local count = special["np"]
480 local roleRecord = {} 478 local roleRecord = {}
481 for _, v in ipairs(record) do 479 for _, v in ipairs(record) do
482 if count <= 0 then break end 480 if count <= 0 then break end
@@ -665,7 +663,13 @@ function Capsule:checkIncentive(roleId, name, now) @@ -665,7 +663,13 @@ function Capsule:checkIncentive(roleId, name, now)
665 663
666 end 664 end
667 end 665 end
668 - table.insert(incentiveByRole, notify) 666 + for k, v in pairs(notify) do
  667 + if not incentiveByRole[k] then
  668 + incentiveByRole[k] = v
  669 + else
  670 + incentiveByRole[k].amount = incentiveByRole[k].amount + v.amount
  671 + end
  672 + end
669 incentiveRecord[roleId] = incentiveByRole 673 incentiveRecord[roleId] = incentiveByRole
670 self:setProperty("incentiveRecord", incentiveRecord) 674 self:setProperty("incentiveRecord", incentiveRecord)
671 675