Commit bb5d94bd92685465a465cdcf89279b49a1ba1a28

Authored by liuzujun
2 parents 460afa6e 072db127

Merge branch 'develop' of 120.26.43.151:wasteland/server into develop

src/actions/AdvAction.lua
... ... @@ -250,7 +250,7 @@ function _M.startHangRpc(agent, data)
250 250 if not role:getAdvData():isRunning() then
251 251 role:updateProperty({field = "advTeam", value = {}})
252 252 end
253   -
  253 + role:pushMsg({type = "adv", slot = chapterId, time = adv_idle_time})
254 254 role:changeUpdates({{type = "advHang", field = chapterId, value = info}})
255 255  
256 256 role:changeAdvCount(adv_idle_energy)
... ... @@ -295,6 +295,7 @@ function _M.quickHangRpc(agent, data)
295 295 info.time = 0
296 296 role:changeUpdates({{type = "advHang", field = chapterId, value = info}})
297 297  
  298 + role:pushCancel({type = "adv", slot = chapterId})
298 299 role:mylog("adv_action", {desc = "advQuickHang", int1 = chapterId})
299 300  
300 301 SendPacket(actionCodes.Adv_quickHangRpc, '')
... ... @@ -371,6 +372,7 @@ function _M.endHangRpc(agent, data)
371 372 -- else
372 373 -- role:updateProperty({field = "advC", delta = -chapterData.limitlevel})
373 374 -- end
  375 + role:pushCancel({type = "adv", slot = chapterId})
374 376 else
375 377 return
376 378 end
... ...
src/actions/DinerAction.lua
... ... @@ -75,6 +75,9 @@ function _M.addSellRpc( agent, data )
75 75 sells[slot].count = count
76 76 sells[slot].time = skynet.timex() - calSell.deltaTime
77 77  
  78 + local needTime = sells[slot].count * dishData.sell_time + sells[slot].time - skynet.timex()
  79 + role:pushMsg({type = "food", slot = slot, time = needTime})
  80 +
78 81 -- 检查解锁的顾客
79 82 local had = {}
80 83 for _, sell in pairs(sells) do
... ... @@ -155,6 +158,7 @@ function _M.removeSellRpc( agent, data )
155 158 reward, change = role:award(reward, {log = {desc = "removeSell"}})
156 159 sells[slot].count = 0
157 160  
  161 + role:pushCancel({type = "food", slot = slot})
158 162 role:log("restaurant_sale", {
159 163 item_id = dish, -- 售卖物品ID
160 164 restaurant_sale_seat = slot, -- 售卖物品所在位置
... ...
src/actions/HangAction.lua
... ... @@ -152,11 +152,14 @@ function _M.startRpc( agent, data )
152 152 hangInfo.coinTime = math.min(nowTime, hangInfo.endCoinTime)
153 153 hangInfo.itemTime = math.min(nowTime, hangInfo.endItemTime)
154 154 end
  155 +
  156 + role:pushMsg({type = "hang", time = math.min(hangInfo.endCoinTime - nowTime, hangInfo.endItemTime - nowTime)})
155 157 if not role:checkHangPass(carbonId) then
156 158 hangInfo.bossTime = nowTime + carbonData.idle_time
157 159 else
158 160 hangInfo.bossTime = nil
159 161 end
  162 +
160 163 role:updateProperty({field = "hangInfo", value = hangInfo})
161 164  
162 165 -- 指定当前引导的步骤
... ... @@ -358,6 +361,8 @@ function _M.getRewardRpc(agent , data)
358 361 hangInfo.itemTime = nowTime
359 362 role:updateProperty({field = "hangBag", value = items})
360 363 role:updateProperty({field = "hangInfo", value = hangInfo})
  364 + role:pushMsg({type = "hang", time = globalCsv.idle_producetime_max})
  365 +
361 366 role:checkTaskEnter("HangGet", {reward = reward})
362 367 if reward[ItemId.Gold] then
363 368 role:checkTaskEnter("HangGetGold", {count = reward[ItemId.Gold]})
... ...
src/actions/RoleAction.lua
... ... @@ -121,6 +121,9 @@ function _M.loginRpc( agent, data )
121 121 role:setProperty("device", device)
122 122 end
123 123 end
  124 + if msg.token then
  125 + role._pushToken = msg.token
  126 + end
124 127  
125 128 if not msg.isGMlogin then
126 129 local banTime = role:getProperty("banTime")
... ... @@ -550,7 +553,7 @@ function _M.openTimeBoxRpc(agent, data)
550 553 if boxL[slot] then return end
551 554 role:costItems({[itemId] = 1}, {log = {desc = "openTimeBox"}})
552 555 boxL[slot] = {id = itemId, time = skynet.timex() + randomData.openTime}
553   -
  556 + role:pushMsg({type = "box", slot = slot, time = randomData.openTime})
554 557 elseif oper == 2 then -- 领取
555 558 local quick = msg.quick
556 559 if not boxL[slot] then return end
... ... @@ -561,6 +564,7 @@ function _M.openTimeBoxRpc(agent, data)
561 564 costKey = math.ceil((boxL[slot].time - skynet.timex()) / (cost_pre[1] * 60)) * cost_pre[2]
562 565 if not role:checkItemEnough({[ItemId.BoxKey] = costKey}) then return end
563 566 role:costItems({[ItemId.BoxKey] = costKey}, {log = {desc = "openTimeBox"}})
  567 + role:pushCancel({type = "box", slot = slot})
564 568 end
565 569 local boxId = boxL[slot].id
566 570 local itemData = csvdb["itemCsv"][boxId]
... ...
src/models/Diner.lua
... ... @@ -298,6 +298,9 @@ function Diner:expediteSell(slot)
298 298 self:checkDinerTask(DinerTask.SellDishType, expediteCount, math.ceil(sell.dish / 100))
299 299 self:checkDinerTask(DinerTask.SellDishRare, expediteCount, dishData.rarity)
300 300 self.owner:checkTaskEnter("FoodSell", {count = expediteCount})
  301 +
  302 + local needTime = sells[slot].count * dishData.sell_time + sells[slot].time - skynet.timex()
  303 + self.owner:pushMsg({type = "food", slot = slot, time = needTime})
301 304 end
302 305 return {
303 306 expediteCount = expediteCount,
... ...
src/models/Role.lua
... ... @@ -27,6 +27,7 @@ function Role:ctor( properties )
27 27 self.runeBag = {}
28 28 self.advData = nil
29 29 self.activity = nil
  30 + self._pushToken = nil
30 31 self.advElChapter = tonum(redisproxy:hget("adv_season", "chapter"), globalCsv.adv_endless_default_chapter) -- 无尽模式记录的赛季对应章节
31 32 self.advOverTime = tonum(redisproxy:hget("adv_season", "overTime")) -- 无尽模式关闭时间戳
32 33 if self.advOverTime == 0 then
... ...
src/models/RolePlugin.lua
... ... @@ -1743,7 +1743,36 @@ function RolePlugin.bind(Role)
1743 1743 end)
1744 1744 return gift, checkPoint
1745 1745 end
  1746 + --[[
  1747 + "hang" : "挂机资源满",
  1748 + "box" : "箱子拆解完毕",
  1749 + "food" : "食物出售完毕",
  1750 + "adv" : "代理拾荒完毕",
  1751 + --]]
  1752 + function Role:pushMsg(params)
  1753 + if not self._pushToken or self._pushToken == "" then return end
  1754 + if params.time <= 0 then
  1755 + self:pushCancel(params)
  1756 + return
  1757 + end
  1758 + local content = string.format("push:%d:%s:%s:%s", self:getProperty("id"), params.type, params.slot or 1, self._pushToken)
  1759 + notifyClient({content = content, time = math.floor(params.time)})
  1760 + end
1746 1761  
  1762 + function Role:pushCancel(params)
  1763 + if not self._pushToken or self._pushToken == "" then return end
  1764 + local content = string.format("push:%d:%s:%s:%s", self:getProperty("id"), params.type, params.slot or 1, self._pushToken)
  1765 + deleteNotify({content = content})
  1766 + end
  1767 +
  1768 + function Role:pushCancelAll(ptype)
  1769 + if not self._pushToken or self._pushToken == "" then return end
  1770 + local pattern = string.format("push:%d:*", self:getProperty("id"))
  1771 + if ptype then
  1772 + pattern = string.format("push:%d:%s:*", self:getProperty("id"), ptype)
  1773 + end
  1774 + deleteNotify({pattern = pattern})
  1775 + end
1747 1776 end
1748 1777  
1749 1778 return RolePlugin
1750 1779 \ No newline at end of file
... ...
src/utils/CommonFunc.lua
... ... @@ -310,7 +310,7 @@ function notifyClient(params)
310 310 params.key = "zhaolugame20170831"
311 311  
312 312 local status, body = httpc.get(skynet.getenv("codeurl"),
313   - "/mipush/notify_user?" .. httpGetFormatData(params), {}, {})
  313 + "/push/notify_user?" .. httpGetFormatData(params), {}, {})
314 314 if tonumber(status) ~= 200 then
315 315 skynet.error(status, body)
316 316 return
... ... @@ -325,7 +325,7 @@ function deleteNotify(params)
325 325 params.key = "zhaolugame20170831"
326 326  
327 327 local status, body = httpc.get(skynet.getenv("codeurl"),
328   - "/mipush/delete_notify?" .. httpGetFormatData(params), {}, {})
  328 + "/push/delete_notify?" .. httpGetFormatData(params), {}, {})
329 329 if tonumber(status) ~= 200 then
330 330 skynet.error(status, body)
331 331 return
... ...