Commit 3216156993407d0a68eac5e5a216a924b77746fe

Authored by gaofengduan
1 parent bc365ba7

fix diner

src/actions/DinerAction.lua
... ... @@ -130,28 +130,30 @@ end
130 130 function _M.getSellRewardRpc( agent, data )
131 131 local role = agent.role
132 132 local dirty = false
133   -
134 133 local reward = ""
135 134 local sells = json.decode(role.dinerData:getProperty("sells"))
136   - for slot, sell in pairs(sells) do
  135 + for slot, _ in pairs(sells) do
137 136 role.dinerData:updateSell(slot)
  137 + end
  138 + sells = json.decode(role.dinerData:getProperty("sells"))
  139 + for slot, sell in pairs(sells) do
138 140 local rewards = sell.reward:toNumMap()
139 141 for k,v in pairs(rewards) do
140 142 reward = reward:incrv(k, v)
141 143 end
142   - sells[slot].reward = ""
143 144  
144 145 if rewards[ItemId.Gold] and rewards[ItemId.Gold] > 0 then
145 146 if role.dinerData:checkDinerTask(DinerTask.DishWithGold, rewards[ItemId.Gold], sell.dish, nil, true) then
146 147 dirty = true
147 148 end
148 149 end
  150 + sells[slot].reward = ""
149 151 end
150   -
151 152 role.dinerData:updateProperty({field = "sells", value = json.encode(sells)})
152 153 for k, v in pairs(reward:toNumMap()) do
153 154 role:addItem({itemId = k,count = v})
154 155 end
  156 +
155 157 if dirty then
156 158 role.dinerData:notifyUpdateProperty("order", role.dinerData:getProperty("order"))
157 159 end
... ...
1   -Subproject commit d52d26ecb27c5bc5e532d033544cae9917434ea5
  1 +Subproject commit 01cf508187c65894bed310be2d903087b86f0255
... ...
src/models/Diner.lua
... ... @@ -173,11 +173,11 @@ function Diner:updateSell(slot, calOnly)
173 173  
174 174 if not calOnly then
175 175 local reward, popular = self:calSellReward(sell, deltaCount, dishData)
176   - sell.time = skynet.timex() - deltaTime
177   - sell.count = lastCount
178   - sell.level = self:getProperty("dishTree"):getv(sell.dish, 1)
179   - sell.hot = self:getProperty("hot"):getv(sell.dish, 0)
180   - sell.reward = reward
  176 + sells[slot].time = skynet.timex() - deltaTime
  177 + sells[slot].count = lastCount
  178 + sells[slot].level = self:getProperty("dishTree"):getv(sell.dish, 1)
  179 + sells[slot].hot = self:getProperty("hot"):getv(sell.dish, 0)
  180 + sells[slot].reward = reward
181 181 self:setProperty("sells", json.encode(sells))
182 182 self:incrProperty("popular",popular)
183 183  
... ...