Commit 98f7d4a82af578a4e89922bb9373353e2ea43d5a

Authored by liuzujun
2 parents e84a1beb 811cddfc

merge code

src/ProtocolCode.lua
... ... @@ -223,6 +223,7 @@ actionCodes = {
223 223 Store_getBattlePassRewardRpc = 562, --赛季卡奖励
224 224 Store_getExploreCommandRewardRpc = 563, --探索指令
225 225 Store_getTotalRechargeAwardRpc = 564, -- 累计充值
  226 + Store_monthCardRewardRpc = 565, --每日月卡+特刊奖励
226 227  
227 228 Store_biliCloudRechargeRpc = 596,
228 229 Store_biliAndroidRechargeRpc = 597,
... ...
src/actions/HeroAction.lua
... ... @@ -1095,6 +1095,16 @@ function _M.drawHeroRpc(agent, data)
1095 1095 end
1096 1096 role:finishGuide(8)
1097 1097  
  1098 + --每次抽卡获得对应货币,可在招募商城购买道具
  1099 + if buildTypeData["draw_type_item"] ~= 0 then
  1100 + local drawTypeItem = {}
  1101 + for id, count in pairs(buildTypeData["draw_type_item"]:toNumMap()) do
  1102 + drawTypeItem[id] = count * drawCount[drawType]
  1103 + drawAddReward[id] = drawTypeItem[id]
  1104 + end
  1105 + role:award(drawTypeItem, {log = {desc = "drawHero", int1 = btype}})
  1106 + end
  1107 +
1098 1108 role:log("gacha", {
1099 1109 gacha_id = poolId, -- 卡池ID
1100 1110 gacha_type = btype, -- 卡池类型
... ...
src/actions/StoreAction.lua
... ... @@ -548,4 +548,32 @@ function _M.getTotalRechargeAwardRpc(agent, data)
548 548 return true
549 549 end
550 550  
  551 +function _M.monthCardRewardRpc(agent, data)
  552 + local role = agent.role
  553 + local msg = MsgPack.unpack(data)
  554 + local mcid = msg.mcid
  555 + local smcid = msg.smcid
  556 +
  557 + local reward,change = {}, {}
  558 + --月卡奖励
  559 + local tmpreward, tmpchange = role.storeData:getMonthCardDailyReward(mcid)
  560 + if tmpreward then
  561 + for k, v in pairs(tmpreward) do
  562 + reward[k] = (reward[k] or 0) + v
  563 + end
  564 + if tmpchange then table.insert(change, tmpchange) end
  565 + end
  566 +
  567 + --特刊奖励
  568 + tmpreward, tmpchange = role.storeData:getSMonthCardDailyReward(smcid)
  569 + if tmpreward then
  570 + for k, v in pairs(tmpreward) do
  571 + reward[k] = (reward[k] or 0) + v
  572 + end
  573 + if tmpchange then table.insert(change, tmpchange) end
  574 + end
  575 + SendPacket(actionCodes.Store_monthCardRewardRpc, MsgPack.pack(role:packReward(reward, change)))
  576 + return true
  577 +end
  578 +
551 579 return _M
552 580 \ No newline at end of file
... ...
src/adv/Adv.lua
... ... @@ -1713,7 +1713,7 @@ local function clickTrader(self, room, block, params)
1713 1713 local goodsData = csvdb["event_trader_goodsCsv"][block.event.shop[buyId][1]]
1714 1714 if not goodsData then return false, 5 end
1715 1715  
1716   - local costCount = math.ceil(goodsData.price * (block.event.shop[buyId][2] or 100) / 100)
  1716 + local costCount = math.ceil(goodsData.price * (1 - (block.event.shop[buyId][2] or 100) / 100))
1717 1717 if not self:cost({[goodsData.currency] = costCount}, {log = {desc = "clickTrader", int1 = block.event.id}}) then return false, 6 end --不够
1718 1718 self:backCost({[goodsData.currency] = costCount})
1719 1719 self:award({[goodsData.item] = goodsData.num}, {log = {desc = "clickTrader", int1 = block.event.id}}, {})
... ...
src/models/RoleLog.lua
... ... @@ -64,6 +64,8 @@ local ItemReason = {
64 64 activityCrisis = 148, -- 物资危机奖励
65 65 glodConvertRune = 149, -- 金币兑换铭文
66 66 shopBuy = 150, -- 商店购买
  67 + monthCardReward = 151, --月卡奖励
  68 + smonthCardReward = 152, --特刊奖励
67 69  
68 70 advHang = 301, -- 拾荒挂机
69 71 hangBattle = 302, -- 挂机战斗
... ... @@ -393,7 +395,15 @@ local MethodType = {
393 395 currency_type = true, -- 购买道具消耗的货币类型,记录货币ID
394 396 shop_purchase_current = true, -- 购买道具消耗的货币数量
395 397 shop_id = true, -- 商店ID
396   - },
  398 + },
  399 + month_card = { --月卡+特刊奖励
  400 + item_type = true, --月卡 1, 特刊 2
  401 + item_id = true, --月卡id
  402 + before_ex = true, --未领取奖励前的期
  403 + cur_ex = true, --剩余期数
  404 + reward_time = true, --奖励时间
  405 + month_reward_detail = "json", --奖励物品 {'itemid1':123,'itemid2':456,………...}
  406 + },
397 407 --[[
398 408 100 添加好友
399 409 200 删除好友
... ...
src/models/RolePlugin.lua
... ... @@ -2215,16 +2215,16 @@ function RolePlugin.bind(Role)
2215 2215 if not self.activity:isOpenById(rechargeData.activity_id, "ActShopGoods") then return "" end
2216 2216 end
2217 2217  
2218   - local orderId = redisproxy:hget(string.format(R_ORDERS, roleId), rechargeId)
2219   - if orderId then
2220   - local uid = orderId * MAX_SVR_ID + serverId
2221   - local orderObject = require("models.Order").new({ key = string.format("%d", uid), id = uid })
2222   - if orderObject:load() and orderObject:getProperty("rechargeId") == rechargeId and math.abs(skynet.timex() - orderObject:getProperty("createTime")) < 5 * 60 then
2223   - return string.format("%d", uid)
2224   - end
2225   - end
  2218 + -- local orderId = redisproxy:hget(string.format(R_ORDERS, roleId), rechargeId)
  2219 + -- if orderId then
  2220 + -- local uid = orderId * MAX_SVR_ID + serverId
  2221 + -- local orderObject = require("models.Order").new({ key = string.format("%d", uid), id = uid })
  2222 + -- if orderObject:load() and orderObject:getProperty("rechargeId") == rechargeId and math.abs(skynet.timex() - orderObject:getProperty("createTime")) < 5 * 60 then
  2223 + -- return string.format("%d", uid)
  2224 + -- end
  2225 + -- end
2226 2226  
2227   - orderId = redisproxy:hincrby("autoincrement_set", "order", 1)
  2227 + local orderId = redisproxy:hincrby("autoincrement_set", "order", 1)
2228 2228 local uid = orderId * MAX_SVR_ID + serverId
2229 2229 local partnerOrderId = string.format("%d", orderId * MAX_SVR_ID + serverId)
2230 2230 local orderKey = string.format(R_ORDER, roleId, orderId)
... ... @@ -2241,7 +2241,7 @@ function RolePlugin.bind(Role)
2241 2241 })
2242 2242 order:create()
2243 2243 -- 正在进行中的订单 缓存
2244   - redisproxy:hset(string.format(R_ORDERS, roleId), rechargeId, orderId)
  2244 + -- redisproxy:hset(string.format(R_ORDERS, roleId), rechargeId, orderId)
2245 2245 return partnerOrderId
2246 2246 end
2247 2247  
... ... @@ -2294,7 +2294,7 @@ function RolePlugin.bind(Role)
2294 2294 -- redisproxy:hdel(string.format(R_ORDERS, roleId), rechargeId)
2295 2295 elseif status == "finsh" then
2296 2296 orderObject:setProperty("finishTime", skynet.time())
2297   - redisproxy:hdel(string.format(R_ORDERS, roleId), rechargeId)
  2297 + -- redisproxy:hdel(string.format(R_ORDERS, roleId), rechargeId)
2298 2298 end
2299 2299  
2300 2300 orderObject:update()
... ... @@ -2369,7 +2369,6 @@ function RolePlugin.bind(Role)
2369 2369 return rechargeId
2370 2370 end
2371 2371  
2372   -
2373 2372 function Role:recharge(params)
2374 2373 local id = tonumber(params.id)
2375 2374 local rechargeData = csvdb["shop_rechargeCsv"][id]
... ... @@ -2394,8 +2393,16 @@ function RolePlugin.bind(Role)
2394 2393 end
2395 2394 self:gainDiamond({count = diamondCount, isRecharge = true, sid = params.sid, log = {desc = "recharge", int1 = id}})
2396 2395 elseif rechargeData.shop == 2 then --通行证商店
  2396 + --订阅奖励
2397 2397 reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}})
2398   - self.storeData:onBuyCard(rechargeData.type, rechargeData.time, rechargeData.id, rechargeData.activity_id)
  2398 +
  2399 + --签收奖励
  2400 + local tmpreward, _ = self.storeData:onBuyCard(rechargeData.type, rechargeData.time, rechargeData.id, rechargeData.activity_id)
  2401 + if tmpreward then
  2402 + for k, v in pairs(tmpreward) do
  2403 + reward[k] = (reward[k] or 0) + v
  2404 + end
  2405 + end
2399 2406 elseif rechargeData.shop == 3 then -- 礼包商店
2400 2407 reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}})
2401 2408 else
... ...
src/models/RoleTimeReset.lua
... ... @@ -85,6 +85,7 @@ ResetFunc[&quot;CrossWeek&quot;] = function(self, notify, response)
85 85 response.dinerS = {}
86 86  
87 87 self.activity:refreshWeekData(notify)
  88 + self.storeData:refreshWeekData(notify)
88 89  
89 90 -- 跨周送一些道具
90 91 local BnousReward = self:getBnousPvpTicket()
... ...
src/models/Store.lua
... ... @@ -8,24 +8,13 @@ end
8 8  
9 9 function Store:onLoad()
10 10 local monEx = self:getProperty("monthCardEx")
11   - local smonEx = self:getProperty("smonthCardEx")
12 11 local monId = self:getProperty("monthCardId")
13   - local smonId = self:getProperty("smonthCardId")
14   - local timeNow = skynet.timex()
15 12 local flag = false
16   - if monEx > timeNow and monId == 0 then
  13 + if monEx > 0 and monId == 0 then
17 14 self:updateProperty({field = "monthCardId", value = 101})
18 15 self:updateProperty({field = "getMailT1", value = 0})
19 16 flag = true
20 17 end
21   - if smonEx > timeNow and smonId == 0 then
22   - self:updateProperty({field = "smonthCardId", value = 102})
23   - self:updateProperty({field = "getMailT2", value = 0})
24   - flag = true
25   - end
26   - if flag then
27   - self:sendMonthCardEmail()
28   - end
29 18 end
30 19  
31 20 ActGoodsType = {
... ... @@ -39,10 +28,13 @@ Store.schema = {
39 28 growFund = {"number", 0}, -- 成长基金
40 29 growFundR = {"string", ""}, -- 成长基金领取记录
41 30  
42   - monthCardEx = {"number", 0}, -- 月卡过期时间戳
  31 + monthCardEx = {"number", 0}, -- 期数
43 32 monthCardId = {"number", 0}, -- 月卡id
44   - smonthCardEx = {"number", 0}, -- 超级月卡过期时间戳
45   - smonthCardId = {"number", 0}, -- 超级月卡id
  33 + firstMonthCard = {"number", 1}, -- 首次订阅月卡
  34 + monthCardReceive = {"number", 0}, -- 月卡奖励领取记录 当天 0-未领取, 1-已经领取
  35 +
  36 + smonthCards = {"table", {}}, --特刊信息 {[id]={["buyCount"]=0, ["periods"]=0}} buyCount: 购买次数,periods: 剩余期数,
  37 + smonthCardReceive = {"number", 0}, -- 特刊奖励领取记录 当天 0-未领取, 1-已经领取
46 38  
47 39 battleCard = {"number", 0}, -- 赛季卡
48 40 battleFR = {"string", ""}, -- 免费赛季卡领取记录
... ... @@ -60,6 +52,9 @@ Store.schema = {
60 52 bpInfo = {"table", {}}, -- battle pass 探索指令 1={flag=0 为1表示买了,br=""付费领取记录, fr=""免费领取记录},2,3,4
61 53  
62 54 totalRR = {"string", ""}, -- 累计充值奖励领取记录
  55 +
  56 + dailyShop = {"table", {}},
  57 + weekShop = {"table", {}},
63 58 }
64 59  
65 60 function Store:updateProperty(params)
... ... @@ -82,9 +77,98 @@ function Store:updateProperty(params)
82 77 end
83 78  
84 79 function Store:onCrossDay()
85   - self:sendMonthCardEmail()
  80 + --self:sendMonthCardEmail()
86 81 self:deleteExpireLimitGoods()
87 82 --self:checkPaySignReward()
  83 +
  84 + --刷新商店
  85 + self:flushDailyShop()
  86 +
  87 + --重置月卡、特刊奖励领取记录
  88 + self:updateProperty({field = "monthCardReceive", value = 0})
  89 + self:updateProperty({field = "smonthCardReceive", value = 0})
  90 +end
  91 +
  92 +function Store:refreshWeekData(notify)
  93 + self:flushWeekShop()
  94 +end
  95 +
  96 +local SuperMonthCard = {}
  97 +
  98 +SuperMonthCard["buy"] = function(self, id)
  99 + local smonthCards = self:getProperty("smonthCards") or {}
  100 +
  101 + local BuyMonthCard = {}
  102 + BuyMonthCard["renewal"]= function()
  103 + --续刊
  104 + if self:isMonthCardExpire() then return false end
  105 +
  106 + local smonthCard = smonthCards[id] or {}
  107 + if next(smonthCard) then
  108 +
  109 + smonthCard["buyCount"] = (smonthCard["buyCount"] or 0) + 1
  110 +
  111 + local card = csvdb["shop_cardCsv"][id] or {}
  112 + local periods = SuperMonthCard["periods"](self, id) + (card["cardPlusPeriods"] or 30)
  113 + smonthCard["periods"] = periods
  114 +
  115 + self:updateProperty({filed = "smonthCards", value = smonthCards})
  116 + return true
  117 + end
  118 + end
  119 + BuyMonthCard["order"] = function()
  120 + --增刊条件
  121 + local card = csvdb["shop_cardCsv"][id] or {}
  122 + --判断是否购买过增刊条件里的特刊
  123 + local cardId = card["cardPlusCondition"] or 0
  124 + if self:isMonthCardExpire() or smonthCards[cardId] == nil then return false end
  125 +
  126 + --如果上期特刊奖励没有领取玩,则不能购买这期特刊。
  127 + if SuperMonthCard["isExpired"](self, cardId) == false and cardId ~= 101 then return false end
  128 +
  129 + smonthCards[id] = {["periods"] = (card["cardPlusPeriods"] or 30), ["buyCount"] = 1}
  130 +
  131 + self:updateProperty({filed = "smonthCards", value = smonthCards})
  132 + return true
  133 + end
  134 +
  135 + if SuperMonthCard["isExpired"](self, id) then
  136 + local smonthCard = smonthCards[id] or {}
  137 + if next(smonthCard) then
  138 + return BuyMonthCard["renewal"]()
  139 + else
  140 + return BuyMonthCard["order"]()
  141 + end
  142 + else
  143 + return BuyMonthCard["renewal"]()
  144 + end
  145 +end
  146 +
  147 +SuperMonthCard["periods"] = function(self, id)
  148 + local smonthCards = self:getProperty("smonthCards") or {}
  149 + local smonthCard = smonthCards[id] or {}
  150 + return smonthCard["periods"] or 0
  151 +end
  152 +
  153 +SuperMonthCard["isExpired"] = function (self, id)
  154 + local periods = SuperMonthCard["periods"](self, id)
  155 + return periods == 0
  156 +end
  157 +
  158 +SuperMonthCard["itemDaily"] = function(self, id)
  159 + local cur_ex = SuperMonthCard["periods"](self, id)
  160 + if cur_ex == 0 then return nil, nil end
  161 + cur_ex = cur_ex - 1
  162 +
  163 + local card = csvdb["shop_cardCsv"][id] or {}
  164 + local reward, change = self.owner:award(card["itemDaily"], {log = {desc = "smonthCardReward", int1 = id, int2 = cur_ex}})
  165 +
  166 + local smonthCards = self:getProperty("smonthCards") or {}
  167 + local smonthCard = smonthCards[id] or {}
  168 + smonthCard["periods"] = cur_ex
  169 + self:updateProperty({field = "smonthCards", value = smonthCards})
  170 +
  171 + return reward, change, cur_ex
88 172 end
89 173  
90 174 -- 删除过期商品
... ... @@ -139,15 +223,11 @@ function Store:sendMonthCardEmail()
139 223 end
140 224  
141 225 function Store:isMonthCardExpire()
142   - local timeNow = skynet.timex()
143   - local ts = self:getProperty("monthCardEx")
144   - return ts < timeNow
  226 + return self:getProperty("monthCardEx") == 0
145 227 end
146 228  
147   -function Store:isSuperMonthCardExpire()
148   - local timeNow = skynet.timex()
149   - local ts = self:getProperty("smonthCardEx")
150   - return ts < timeNow
  229 +function Store:isSuperMonthCardExpire(id)
  230 + return false
151 231 end
152 232  
153 233 function Store:isPrivCardExpire()
... ... @@ -225,23 +305,97 @@ function Store:getCurMonthCardLvl(isSuper)
225 305 return cfg.level or 0
226 306 end
227 307  
  308 +--获取月卡每日奖励
  309 +function Store:getMonthCardDailyReward(id)
  310 + if self:isMonthCardExpire() or self:getProperty("monthCardReceive") == 1 then return nil, nil end
  311 +
  312 + local before_ex = self:getProperty("monthCardEx")
  313 + self:updateProperty({field = "monthCardEx", delta = -1})
  314 + local cur_ex = self:getProperty("monthCardEx")
  315 +
  316 + local actCfg = csvdb["shop_card"][id] or {}
  317 + local award = actCfg.itemDaily:toNumMap()
  318 + local reward, change = self.owner:award(award, {log = {desc = "monthCardReward", int1 = id, int2 = cur_ex}})
  319 +
  320 + --今日月卡奖励已经领取
  321 + self:updateProperty({field = "monthCardReceive", value = 1})
  322 +
  323 + self.owner:log("month_card", {
  324 + item_type = CardType.NormalMonthCard,
  325 + item_id = id, --月卡id
  326 + before_ex = before_ex, --未领取奖励前的期
  327 + cur_ex = cur_ex, --剩余期数
  328 + reward_time = skynet.timex(), --奖励时间
  329 + month_reward_detail = reward,
  330 + })
  331 + return reward, change
  332 +end
  333 +
  334 +--获取特刊每日奖励
  335 +function Store:getSMonthCardDailyReward(id)
  336 + local before_ex = SuperMonthCard["periods"](self, id)
  337 + local reward, change, cur_ex= SuperMonthCard["itemDaily"](self, id)
  338 +
  339 + --今日特刊奖励已经领取
  340 + self:updateProperty({field = "smonthCardReceive", value = 1})
  341 +
  342 + self.owner:log("month_card", {
  343 + item_type = CardType.SuperMonthCard,
  344 + item_id = id, --月卡id
  345 + before_ex = before_ex, --未领取奖励前的期
  346 + cur_ex = cur_ex, --剩余期数
  347 + reward_time = skynet.timex(), --奖励时间
  348 + month_reward_detail = reward,
  349 + })
  350 + return reward, change
  351 +end
  352 +
  353 +function Store:firstBuyMonthCard(id)
  354 + if self:getProperty("firstMonthCard") == 1 then
  355 + self:updateProperty({field = "firstMonthCard", value = 0})
  356 + local card = csvdb["shop_cardCsv"][id] or {}
  357 + return self:award(card["cardFirst"], {log = {desc = "monthCardReward", int1 = id, int2 = 30}})
  358 + end
  359 + return nil
  360 +end
  361 +
228 362 -- 购买通行证
229 363 function Store:onBuyCard(type, duration, id, actid)
230 364 local timeNow = skynet.timex()
231 365 if type == CardType.NormalMonthCard then
232 366 if self:isMonthCardExpire() then
233 367 self:updateProperty({field = "monthCardId", value = id})
234   - self:updateProperty({field = "monthCardEx", value = timeNow + duration})
235   - else
236   - self:updateProperty({field = "monthCardEx", value = self:getProperty("monthCardEx") + duration})
237 368 end
238   - self:sendMonthCardEmail()
  369 + self:updateProperty({field = "monthCardEx", value = self:getProperty("monthCardEx") + 30})
  370 +
  371 + --初回特典 仅首次购买月卡时赠送SSR级角色"拉塔托娅"
  372 + local reward = {}
  373 + local tmpreward, _ = self:firstBuyMonthCard(id)
  374 + if tmpreward then
  375 + for k, v in pairs(tmpreward) do
  376 + reward[k] = (reward[k] or 0) + v
  377 + end
  378 + end
  379 +
  380 + --签收奖励
  381 + tmpreward, _= self:getMonthCardDailyReward(id)
  382 + if tmpreward then
  383 + for k, v in pairs(tmpreward) do
  384 + reward[k] = (reward[k] or 0) + v
  385 + end
  386 + end
  387 + return reward
  388 + elseif type == CardType.SuperMonthCard then
  389 + if SuperMonthCard["buy"](self, id) then
  390 + return self:getSMonthCardDailyReward(id)
  391 + end
  392 + return nil, nil
239 393 elseif type == CardType.NormalMonthCardLevelUp then
240 394 if self:isMonthCardExpire() then
241 395 skynet.error(string.format("month card expired, can not level up,%d,%d",self.owner:getProperty("id"), id))
242 396 else
243 397 local cfg = csvdb["shop_cardCsv"][id]
244   - if not cfg then return end
  398 + if not cfg then return end
245 399 local dif = cfg.level - self:getCurMonthCardLvl(false)
246 400 if dif > 1 and dif < 0 then
247 401 return
... ... @@ -250,20 +404,13 @@ function Store:onBuyCard(type, duration, id, actid)
250 404 self:updateProperty({field = "monthCardEx", value = self:getProperty("monthCardEx") + duration})
251 405 end
252 406 self:sendMonthCardEmail()
253   - elseif type == CardType.SuperMonthCard then
254   - if self:isSuperMonthCardExpire() then
255   - self:updateProperty({field = "smonthCardId", value = id})
256   - self:updateProperty({field = "smonthCardEx", value = timeNow + duration})
257   - else
258   - self:updateProperty({field = "smonthCardEx", value = self:getProperty("smonthCardEx") + duration})
259   - end
260   - self:sendMonthCardEmail()
  407 +
261 408 elseif type == CardType.SuperMonthCardLevelUp then
262 409 if self:isSuperMonthCardExpire() then
263 410 skynet.error(string.format("super month card expired, can not level up,%d,%d",self.owner:getProperty("id"), id))
264 411 else
265 412 local cfg = csvdb["shop_cardCsv"][id]
266   - if not cfg then return end
  413 + if not cfg then return end
267 414 local dif = cfg.level - self:getCurMonthCardLvl(true)
268 415 if dif > 1 and dif < 0 then
269 416 return
... ... @@ -306,6 +453,7 @@ function Store:onBuyCard(type, duration, id, actid)
306 453 self.owner:mylog("act_action", {desc="buyBc", int1=id, int2=actData["lvl"] or 0})
307 454 self.owner.activity:updateActData("BattleCommand", actData)
308 455 end
  456 + return nil, nil
309 457 end
310 458  
311 459 --检测购买是否超过限制数量
... ... @@ -548,6 +696,88 @@ function Store:OnTriggerLimitTimePackAfterTs(eventType, param)
548 696 end
549 697 end
550 698  
  699 +local function checkShopFinish(shop, shopPool)
  700 + local tmpShop = shopPool[shop.id] or {}
  701 + if next(tmpShop) then
  702 + if tmpShop.expire_ts then
  703 + if skynet.timex() > tmpShop.expire_ts then
  704 + shopPool[shop.id] = nil
  705 + return true
  706 + else
  707 + return false
  708 + end
  709 + else
  710 + tmpShop.expire_ts = skynet.timex() + tmpShop.cool_time * DAY_SEC
  711 + return false
  712 + end
  713 + else
  714 + return true
  715 + end
  716 +end
  717 +
  718 +--随机日/周商店随机两个商品
  719 +-- 1. 让缓存里的商品进入冷却时间
  720 +-- 2. 删除缓存里的已经冷却好的商品
  721 +-- 3. 随机两件商品放入缓存中
  722 +function Store:flushDailyShop()
  723 + local dailyShop = self:getProperty("dailyShop") or {}
  724 + local tmpDailyShop = {}
  725 +
  726 + for id, data in pairs(csvdb["shop_normalCsv"]) do
  727 + if data.shop == 1 and data.shopType == 3 then
  728 + if data.resetTime == 1 and checkShopFinish(data, dailyShop) then
  729 + tmpDailyShop[id] = {["id"] = data.id, ["weight"] = 100, ["cool_time"] = data.cool_time}
  730 + end
  731 + end
  732 + end
  733 +
  734 + --随机两件商品放入缓存 跨天刷新
  735 + if next(tmpDailyShop) then
  736 + local id = math.randWeight(tmpDailyShop)
  737 + if id then
  738 + dailyShop[id] = tmpDailyShop[id]
  739 + tmpDailyShop[id] = nil
  740 + end
  741 +
  742 + id = math.randWeight(tmpDailyShop)
  743 + if id then
  744 + dailyShop[id] = tmpDailyShop[id]
  745 + tmpDailyShop[id] = nil
  746 + end
  747 + end
  748 +
  749 + self:updateProperty({field="dailyShop", value= dailyShop})
  750 +end
  751 +
  752 +function Store:flushWeekShop()
  753 + local weekShop = self:getProperty("weekShop") or {}
  754 + local tmpWeekShop = {}
  755 +
  756 + for id, data in pairs(csvdb["shop_normalCsv"]) do
  757 + if data.shop == 1 and data.shopType == 3 then
  758 + if data.resetTime == 2 and checkShopFinish(data, weekShop)then
  759 + tmpWeekShop[id] = {["id"] = data.id, ["weight"] = 100, ["cool_time"] = data.cool_time}
  760 + end
  761 + end
  762 + end
  763 +
  764 + --随机两件商品放入缓存 跨周刷新
  765 + if next(tmpWeekShop) then
  766 + local id = math.randWeight(tmpWeekShop)
  767 + if id then
  768 + weekShop[id] = weekShop[id]
  769 + tmpWeekShop[id] = nil
  770 + end
  771 +
  772 + id = math.randWeight(tmpWeekShop)
  773 + if id then
  774 + weekShop[id] = weekShop[id]
  775 + tmpWeekShop[id] = nil
  776 + end
  777 + end
  778 + self:updateProperty({field="weekShop", value= weekShop})
  779 +end
  780 +
551 781 function Store:data()
552 782 self:OnTriggerLimitTimePackAfterTs(TriggerEventType.AfterTs, skynet.timex())
553 783 return {
... ... @@ -556,7 +786,6 @@ function Store:data()
556 786 growFund = self:getProperty("growFund"),
557 787 growFundR = self:getProperty("growFundR"),
558 788 monthCardEx = self:getProperty("monthCardEx"),
559   - smonthCardEx = self:getProperty("smonthCardEx"),
560 789 battleCard = self:getProperty("battleCard"),
561 790 battleFR = self:getProperty("battleFR"),
562 791 battleLR = self:getProperty("battleLR"),
... ... @@ -567,7 +796,10 @@ function Store:data()
567 796 bpInfo = self:getProperty("bpInfo"),
568 797 totalRR = self:getProperty("totalRR"),
569 798 monthCardId = self:getProperty("monthCardId"),
570   - smonthCardId = self:getProperty("smonthCardId"),
  799 + smonthCards = self:getProperty("smonthCards"),
  800 + smonthCardReceive = self:getProperty("smonthCardReceive"),
  801 + dailyShop = self:getProperty("dailyShop"),
  802 + weekShop = self:getProperty("weekShop"),
571 803 }
572 804 end
573 805  
... ...