Commit 1a7519baa782e99a220020b3eb6f1754a7903997

Authored by zhangqijia
1 parent 7c3dbe6d

fix: 一番赏 抽扭蛋机, incentive和special字段,如果没有对应奖励,则不加入对应的字段

Showing 1 changed file with 14 additions and 2 deletions   Show diff stats
src/models/Capsule.lua
@@ -766,7 +766,13 @@ function Capsule:drawByCount(roleId, count) @@ -766,7 +766,13 @@ function Capsule:drawByCount(roleId, count)
766 local goodsBySpecial = self:checkSpecialReward(now, goodsAmount) 766 local goodsBySpecial = self:checkSpecialReward(now, goodsAmount)
767 local specialByRole = rewardCollectByRoleId(roleId, reward, goodsBySpecial) 767 local specialByRole = rewardCollectByRoleId(roleId, reward, goodsBySpecial)
768 768
769 - return {reward = reward, usual = goodsByUsual, incentive = goodsByIncentive, specials = goodsBySpecial, special = specialByRole} 769 + local drawReward = {}
  770 + drawReward["reward"] = reward
  771 + drawReward["usual"] = goodsByUsual
  772 + drawReward["specials"] = goodsBySpecial
  773 + if next(goodsByIncentive) then drawReward["incentive"] = goodsByIncentive end
  774 + if next(specialByRole) then drawReward["special"] = specialByRole end
  775 + return drawReward
770 end 776 end
771 777
772 function Capsule:drawAll(roleId) 778 function Capsule:drawAll(roleId)
@@ -828,7 +834,13 @@ function Capsule:drawAll(roleId) @@ -828,7 +834,13 @@ function Capsule:drawAll(roleId)
828 local goodsBySpecial = self:checkSpecialReward(now, goodsAmount) 834 local goodsBySpecial = self:checkSpecialReward(now, goodsAmount)
829 local specialByRole = rewardCollectByRoleId(roleId, reward, goodsBySpecial) 835 local specialByRole = rewardCollectByRoleId(roleId, reward, goodsBySpecial)
830 836
831 - return {reward = reward, usual = goodsByUsual, incentive = goodsByIncentive, specials = goodsBySpecial, special = specialByRole} 837 + local drawReward = {}
  838 + drawReward["reward"] = reward
  839 + drawReward["usual"] = goodsByUsual
  840 + drawReward["specials"] = goodsBySpecial
  841 + if next(goodsByIncentive) then drawReward["incentive"] = goodsByIncentive end
  842 + if next(specialByRole) then drawReward["special"] = specialByRole end
  843 + return drawReward
832 end 844 end
833 845
834 --@param 846 --@param