Blame view

src/models/Store.lua 30.3 KB
c5825110   saicom   新增用户商城相关数据
1
2
  -- 商店数据
  
fa992c94   liuzujun   添加daily,diner,act...
3
  local Store = class("Store", require("shared.ModelBaseMysql"))
c5825110   saicom   新增用户商城相关数据
4
5
  
  function Store:ctor(properties)
54f63c13   liuzujun   修复老月卡用户的月卡id字段
6
7
8
9
10
      Store.super.ctor(self, properties)
  end
  
  function Store:onLoad()
      local monEx = self:getProperty("monthCardEx")
54f63c13   liuzujun   修复老月卡用户的月卡id字段
11
      local monId = self:getProperty("monthCardId")
54f63c13   liuzujun   修复老月卡用户的月卡id字段
12
      local flag = false
c40a6460   zhangqijia   feat: 月卡+特刊
13
      if monEx > 0 and monId == 0 then
54f63c13   liuzujun   修复老月卡用户的月卡id字段
14
15
16
17
          self:updateProperty({field = "monthCardId", value = 101})
          self:updateProperty({field = "getMailT1", value = 0})
          flag = true
      end
c5825110   saicom   新增用户商城相关数据
18
19
  end
  
51d9d20b   liuzujun   付费签到,应用市场反馈
20
21
22
23
  ActGoodsType = {
      paySignIn = 1,  -- 付费签到
  }
  
c5825110   saicom   新增用户商城相关数据
24
  Store.schema = {
fa992c94   liuzujun   添加daily,diner,act...
25
  	id 		= {"number", 0, "pri"},		-- 角色id
3e20f499   saicom   完善商城相关协议
26
27
28
  	buyR		= {"table", {}},		-- 购买商品记录 {id=count}
  	payR	= {"table", {}},		-- 充值记录 {id=count}
  	growFund		= {"number", 0},		-- 成长基金
51d9d20b   liuzujun   付费签到,应用市场反馈
29
30
      growFundR  = {"string", ""},        -- 成长基金领取记录
  
c40a6460   zhangqijia   feat: 月卡+特刊
31
  	monthCardEx	= {"number", 0},		-- 期数
2e283f60   liuzujun   月卡升级
32
  	monthCardId	= {"number", 0},		-- 月卡id
81941afd   zhangqijia   fix: 特刊增加初回特典, 优化...
33
      firstMonthCard =  {"number", 0},      -- 首次订阅月卡
c40a6460   zhangqijia   feat: 月卡+特刊
34
35
      monthCardReceive = {"number", 0},      -- 月卡奖励领取记录 当天 0-未领取, 1-已经领取
  
99f84aa1   zhangqijia   fix: 特刊解锁机制修改,删除o...
36
      smonthCards = {"table", {}},     --特刊信息 {[id]={["buyCount"]=0, ["periods"]=0}} buyCount: 购买次数,periods: 剩余期数,
c40a6460   zhangqijia   feat: 月卡+特刊
37
      smonthCardReceive = {"number", 0},      -- 特刊奖励领取记录 当天 0-未领取, 1-已经领取
81941afd   zhangqijia   fix: 特刊增加初回特典, 优化...
38
      firstSMonthCard =  {"table", {}},      -- 首次订阅当期特刊
51d9d20b   liuzujun   付费签到,应用市场反馈
39
  
fb3d084d   liuzujun   月卡赛季卡发送邮件奖励
40
  	battleCard	= {"number", 0},		-- 赛季卡
3e20f499   saicom   完善商城相关协议
41
42
  	battleFR = {"string", ""},		-- 免费赛季卡领取记录
      battleLR = {"string", ""},		-- 付费赛季卡领取记录
51d9d20b   liuzujun   付费签到,应用市场反馈
43
  
00bf6029   liuzujun   限时礼包,抽卡ssr广播
44
      limitTPack = {"table", {}},      -- 限时礼包 {id={expire_ts, trigger_type}}
fb3d084d   liuzujun   月卡赛季卡发送邮件奖励
45
46
47
      privCardEx = {"number", 0},          -- 特权卡过期时间戳
      getMailT1 = {"number",0},       -- 上次发送月卡福利邮件的时间
      getMailT2 = {"number",0},       -- 上次发送超级月卡福利邮件的时间
00bf6029   liuzujun   限时礼包,抽卡ssr广播
48
      --packTrigger = {"table", {}},     -- 礼包触发记录 {关卡难度1={id, 通关关卡数,升级数,爬塔层数}, ...}
51d9d20b   liuzujun   付费签到,应用市场反馈
49
50
51
52
53
      
      -- 活动商品购买记录
      actGoodsFlag = {"table", {}},       -- ActGoodsType  1购买,0未购买
  
      bpInfo = {"table", {}},         -- battle pass 探索指令  1={flag=0 为1表示买了,br=""付费领取记录, fr=""免费领取记录},2,3,4
4f7cffe5   liuzujun   多队挂机任务取消功能,累充奖励
54
55
      
      totalRR  = {"string", ""},        -- 累计充值奖励领取记录
cddfa602   zhangqijia   feat: 月卡解锁的日/周商店随...
56
57
58
  
      dailyShop = {"table", {}},
      weekShop = {"table", {}},
b92a81c9   liuzujun   CB2限时礼包
59
      dayLimitInfo = {"table", {}},       -- {[id]={count=0, trigger=0}}
c5825110   saicom   新增用户商城相关数据
60
61
62
  }
  
  function Store:updateProperty(params)
3e20f499   saicom   完善商城相关协议
63
64
65
  	params = params or {}
  	if not self.schema[params.field] then
  		return
c5825110   saicom   新增用户商城相关数据
66
  	end
3e20f499   saicom   完善商城相关协议
67
  	local oldValue = self:getProperty(params.field)
c5825110   saicom   新增用户商城相关数据
68
69
  	if params.value then
  		self:setProperty(params.field, params.value)
3e20f499   saicom   完善商城相关协议
70
71
72
73
74
75
  	elseif params.delta then
  		self:incrProperty(params.field, params.delta)
  	else
  		return
  	end
  	local newValue = self:getProperty(params.field)
2e283f60   liuzujun   月卡升级
76
      if not params.notNotify then
3e20f499   saicom   完善商城相关协议
77
  		self:notifyUpdateProperty(params.field, newValue, oldValue)
c5825110   saicom   新增用户商城相关数据
78
  	end
c5825110   saicom   新增用户商城相关数据
79
80
  end
  
fb3d084d   liuzujun   月卡赛季卡发送邮件奖励
81
  function Store:onCrossDay()
c40a6460   zhangqijia   feat: 月卡+特刊
82
      --self:sendMonthCardEmail()
fb3d084d   liuzujun   月卡赛季卡发送邮件奖励
83
      self:deleteExpireLimitGoods()
460afa6e   liuzujun   付费签到改为主动领取,战斗关卡不一...
84
      --self:checkPaySignReward()
b92a81c9   liuzujun   CB2限时礼包
85
      self:resetDayLimitPackTriggerCount()
cddfa602   zhangqijia   feat: 月卡解锁的日/周商店随...
86
87
88
89
90
91
92
93
94
95
96
  
      --刷新商店
      self:flushDailyShop()
  
      --重置月卡、特刊奖励领取记录
      self:updateProperty({field = "monthCardReceive", value = 0})
      self:updateProperty({field = "smonthCardReceive", value = 0})
  end
  
  function Store:refreshWeekData(notify)
      self:flushWeekShop()
c5825110   saicom   新增用户商城相关数据
97
98
  end
  
b454725a   zhangqijia   feat: 英雄精进触发礼包, 修...
99
100
101
102
103
104
105
  
  local function getSMonthCardPeriods(self, id)
      local smonthCards = self:getProperty("smonthCards") or {}
      local smonthCard = smonthCards[id] or {}
      return smonthCard["periods"] or 0
  end
  
81941afd   zhangqijia   fix: 特刊增加初回特典, 优化...
106
  local function getCardItemDailyReward(self, id)
b454725a   zhangqijia   feat: 英雄精进触发礼包, 修...
107
      local cur_ex = getSMonthCardPeriods(self, id)
c40a6460   zhangqijia   feat: 月卡+特刊
108
109
110
111
112
113
114
115
116
117
118
119
120
121
      if cur_ex == 0 then return nil, nil end
      cur_ex = cur_ex - 1
  
      local card = csvdb["shop_cardCsv"][id] or {}
      local reward, change = self.owner:award(card["itemDaily"], {log = {desc = "smonthCardReward", int1 = id, int2 = cur_ex}})
  
      local smonthCards = self:getProperty("smonthCards") or {}
      local smonthCard = smonthCards[id] or {}
      smonthCard["periods"] = cur_ex
      self:updateProperty({field = "smonthCards", value = smonthCards})
  
      return reward, change, cur_ex
  end
  
81941afd   zhangqijia   fix: 特刊增加初回特典, 优化...
122
  local function getCardItemFirstReward(self, id)
94f99134   zhangqijia   fix: shop_card字段修改
123
124
125
126
127
      local card = csvdb["shop_cardCsv"][id] or {}
      local reward, _ = self.owner:award(card["itemFirst"], {isRecharge = true, log = {desc = "recharge", int1 = id}})
      return reward
  end
  
fb3d084d   liuzujun   月卡赛季卡发送邮件奖励
128
129
130
131
132
  -- 删除过期商品
  function Store:deleteExpireLimitGoods()
      local timeNow = skynet.timex()
      local limitGoodsList = self:getProperty("limitTPack")
      for k, v in pairs(limitGoodsList) do
00bf6029   liuzujun   限时礼包,抽卡ssr广播
133
          if timeNow > v[1] then
fb3d084d   liuzujun   月卡赛季卡发送邮件奖励
134
135
              limitGoodsList[k] = nil
          end
c5825110   saicom   新增用户商城相关数据
136
      end
00bf6029   liuzujun   限时礼包,抽卡ssr广播
137
      self:updateProperty({field = "limitTPack", value = limitGoodsList, notNotify = true})
c5825110   saicom   新增用户商城相关数据
138
139
  end
  
b92a81c9   liuzujun   CB2限时礼包
140
141
142
143
144
145
146
147
148
  -- 每日充值循环限时礼包的触发次数
  function Store:resetDayLimitPackTriggerCount()
      local dayLimitInfo = self:getProperty("dayLimitInfo")
      for k, v in pairs(dayLimitInfo) do
          v['trigger'] = nil
      end
      self:updateProperty({field = "dayLimitInfo", value = dayLimitInfo, notNotify = true})
  end
  
c5825110   saicom   新增用户商城相关数据
149
150
  -- 发送月卡邮件
  function Store:sendMonthCardEmail()
3e20f499   saicom   完善商城相关协议
151
      local timeNow = skynet.timex()
2e283f60   liuzujun   月卡升级
152
153
154
  
      local tabs = {{ex="monthCardEx", t="getMailT1", id= self:getProperty("monthCardId")},
      {ex="smonthCardEx", t="getMailT2", id=self:getProperty("smonthCardId")}}
fb3d084d   liuzujun   月卡赛季卡发送邮件奖励
155
156
157
      for _, v in ipairs(tabs) do
          local ex  = self:getProperty(v.ex)
          local ts  = self:getProperty(v.t) or 0
2e283f60   liuzujun   月卡升级
158
159
160
161
          local cfg = csvdb["shop_cardCsv"][v.id] or {}
  
          local mailId = cfg.email
          local alertId = cfg.email_2
fb3d084d   liuzujun   月卡赛季卡发送邮件奖励
162
163
164
165
166
167
          local alertTs = dayLater(ex) - DAY_SEC
          if ex > timeNow then
              local cnt = 0
              if ts == 0 then
                  cnt = 1
              else
70aa8660   liuzujun   发送多天邮件bug
168
                  local diff = math.floor((dayLater(timeNow) - dayLater(ts))/DAY_SEC)
fb3d084d   liuzujun   月卡赛季卡发送邮件奖励
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
                  diff = diff < 0 and 0 or diff
                  diff = diff > 31 and 31 or diff
                  cnt = diff
              end
              for i = cnt - 1, 0, -1  do
                  local createTs = timeNow - i * DAY_SEC
                  self.owner:sendMail(mailId, createTs)
                  -- 过期头一天发提醒邮件
                  if dayLater(createTs) == alertTs then
                      self.owner:sendMail(alertId, createTs)
                  end
              end
              if cnt > 0 then
                  self:updateProperty({field=v.t, value=timeNow})
              end
          end
3e20f499   saicom   完善商城相关协议
185
      end
c5825110   saicom   新增用户商城相关数据
186
187
  end
  
317a46a9   liuzujun   添加特权卡
188
  function Store:isMonthCardExpire()
c40a6460   zhangqijia   feat: 月卡+特刊
189
      return self:getProperty("monthCardEx") == 0
317a46a9   liuzujun   添加特权卡
190
191
  end
  
c40a6460   zhangqijia   feat: 月卡+特刊
192
193
  function Store:isSuperMonthCardExpire(id)
      return false
317a46a9   liuzujun   添加特权卡
194
195
196
197
198
199
200
201
  end
  
  function Store:isPrivCardExpire()
      local timeNow = skynet.timex()
      local ts = self:getProperty("privCardEx")
      return ts < timeNow
  end
  
317a46a9   liuzujun   添加特权卡
202
203
204
205
206
207
  -- 挂机栏位 特权卡额外个数
  function Store:getHangSlotExtraCount()
      if self:isPrivCardExpire() then
          return 0
      end
  
d9d51454   liuzujun   修改特权卡引用配置错误bug
208
      return globalCsv.shop_priv_card_hang_slot_cnt or 4
317a46a9   liuzujun   添加特权卡
209
210
211
212
213
214
215
  end
  
  -- 探索加速/餐厅加速 特权卡系数
  function Store:getProduceItemSpeedCoef()
      if self:isPrivCardExpire() then
          return 1
      end
fb3d084d   liuzujun   月卡赛季卡发送邮件奖励
216
217
      local coef = (globalCsv.shop_priv_card_produce_coef or 25)/ 100
      return 1 + coef
317a46a9   liuzujun   添加特权卡
218
219
220
221
222
223
224
225
  end
  
  -- 拆解室栏位 特权卡额外个数
  function Store:getTimeBoxSlotExtraCount()
      if self:isPrivCardExpire() then
          return 0
      end
  
d9d51454   liuzujun   修改特权卡引用配置错误bug
226
      return globalCsv.shop_priv_time_box_slot_cnt or 3
317a46a9   liuzujun   添加特权卡
227
228
229
230
231
232
233
234
  end
  
  -- 齿轮兑换 特权卡系数
  function Store:getGearExchangeCoef()
      if self:isPrivCardExpire() then
          return 1
      end
  
7f9f002d   liuzujun   循环周活动
235
      local coef = (globalCsv.shop_priv_exchange_gear_coef or 50)/ 100
fb3d084d   liuzujun   月卡赛季卡发送邮件奖励
236
      return 1 + coef
317a46a9   liuzujun   添加特权卡
237
238
  end
  
00bf6029   liuzujun   限时礼包,抽卡ssr广播
239
240
241
242
243
244
245
246
247
248
249
250
251
  -- 奖励关卡 特权卡额外数量
  function Store:getBonusExtraFightCount()
      if self:isPrivCardExpire() then
          return 0
      end
  
      local cnt = globalCsv.bonus_extra_fight_count or 1
      return cnt
  end
  
  -- 挂机道具掉落系数 特权卡挂机掉落系数
  function Store:getHangDropCoef()
      if self:isPrivCardExpire() then
aae56896   liuzujun   特权卡bug
252
          return 1, 1
00bf6029   liuzujun   限时礼包,抽卡ssr广播
253
254
255
256
257
      end
  
      return (1 + globalCsv.hang_drop_exp_coef) or 1, (1 + globalCsv.hang_drop_item_coef) or 1
  end
  
2e283f60   liuzujun   月卡升级
258
259
260
261
262
263
264
265
266
267
268
269
  function Store:getCurMonthCardLvl(isSuper)
      local id = 0
      if isSuper then
         id = self:getProperty("smonthCardId") or 0
      else
         id = self:getProperty("monthCardId") or 0
      end
      local cfg = csvdb["shop_cardCsv"][id]
      if not cfg then return 0 end
  
      return cfg.level or 0
  end
00bf6029   liuzujun   限时礼包,抽卡ssr广播
270
  
c40a6460   zhangqijia   feat: 月卡+特刊
271
272
  --获取月卡每日奖励
  function Store:getMonthCardDailyReward(id)
fc8e212e   zhangqijia   fix: 月卡- 增刊异常
273
274
      if not id then return nil end
  
c40a6460   zhangqijia   feat: 月卡+特刊
275
276
277
278
279
280
      if self:isMonthCardExpire() or self:getProperty("monthCardReceive") == 1 then return nil, nil end
  
      local before_ex = self:getProperty("monthCardEx")
      self:updateProperty({field = "monthCardEx", delta = -1})
      local cur_ex = self:getProperty("monthCardEx")
  
94f99134   zhangqijia   fix: shop_card字段修改
281
      local actCfg = csvdb["shop_cardCsv"][id] or {}
c40a6460   zhangqijia   feat: 月卡+特刊
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
      local award = actCfg.itemDaily:toNumMap()
      local reward, change = self.owner:award(award, {log = {desc = "monthCardReward", int1 = id, int2 = cur_ex}})
  
      --今日月卡奖励已经领取
      self:updateProperty({field = "monthCardReceive", value = 1})
  
      self.owner:log("month_card", {
          item_type = CardType.NormalMonthCard,
          item_id = id, --月卡id
          before_ex = before_ex, --未领取奖励前的期
          cur_ex = cur_ex, --剩余期数
          reward_time = skynet.timex(),  --奖励时间
          month_reward_detail = reward,
      })
      return reward, change
  end
  
  --获取特刊每日奖励
  function Store:getSMonthCardDailyReward(id)
fc8e212e   zhangqijia   fix: 月卡- 增刊异常
301
302
      if not id then return nil end
  
b454725a   zhangqijia   feat: 英雄精进触发礼包, 修...
303
304
      local before_ex = getSMonthCardPeriods(self, id)
      local reward, change, cur_ex= getCardItemDailyReward(self, id)
c40a6460   zhangqijia   feat: 月卡+特刊
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
  
      --今日特刊奖励已经领取
      self:updateProperty({field = "smonthCardReceive", value = 1})
  
      self.owner:log("month_card", {
          item_type = CardType.SuperMonthCard,
          item_id = id, --月卡id
          before_ex = before_ex, --未领取奖励前的期
          cur_ex = cur_ex, --剩余期数
          reward_time = skynet.timex(),  --奖励时间
          month_reward_detail = reward,
      })
      return reward, change
  end
  
  function Store:firstBuyMonthCard(id)
81941afd   zhangqijia   fix: 特刊增加初回特典, 优化...
321
322
      if self:getProperty("firstMonthCard") == 0 then
          self:updateProperty({field = "firstMonthCard", value = 1})
c40a6460   zhangqijia   feat: 月卡+特刊
323
          local card = csvdb["shop_cardCsv"][id] or {}
81941afd   zhangqijia   fix: 特刊增加初回特典, 优化...
324
          return self.owner:award(card["itemOnce"], {log = {desc = "firstMonthCardReward", int1 = id}})
c40a6460   zhangqijia   feat: 月卡+特刊
325
326
327
328
      end
      return nil
  end
  
81941afd   zhangqijia   fix: 特刊增加初回特典, 优化...
329
330
331
332
333
334
335
336
337
338
339
  function Store:firstBuySMonthCard(id)
      local firstSMonthCard = self:getProperty("firstSMonthCard") or {}
      if not firstSMonthCard[id] or firstSMonthCard[id] == 0 then
          firstSMonthCard[id] = 1
          self:updateProperty({field = "firstSMonthCard", value = firstSMonthCard})
          local card = csvdb["shop_cardCsv"][id] or {}
          return self.owner:award(card["itemOnce"], {log = {desc = "firstSMonthCardReward", int1 = id}})
      end
      return nil
  end
  
81941afd   zhangqijia   fix: 特刊增加初回特典, 优化...
340
  function Store:isSMonthCardExpired(id)
b454725a   zhangqijia   feat: 英雄精进触发礼包, 修...
341
      return getSMonthCardPeriods(self, id) == 0
81941afd   zhangqijia   fix: 特刊增加初回特典, 优化...
342
343
344
  end
  
  function Store:buySMonthCardLimit(buylimit)
2c04a149   zhangqijia   fix: 特刊购买,在生成订单的时...
345
346
      if not buylimit or buylimit == "" then return true end
  
81941afd   zhangqijia   fix: 特刊增加初回特典, 优化...
347
      local smonthCards = self:getProperty("smonthCards") or {}
2c04a149   zhangqijia   fix: 特刊购买,在生成订单的时...
348
      for k, v in pairs(buylimit:toNumMap() or {}) do
81941afd   zhangqijia   fix: 特刊增加初回特典, 优化...
349
350
351
          if k == 1 then
              if v == 101 then
                  if self:isMonthCardExpire() then
81941afd   zhangqijia   fix: 特刊增加初回特典, 优化...
352
353
354
                      return false
                  end
              else
2c04a149   zhangqijia   fix: 特刊购买,在生成订单的时...
355
                  if not smonthCards[v] then
81941afd   zhangqijia   fix: 特刊增加初回特典, 优化...
356
357
358
359
                      return false
                  end
              end
          elseif k == 2 then
2c04a149   zhangqijia   fix: 特刊购买,在生成订单的时...
360
              if not smonthCards[v] then
81941afd   zhangqijia   fix: 特刊增加初回特典, 优化...
361
362
363
                  skynet.error("没有购买增刊条件里的特刊, %d", v)
                  return false
              end
2c04a149   zhangqijia   fix: 特刊购买,在生成订单的时...
364
              if not self:isSMonthCardExpired(v) then
81941afd   zhangqijia   fix: 特刊增加初回特典, 优化...
365
366
367
368
369
370
371
372
373
374
                  skynet.error("上期特刊奖励没领完") --策划yc+hbw 没领完上期特刊,新一期特刊不展示,不允许购买
                  return false
              end
          end
      end
      return true
  end
  
  function Store:buySMonthCard(id)
      local smonthCards = self:getProperty("smonthCards") or {}
2c04a149   zhangqijia   fix: 特刊购买,在生成订单的时...
375
376
377
378
379
380
381
      local card = csvdb["shop_cardCsv"][id]
      if not card then return false end
  
      if not self:buySMonthCardLimit(card["buyLimit"]) then
          skynet.error("不满足购买条件")
          return false
      end
81941afd   zhangqijia   fix: 特刊增加初回特典, 优化...
382
383
384
385
  
      local BuyMonthCard = {}
      BuyMonthCard["renewal"]= function()
          --续刊
81941afd   zhangqijia   fix: 特刊增加初回特典, 优化...
386
387
388
389
390
391
392
393
394
395
396
397
398
          local smonthCard = smonthCards[id] or {}
          if next(smonthCard) then
              smonthCard["buyCount"] = (smonthCard["buyCount"] or 0) + 1
              local periods = (smonthCard["periods"] or 0) + (card["amount"] or 30)
              smonthCard["periods"] = periods
  
              self:updateProperty({field = "smonthCards", value = smonthCards})
              return true
          end
      end
  
      BuyMonthCard["order"] = function()
          --增刊
81941afd   zhangqijia   fix: 特刊增加初回特典, 优化...
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
          smonthCards[id] = {["periods"] = (card["amount"] or 30), ["buyCount"] = 1}
          self:updateProperty({field= "smonthCards", value = smonthCards})
          return true
      end
  
      if self:isSMonthCardExpired(id) then
          local smonthCard = smonthCards[id] or {}
          if next(smonthCard) then
              return BuyMonthCard["renewal"]()
          else
              return BuyMonthCard["order"]()
          end
      else
          return BuyMonthCard["renewal"]()
      end
  end
  
c5825110   saicom   新增用户商城相关数据
416
  -- 购买通行证
c756d4df   liuzujun   新年将军令活动
417
  function Store:onBuyCard(type, duration, id, actid)
c5825110   saicom   新增用户商城相关数据
418
      local timeNow = skynet.timex()
3e20f499   saicom   完善商城相关协议
419
      if type == CardType.NormalMonthCard then
317a46a9   liuzujun   添加特权卡
420
          if self:isMonthCardExpire() then
2e283f60   liuzujun   月卡升级
421
              self:updateProperty({field = "monthCardId", value = id})
317a46a9   liuzujun   添加特权卡
422
          end
c40a6460   zhangqijia   feat: 月卡+特刊
423
424
          self:updateProperty({field = "monthCardEx", value = self:getProperty("monthCardEx") + 30})
  
eae157a4   zhangqijia   feat: 月卡 + 特刊的道具兑换
425
          local reward = {}
81941afd   zhangqijia   fix: 特刊增加初回特典, 优化...
426
          local tmpreward, _ = self:firstBuyMonthCard(id) --初回特典  仅首次购买月卡
eae157a4   zhangqijia   feat: 月卡 + 特刊的道具兑换
427
          if tmpreward then table.rewardMerge(reward, tmpreward) end
c40a6460   zhangqijia   feat: 月卡+特刊
428
  
81941afd   zhangqijia   fix: 特刊增加初回特典, 优化...
429
          tmpreward = getCardItemFirstReward(self, id) --订阅奖励
eae157a4   zhangqijia   feat: 月卡 + 特刊的道具兑换
430
431
          if next(tmpreward) then table.rewardMerge(reward, tmpreward) end
  
c40a6460   zhangqijia   feat: 月卡+特刊
432
433
          return reward
      elseif type == CardType.SuperMonthCard then
81941afd   zhangqijia   fix: 特刊增加初回特典, 优化...
434
435
436
437
438
439
          if self:buySMonthCard(id) then
              local reward = getCardItemFirstReward(self, id) or {}
              local tmpreward, _ = self:firstBuySMonthCard(id)
              if tmpreward then table.rewardMerge(reward, tmpreward) end
  
              return reward
c40a6460   zhangqijia   feat: 月卡+特刊
440
          end
81941afd   zhangqijia   fix: 特刊增加初回特典, 优化...
441
442
  
          skynet.error("特刊购买失败:"..id)
94f99134   zhangqijia   fix: shop_card字段修改
443
          return nil
2e283f60   liuzujun   月卡升级
444
445
446
447
448
      elseif type == CardType.NormalMonthCardLevelUp then
          if self:isMonthCardExpire() then
              skynet.error(string.format("month card expired, can not level up,%d,%d",self.owner:getProperty("id"), id))
          else
              local cfg = csvdb["shop_cardCsv"][id]
c40a6460   zhangqijia   feat: 月卡+特刊
449
              if not cfg then return end
30f12b27   liuzujun   战令活动过期清购买记录, 升级月卡...
450
451
              local dif = cfg.level - self:getCurMonthCardLvl(false)
              if dif > 1 and dif < 0 then
2e283f60   liuzujun   月卡升级
452
453
454
455
456
457
                  return
              end
              self:updateProperty({field = "monthCardId", value = id})
              self:updateProperty({field = "monthCardEx", value = self:getProperty("monthCardEx") + duration})
          end
          self:sendMonthCardEmail()
c40a6460   zhangqijia   feat: 月卡+特刊
458
  
2e283f60   liuzujun   月卡升级
459
460
461
462
463
      elseif type == CardType.SuperMonthCardLevelUp then
          if self:isSuperMonthCardExpire() then
              skynet.error(string.format("super month card expired, can not level up,%d,%d",self.owner:getProperty("id"), id))
          else
              local cfg = csvdb["shop_cardCsv"][id]
c40a6460   zhangqijia   feat: 月卡+特刊
464
              if not cfg then return end
30f12b27   liuzujun   战令活动过期清购买记录, 升级月卡...
465
466
              local dif = cfg.level - self:getCurMonthCardLvl(true)
              if dif > 1 and dif < 0 then
2e283f60   liuzujun   月卡升级
467
468
469
470
471
472
                  return
              end
              self:updateProperty({field = "smonthCardId", value = id})
              self:updateProperty({field = "smonthCardEx", value = self:getProperty("smonthCardEx") + duration})
          end
          self:sendMonthCardEmail()
3e20f499   saicom   完善商城相关协议
473
      elseif type == CardType.PrivilegeCard then
317a46a9   liuzujun   添加特权卡
474
475
476
477
478
          if self:isPrivCardExpire() then
              self:updateProperty({field = "privCardEx", value = timeNow + duration})
          else
              self:updateProperty({field = "privCardEx", value = self:getProperty("privCardEx") + duration})
          end
3e20f499   saicom   完善商城相关协议
479
480
481
      elseif type == CardType.GrowFund then
          self:updateProperty({field = "growFund", value = 1})
      elseif type == CardType.BattleCard then
fb3d084d   liuzujun   月卡赛季卡发送邮件奖励
482
          self:updateProperty({field = "battleCard", value = 1})
37bb4611   liuzujun   付费签到,抽卡阶段奖励,探索指令
483
484
485
486
      elseif type == CardType.PaySignCard then
          self:onBuyPaySignCard(duration)
      elseif type == CardType.BattlePassCard then
          local index = id - 400          -- 401:初级 402:中级 403:高级 404:终极
51d9d20b   liuzujun   付费签到,应用市场反馈
487
488
489
490
491
          local bpInfo = self:getProperty("bpInfo") or {}
          local info = bpInfo[index] or {}
          info["flag"] = 1
          bpInfo[index] = info
          self:updateProperty({field = "bpInfo", value = bpInfo})
c875de66   zhangqijia   fix: 探索指令道具兑换,修复1...
492
          return {}
c756d4df   liuzujun   新年将军令活动
493
      elseif type == CardType.ActBattleCommandCard then
98be031a   liuzujun   新年活动
494
          if not self.owner.activity:isOpenById(actid, "ActShopGoods") then
16790b38   zhangqijia   fix: 战令错误日志 加上 ro...
495
              skynet.error("not open, actid: " .. (actid or 0) .. "; id: " .. (id or 0) .. "; roleId: " .. self.owner:getProperty("id"))
b0a6cf59   zhangqijia   fix: 购买战令后,奖励没发放的bug
496
              return nil
c756d4df   liuzujun   新年将军令活动
497
498
          end
          local actCfg = csvdb["activity_ctrlCsv"][actid]
46b435af   zhangqijia   fix: 当活动未开启,找不到活动...
499
          if not actCfg then
16790b38   zhangqijia   fix: 战令错误日志 加上 ro...
500
              skynet.error("actCfg is nil, actid: " .. (actid or 0) .. "; id: " .. (id or 0) .. "; roleId: " .. self.owner:getProperty("id"))
46b435af   zhangqijia   fix: 当活动未开启,找不到活动...
501
502
              return nil
          end
c756d4df   liuzujun   新年将军令活动
503
          local actData = self.owner.activity:getActData("BattleCommand") or {}
c756d4df   liuzujun   新年将军令活动
504
505
506
          actData["unlock"] = 1
          if actCfg.condition ~= 0 then
              actData["lvl"] = (actData["lvl"] or 0) + actCfg.condition
3552b8db   chenyueqi   打印log方法要用role的
507
              self.owner:mylog("act_action", {desc="buyBcLvl", int1=actCfg.condition, int2=actData["lvl"]})
c756d4df   liuzujun   新年将军令活动
508
          end
70fb62d1   liuzujun   服务器数据打点
509
          self.owner:mylog("act_action", {desc="buyBc", int1=id, int2=actData["lvl"] or 0})
98be031a   liuzujun   新年活动
510
          self.owner.activity:updateActData("BattleCommand", actData)
b0a6cf59   zhangqijia   fix: 购买战令后,奖励没发放的bug
511
512
513
514
          local rechargeData = csvdb["shop_rechargeCsv"][id]
          if rechargeData then
              return self.owner:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}})
          end
c5825110   saicom   新增用户商城相关数据
515
      end
c40a6460   zhangqijia   feat: 月卡+特刊
516
      return nil, nil
c5825110   saicom   新增用户商城相关数据
517
518
  end
  
fb3d084d   liuzujun   月卡赛季卡发送邮件奖励
519
  --检测购买是否超过限制数量
3e20f499   saicom   完善商城相关协议
520
  function Store:checkRechargeRecord(limit, id)
3a3a3ddf   liuzujun   下单前检测商品限购次数
521
      local rechargeRecord = self:getProperty("payR") or {}
c5825110   saicom   新增用户商城相关数据
522
      if limit ~= 0 and limit <= (rechargeRecord[id] or 0) then
d705a315   zhouhaihai   充值 整理
523
          skynet.error(string.format("[recharge] recharge id:%d count over limit, user id:%d", id, self.owner:getProperty("id")))
c5825110   saicom   新增用户商城相关数据
524
525
          return false
      end
3e20f499   saicom   完善商城相关协议
526
527
      rechargeRecord[id] = (rechargeRecord[id] or 0) + 1
      self:updateProperty({field = "payR", value = rechargeRecord})
c5825110   saicom   新增用户商城相关数据
528
529
530
      return true
  end
  
3e20f499   saicom   完善商城相关协议
531
532
533
534
535
  function Store:notifyUpdateProperty(field, newValue, oldValue)
  	local datas = {
  		key = field,
  		newValue = newValue,
  		oldValue = oldValue,
2e283f60   liuzujun   月卡升级
536
      }
3e20f499   saicom   完善商城相关协议
537
538
539
  	SendPacket(actionCodes.Store_updateproperty, MsgPack.pack(datas))
  end
  
fb3d084d   liuzujun   月卡赛季卡发送邮件奖励
540
541
  -- 赛季卡重置 需要把未能领取的奖励通过邮件发送
  function Store:onBattleCardReset()
706b517e   liuzujun   翻倍掉落活动,商城免费宝箱
542
      local gift = {}
fb3d084d   liuzujun   月卡赛季卡发送邮件奖励
543
      local function concatGift(data)
706b517e   liuzujun   翻倍掉落活动,商城免费宝箱
544
545
          for key, v in pairs(data:toNumMap()) do
              gift[key] = (gift[key] or 0) + v
fb3d084d   liuzujun   月卡赛季卡发送邮件奖励
546
547
548
549
550
551
552
553
554
555
556
          end
      end
      local battleCardFlag = self:getProperty("battleCard")
      local battleCardFreeRecord = self:getProperty("battleFR")
      local battleCardLimitRecord = self:getProperty("battleLR")
      local battlePoint = self.owner:getProperty("battlePoint")
  
      for id, config in pairs(csvdb["reward_battlepassCsv"]) do
          if config then
              local freeFlag = string.char(string.getbit(battleCardFreeRecord, id))
              local limitFlag = string.char(string.getbit(battleCardLimitRecord, id))
9ea0c502   liuzujun   限时礼包
557
  
fb3d084d   liuzujun   月卡赛季卡发送邮件奖励
558
559
560
561
562
563
564
565
566
567
              if battlePoint < config.point then
                  break
              end
              if freeFlag == "0" then
                  concatGift(config.giftFree)
              end
              if limitFlag == "0" and battleCardFlag == 1 then
                  concatGift(config.giftLimit)
              end
          end
9ea0c502   liuzujun   限时礼包
568
      end
706b517e   liuzujun   翻倍掉落活动,商城免费宝箱
569
      self.owner:sendMail(MailId.BattleCardAward, nil, gift)
fb3d084d   liuzujun   月卡赛季卡发送邮件奖励
570
571
      -- 计算剩余奖励
      self:updateProperty({field = "battleCard", value=0})
fb3d084d   liuzujun   月卡赛季卡发送邮件奖励
572
573
574
575
576
577
      self:updateProperty({field = "battleFR", value=""})
      self:updateProperty({field = "battleLR", value=""})
      self.owner:updateProperty({field = "battlePoint", value=0})
  end
  
  -- 重置购买记录
1a0b3c56   liuzujun   抽卡保底,切换定向卡池
578
579
580
581
582
583
584
585
  function Store:resetStoreReored(resetId)
      local payRecord = self:getProperty("payR") or {}
      local buyRecord = self:getProperty("buyR") or {}
      for k, v in pairs(payRecord) do
          local config = csvdb["shop_rechargeCsv"][k]
          if config then
              if config.resetTime == resetId then
                  payRecord[k] = nil
fb3d084d   liuzujun   月卡赛季卡发送邮件奖励
586
587
588
589
590
591
                  --通行证商店
                  if config.shop == 2 then
                      if config.type == CardType.BattleCard then
                          self:onBattleCardReset()
                      end
                  end
1a0b3c56   liuzujun   抽卡保底,切换定向卡池
592
              end
8e892c71   liuzujun   挑战关卡活动打完再扣门票
593
594
          else
              payRecord[k] = nil
1a0b3c56   liuzujun   抽卡保底,切换定向卡池
595
596
597
598
599
600
601
602
603
          end
      end
      self:updateProperty({field = "payR", value = payRecord})
      for k, v in pairs(buyRecord) do
          local config = csvdb["shop_normalCsv"][k]
          if config then
              if config.resetTime == resetId then
                  buyRecord[k] = nil
              end
8e892c71   liuzujun   挑战关卡活动打完再扣门票
604
605
          else
              buyRecord[k] = nil
1a0b3c56   liuzujun   抽卡保底,切换定向卡池
606
607
608
609
610
          end
      end
      self:updateProperty({field = "buyR", value = buyRecord})
  end
  
9ea0c502   liuzujun   限时礼包
611
612
613
  --触发限时礼包
  function Store:OnTriggerLimitTimePack(eventType, param)
      local limitPack = self:getProperty("limitTPack")
00bf6029   liuzujun   限时礼包,抽卡ssr广播
614
      --local payRecord = self:getProperty("payR")
9ea0c502   liuzujun   限时礼包
615
      local timeNow = skynet.timex()
b92a81c9   liuzujun   CB2限时礼包
616
   
00bf6029   liuzujun   限时礼包,抽卡ssr广播
617
618
      local config = nil
      for id, cfg in pairs(csvdb["shop_packCsv"]) do
b92a81c9   liuzujun   CB2限时礼包
619
          if cfg.type == eventType and (cfg.condition == param or cfg.isLoop ~= 0) then
00bf6029   liuzujun   限时礼包,抽卡ssr广播
620
              config = cfg
b92a81c9   liuzujun   CB2限时礼包
621
              break
9ea0c502   liuzujun   限时礼包
622
623
          end
      end
9f21cb8e   zhangqijia   fix: 修改触发礼包逻辑
624
625
626
      if not config then return end
  
      -- 每日循环弹窗
b454725a   zhangqijia   feat: 英雄精进触发礼包, 修...
627
      local typeMap = {[TriggerEventType.DrawHero] = 1, [TriggerEventType.FoodSell] = 1, [TriggerEventType.RuneUp] = 1, [TriggerEventType.CostDiamond] = 1, [TriggerEventType.HeroTalent] = 1}
9f21cb8e   zhangqijia   fix: 修改触发礼包逻辑
628
629
630
631
632
633
634
635
636
637
638
      if typeMap[eventType] then
          local dayInfo = self:getProperty("dayLimitInfo")
          local info = dayInfo[eventType] or {}
          local count = (info["count"] or 0) + param
          local triggerCount = info["trigger"] or 0
          local flag = nil
          if count >= config.condition then
              if triggerCount < config.triggerLimit then
                  info["trigger"] = triggerCount + 1
                  info["count"] = 0
                  flag = true
b92a81c9   liuzujun   CB2限时礼包
639
              else
9f21cb8e   zhangqijia   fix: 修改触发礼包逻辑
640
                  info["count"] = config.condition - 1
b92a81c9   liuzujun   CB2限时礼包
641
              end
9f21cb8e   zhangqijia   fix: 修改触发礼包逻辑
642
643
          else
              info["count"] = count
b92a81c9   liuzujun   CB2限时礼包
644
          end
9f21cb8e   zhangqijia   fix: 修改触发礼包逻辑
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
          dayInfo[eventType] = info
          self:updateProperty({field = "dayLimitInfo", value = dayInfo})
          if not flag then
              return
          end
      end
      local rechargeCfg = csvdb["shop_rechargeCsv"][config.packId]
      if rechargeCfg then
          limitPack[rechargeCfg.id] = {timeNow + rechargeCfg.time, config.id}
          self.owner:log("push_gift", {
              gift_id = rechargeCfg.id, --礼包ID
              gift_name = rechargeCfg.descId,   --礼包名称
          })
          if config.isLoop ~= 0 then
              local payR = self:getProperty("payR")
              if payR[rechargeCfg.id] then
                  payR[rechargeCfg.id] = nil
                  self:updateProperty({field = "payR", value = payR})
bf096b07   liuzujun   每日抽卡限时礼包触发时,清空购买记录
663
              end
9ea0c502   liuzujun   限时礼包
664
          end
9f21cb8e   zhangqijia   fix: 修改触发礼包逻辑
665
666
667
668
669
670
671
672
673
          -- 每日抽卡限时礼包 触发重置
          --if eventType == TriggerEventType.DrawHeroCnt then
          --    local payR = self:getProperty("buyR")
          --    if payR[rechargeCfg.id] then
          --        payR[rechargeCfg.id] = nil
          --        self:updateProperty({field = "buyR", value = payR})
          --    end
          --end
          self:updateProperty({field = "limitTPack", value = limitPack})
9ea0c502   liuzujun   限时礼包
674
      end
00bf6029   liuzujun   限时礼包,抽卡ssr广播
675
676
677
      --if next(result) then
      --    self:updateProperty({field = "packTrigger", value = triggerRecord})
      --end
9ea0c502   liuzujun   限时礼包
678
679
  end
  
51d9d20b   liuzujun   付费签到,应用市场反馈
680
681
682
683
  function GetActGoodsIndex(goodsType)
      return ActGoodsType[goodsType] or 0
  end
  
460afa6e   liuzujun   付费签到改为主动领取,战斗关卡不一...
684
  function Store:SetActGoodsFlag(goodsType, flag)
51d9d20b   liuzujun   付费签到,应用市场反馈
685
      local actGoodsFlag = self:getProperty("actGoodsFlag") or {}
460afa6e   liuzujun   付费签到改为主动领取,战斗关卡不一...
686
      local goodsIndex = GetActGoodsIndex(goodsType)
51d9d20b   liuzujun   付费签到,应用市场反馈
687
688
689
690
      if goodsIndex == 0 then
          print("get act goods index fail :paySignIn")
          return
      end
460afa6e   liuzujun   付费签到改为主动领取,战斗关卡不一...
691
      actGoodsFlag[goodsIndex] = flag
53b4b8bd   liuzujun   自动挂机下一关
692
      self:updateProperty({field = "actGoodsFlag", value = actGoodsFlag})
460afa6e   liuzujun   付费签到改为主动领取,战斗关卡不一...
693
  end
51d9d20b   liuzujun   付费签到,应用市场反馈
694
  
460afa6e   liuzujun   付费签到改为主动领取,战斗关卡不一...
695
696
697
  -- 购买付费签到 按开服时间算奖励
  function Store:onBuyPaySignCard(dur)
      local curTs = skynet.timex()
d4d00016   liuzujun   付费签到开始时间改为开服时间
698
  	curTs = getServerOpenTs()
51d9d20b   liuzujun   付费签到,应用市场反馈
699
  
460afa6e   liuzujun   付费签到改为主动领取,战斗关卡不一...
700
      self:SetActGoodsFlag("paySignIn", curTs)
ede282c0   liuzujun   付费签到规则改为按登录天数计算进度...
701
702
703
      local actData = self.owner.activity:getActData("PaySignIn")
      actData[0] = 1
      self.owner.activity:updateActData("PaySignIn", actData)
460afa6e   liuzujun   付费签到改为主动领取,战斗关卡不一...
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
  
      --local actGoodsFlag = self:getProperty("actGoodsFlag") or {}
      --local goodsIndex = GetActGoodsIndex("paySignIn")
      --if goodsIndex == 0 then
      --    print("get act goods index fail :paySignIn")
      --    return
      --end
      --actGoodsFlag[goodsIndex] = 1
      --self:updateProperty({field = "actGoodsFlag", value = actGoodsFlag})
      -- 发钱
      --local change
      --local reward, curData = self.owner.activity:getPaySignReward()
  	--if next(reward) then
      --    self.owner.activity:updateActData("PaySignIn", curData)
      --    reward, change = self.owner:award(reward, {log = {desc = "actPaySign"}})
  	--end
  
  	--self.owner:log("activity", {
  	--	activity_id = 0, -- 活动ID(或活动指定任务的ID)
  	--	activity_type = self.owner.activity.ActivityType.PaySignIn, -- 活动类型,见活动类型枚举表
  	--	activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...}
  	--})
  
  	--SendPacket(actionCodes.Activity_actPaySignRewardNtf, MsgPack.pack(self.owner:packReward(reward, change)))
51d9d20b   liuzujun   付费签到,应用市场反馈
728
729
730
731
732
733
734
735
736
737
  end
  
  function Store:checkPaySignReward()
      local reward, curData  = self.owner.activity:getPaySignReward()
      if next(reward) then
          self.owner.activity:updateActData("PaySignIn", curData)
          self.owner:sendMail(MailId.PaySignAward, nil, reward)
  	end
  end
  
f7a55da3   liuzujun   新增cb2临时限时礼包
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
  -- 临时用 登录触发限时礼包 时间点以后
  function Store:OnTriggerLimitTimePackAfterTs(eventType, param)
      local limitPack = self:getProperty("limitTPack")
      local timeNow = skynet.timex()
      local config = nil
      for id, cfg in pairs(csvdb["shop_packCsv"]) do
          local ts = toUnixtime(""..cfg.condition)
          if cfg.type == eventType and ts < param then
              config = cfg
  
              if config ~= nil then
                  local rechargeCfg = csvdb["shop_rechargeCsv"][config.packId]
                  if rechargeCfg then
                      if not limitPack[rechargeCfg.id] then
                          limitPack[rechargeCfg.id] = {timeNow + rechargeCfg.time, config.id}
                          self.owner:log("push_gift", {
                              gift_id = rechargeCfg.id, --礼包ID
                              gift_name = rechargeCfg.title,   --礼包名称
                          })
                          self:updateProperty({field = "limitTPack", value = limitPack, notNotify = false})
                      end
                  end
              end
          end
      end
  end
  
cddfa602   zhangqijia   feat: 月卡解锁的日/周商店随...
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
  local function checkShopFinish(shop, shopPool)
      local tmpShop = shopPool[shop.id] or {}
      if next(tmpShop) then
          if tmpShop.expire_ts then
              if skynet.timex() > tmpShop.expire_ts then
                  shopPool[shop.id] = nil
                  return true
              else
                  return false
              end
          else
              tmpShop.expire_ts = skynet.timex() + tmpShop.cool_time * DAY_SEC
              return false
          end
      else
          return true
      end
  end
  
  --随机日/周商店随机两个商品
  -- 1. 让缓存里的商品进入冷却时间
  -- 2. 删除缓存里的已经冷却好的商品
  -- 3. 随机两件商品放入缓存中
  function Store:flushDailyShop()
      local dailyShop = self:getProperty("dailyShop") or {}
      local tmpDailyShop = {}
  
      for id, data in pairs(csvdb["shop_normalCsv"]) do
          if data.shop == 1 and data.shopType == 3 then
              if data.resetTime == 1 and checkShopFinish(data, dailyShop) then
                  tmpDailyShop[id] = {["id"] = data.id, ["weight"] = 100, ["cool_time"] = data.cool_time}
              end
          end
      end
  
      --随机两件商品放入缓存 跨天刷新
      if next(tmpDailyShop) then
          local id = math.randWeight(tmpDailyShop)
          if id then
              dailyShop[id] = tmpDailyShop[id]
              tmpDailyShop[id] = nil
          end
  
          id = math.randWeight(tmpDailyShop)
          if id then
              dailyShop[id] = tmpDailyShop[id]
              tmpDailyShop[id] = nil
          end
      end
  
      self:updateProperty({field="dailyShop", value= dailyShop})
  end
  
  function Store:flushWeekShop()
      local weekShop = self:getProperty("weekShop") or {}
      local tmpWeekShop = {}
  
      for id, data in pairs(csvdb["shop_normalCsv"]) do
          if data.shop == 1 and data.shopType == 3 then
              if data.resetTime == 2 and checkShopFinish(data, weekShop)then
                  tmpWeekShop[id] = {["id"] = data.id, ["weight"] = 100, ["cool_time"] = data.cool_time}
              end
          end
      end
  
      --随机两件商品放入缓存 跨周刷新
      if next(tmpWeekShop) then
          local id = math.randWeight(tmpWeekShop)
          if id then
7eda801e   zhangqijia   fix: 修复周商店刷新商品内容为...
834
              weekShop[id] = tmpWeekShop[id]
cddfa602   zhangqijia   feat: 月卡解锁的日/周商店随...
835
836
837
838
839
              tmpWeekShop[id] = nil
          end
  
          id = math.randWeight(tmpWeekShop)
          if id then
7eda801e   zhangqijia   fix: 修复周商店刷新商品内容为...
840
              weekShop[id] = tmpWeekShop[id]
cddfa602   zhangqijia   feat: 月卡解锁的日/周商店随...
841
842
843
844
845
846
              tmpWeekShop[id] = nil
          end
      end
      self:updateProperty({field="weekShop", value= weekShop})
  end
  
c5825110   saicom   新增用户商城相关数据
847
  function Store:data()
f7a55da3   liuzujun   新增cb2临时限时礼包
848
      self:OnTriggerLimitTimePackAfterTs(TriggerEventType.AfterTs, skynet.timex())
c5825110   saicom   新增用户商城相关数据
849
  	return {
3e20f499   saicom   完善商城相关协议
850
851
852
853
854
          buyR		= self:getProperty("buyR"),
          payR	= self:getProperty("payR"),
          growFund		= self:getProperty("growFund"),
          growFundR  = self:getProperty("growFundR"),
          monthCardEx  = self:getProperty("monthCardEx"),
fb3d084d   liuzujun   月卡赛季卡发送邮件奖励
855
856
857
          battleCard  = self:getProperty("battleCard"),
          battleFR  = self:getProperty("battleFR"),
          battleLR  = self:getProperty("battleLR"),
3e20f499   saicom   完善商城相关协议
858
          limitTPack = self:getProperty("limitTPack"),
317a46a9   liuzujun   添加特权卡
859
          privCardEx = self:getProperty("privCardEx"),
00bf6029   liuzujun   限时礼包,抽卡ssr广播
860
          --packTrigger = self:getProperty("packTrigger"),
51d9d20b   liuzujun   付费签到,应用市场反馈
861
862
          actGoodsFlag = self:getProperty("actGoodsFlag"),
          bpInfo = self:getProperty("bpInfo"),
4f7cffe5   liuzujun   多队挂机任务取消功能,累充奖励
863
          totalRR = self:getProperty("totalRR"),
2e283f60   liuzujun   月卡升级
864
          monthCardId  = self:getProperty("monthCardId"),
41b05e8f   zhangqijia   fix: 月卡+特刊领取奖励后,还...
865
          firstMonthCard = self:getProperty("firstMonthCard"),
ef74f2f2   zhangqijia   fix: 特刊第一次购买的记录 ...
866
          firstSMonthCard = self:getProperty("firstSMonthCard"),
41b05e8f   zhangqijia   fix: 月卡+特刊领取奖励后,还...
867
          monthCardReceive = self:getProperty("monthCardReceive"),
cddfa602   zhangqijia   feat: 月卡解锁的日/周商店随...
868
869
870
871
          smonthCards  = self:getProperty("smonthCards"),
          smonthCardReceive  = self:getProperty("smonthCardReceive"),
          dailyShop  = self:getProperty("dailyShop"),
          weekShop  = self:getProperty("weekShop"),
c5825110   saicom   新增用户商城相关数据
872
873
874
875
  	}
  end
  
  return Store