Commit 096de6f71a563c9b2eb86659ec6c4aa2f082b4ad
1 parent
6304b5ad
fix: 一番赏 抽扭蛋机通知 特殊赏,只通知个人所获得的奖励
Showing
3 changed files
with
13 additions
and
17 deletions
Show diff stats
src/actions/CapsuleAction.lua
| @@ -104,7 +104,7 @@ function _M.drawRpc(agent, data) | @@ -104,7 +104,7 @@ function _M.drawRpc(agent, data) | ||
| 104 | else | 104 | else |
| 105 | ret, token = role:goodStock(capsuleId) | 105 | ret, token = role:goodStock(capsuleId) |
| 106 | end | 106 | end |
| 107 | - if ret == 0 then skynet.error("零库存 " .. capsuleId) return 1 end | 107 | + if ret == 0 then skynet.error("零库存 " .. capsuleId) return 0 end |
| 108 | 108 | ||
| 109 | --检查余额 | 109 | --检查余额 |
| 110 | if not next(token) then skynet.error("代币未配置 " .. capsuleId) return 1 end | 110 | if not next(token) then skynet.error("代币未配置 " .. capsuleId) return 1 end |
src/models/RoleCross.lua
| @@ -211,20 +211,16 @@ RoleCross.bind = function (Role) | @@ -211,20 +211,16 @@ RoleCross.bind = function (Role) | ||
| 211 | end | 211 | end |
| 212 | 212 | ||
| 213 | function Role:paySpecialReward(roleId, notify) | 213 | function Role:paySpecialReward(roleId, notify) |
| 214 | + dump(notify) | ||
| 214 | if notify and next(notify) then | 215 | if notify and next(notify) then |
| 215 | local reward = {} | 216 | local reward = {} |
| 216 | for key, val in pairs(notify) do | 217 | for key, val in pairs(notify) do |
| 217 | - if key == roleId then | ||
| 218 | - for k, v in pairs(val) do | ||
| 219 | - for id, count in pairs(v.award:toNumMap()) do | ||
| 220 | - reward[id] = (reward[id] or 0) + count | ||
| 221 | - end | ||
| 222 | - end | 218 | + for id, count in pairs(val.award:toNumMap()) do |
| 219 | + reward[id] = (reward[id] or 0) + count | ||
| 223 | end | 220 | end |
| 224 | 221 | ||
| 225 | end | 222 | end |
| 226 | - local role = require("models.Role").new({key = string.format("%s",roleId), id = roleId}) | ||
| 227 | - role:award(reward, {log = {desc = "CapsuleReward", int1=roleId}}) | 223 | + self:award(reward, {log = {desc = "CapsuleReward", int1=roleId}}) |
| 228 | end | 224 | end |
| 229 | end | 225 | end |
| 230 | 226 | ||
| @@ -389,16 +385,14 @@ function CMD.redPTag(roleId, tag, pms) | @@ -389,16 +385,14 @@ function CMD.redPTag(roleId, tag, pms) | ||
| 389 | end | 385 | end |
| 390 | 386 | ||
| 391 | function CMD.paySpecialReward(roleId, notify) | 387 | function CMD.paySpecialReward(roleId, notify) |
| 388 | + dump(notify) | ||
| 392 | if notify and next(notify) then | 389 | if notify and next(notify) then |
| 393 | - local reward = {} | 390 | + local reward = {} |
| 394 | for key, val in pairs(notify) do | 391 | for key, val in pairs(notify) do |
| 395 | - if key == roleId then | ||
| 396 | - for k, v in pairs(val) do | ||
| 397 | - for id, count in pairs(v.award:toNumMap()) do | ||
| 398 | - reward[id] = (reward[id] or 0) + count | ||
| 399 | - end | ||
| 400 | - end | 392 | + for id, count in pairs(val.award:toNumMap()) do |
| 393 | + reward[id] = (reward[id] or 0) + count | ||
| 401 | end | 394 | end |
| 395 | + | ||
| 402 | end | 396 | end |
| 403 | local role = require("models.Role").new({key = string.format("%s",roleId), id = roleId}) | 397 | local role = require("models.Role").new({key = string.format("%s",roleId), id = roleId}) |
| 404 | role:award(reward, {log = {desc = "CapsuleReward", int1=roleId}}) | 398 | role:award(reward, {log = {desc = "CapsuleReward", int1=roleId}}) |
src/services/capsuled.lua
| @@ -68,7 +68,9 @@ function broadCastSpecial(roleId, capsuleId, broadInfo) | @@ -68,7 +68,9 @@ function broadCastSpecial(roleId, capsuleId, broadInfo) | ||
| 68 | if next(capsule) then | 68 | if next(capsule) then |
| 69 | for id, _ in pairs(register) do | 69 | for id, _ in pairs(register) do |
| 70 | if id ~= roleId then | 70 | if id ~= roleId then |
| 71 | - rpcRole(id, "paySpecialReward", id, broadInfo) | 71 | + if broadInfo[id] then |
| 72 | + rpcRole(id, "paySpecialReward", id, broadInfo[id]) | ||
| 73 | + end | ||
| 72 | end | 74 | end |
| 73 | end | 75 | end |
| 74 | end | 76 | end |