Commit f2f84157be6e0b73731787a66cc47429b2a0b374

Authored by zhangqijia
1 parent 078bdb2f

fix: 一番赏 修复king赏bug

Showing 2 changed files with 11 additions and 9 deletions   Show diff stats
src/models/Capsule.lua
@@ -528,8 +528,6 @@ function Capsule:getKing(record, recordAmount, now) @@ -528,8 +528,6 @@ function Capsule:getKing(record, recordAmount, now)
528 end 528 end
529 table.sort(roleRecord, function(a, b) return a.count > b.count end) 529 table.sort(roleRecord, function(a, b) return a.count > b.count end)
530 530
531 - --tmp[spKey] = {name = name, good_id = spKey, typ = RewardType.SPECIAL, award = award, amount = 1, quality = typ, create_time= now}  
532 -  
533 local count = math.min(special["amount"], #roleRecord) 531 local count = math.min(special["amount"], #roleRecord)
534 532
535 local rewardByRole = {} 533 local rewardByRole = {}
@@ -541,7 +539,7 @@ function Capsule:getKing(record, recordAmount, now) @@ -541,7 +539,7 @@ function Capsule:getKing(record, recordAmount, now)
541 index = index + 1 539 index = index + 1
542 540
543 local name = getNameByRoleId(tmp.roleId) 541 local name = getNameByRoleId(tmp.roleId)
544 - rewardByRole[tmp.roleId][spKey] = {name = name, good_id = spKey, typ = RewardType.SPECIAL, award = special["award"], amount = 1, SpecialType.KING, create_time= now} 542 + table.insert(rewardByRole, {name = name, good_id = spKey, typ = RewardType.SPECIAL, award = special["award"], amount = 1, SpecialType.KING, create_time= now})
545 end 543 end
546 544
547 special["amount"] = count 545 special["amount"] = count
src/services/capsuled.lua
@@ -92,8 +92,9 @@ local function add(roleId, capsuleId) @@ -92,8 +92,9 @@ local function add(roleId, capsuleId)
92 end 92 end
93 93
94 local function capsuleRefreshing() 94 local function capsuleRefreshing()
  95 + local now = skynet.timex()
95 for _, v in pairs(capsules) do 96 for _, v in pairs(capsules) do
96 - if v:refreshing() then 97 + if v:refreshing(now) then
97 v:init() 98 v:init()
98 v:create() 99 v:create()
99 end 100 end
@@ -151,11 +152,14 @@ function CMD.start() @@ -151,11 +152,14 @@ function CMD.start()
151 if val.type == 1 then 152 if val.type == 1 then
152 local key = val.id..val.room 153 local key = val.id..val.room
153 if not capsules[key] then 154 if not capsules[key] then
154 - local capsule = require("models.Capsule").new({ key = CAPSULE_PUBLIC:format(key), id= val.id, room = val.room, typ = 1, name=val.name})  
155 - capsule:init()  
156 - capsule:create()  
157 - capsules[key] = capsule  
158 - redisproxy:sadd(CAPSULE_INFO, key) 155 + if now < val.hide_time then
  156 + local capsule = require("models.Capsule").new({ key = CAPSULE_PUBLIC:format(key), id= val.id, room = val.room, typ = 1, name=val.name})
  157 + capsule:init()
  158 + capsule:create()
  159 +
  160 + capsules[key] = capsule
  161 + redisproxy:sadd(CAPSULE_INFO, key)
  162 + end
159 end 163 end
160 end 164 end
161 end 165 end