| c5825110  saicom
 
新增用户商城相关数据 | 1
2 |   -- 商店数据
  
 | 
| fa992c94  测试
 
添加daily,diner,act... | 3 |   local Store = class("Store", require("shared.ModelBaseMysql"))
 | 
| c5825110  saicom
 
新增用户商城相关数据 | 4
5 |   
  function Store:ctor(properties)
 | 
| 54f63c13  测试
 
修复老月卡用户的月卡id字段 | 6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 |       Store.super.ctor(self, properties)
  end
  
  function Store:onLoad()
      local monEx = self:getProperty("monthCardEx")
      local smonEx = self:getProperty("smonthCardEx")
      local monId = self:getProperty("monthCardId")
      local smonId = self:getProperty("smonthCardId")
      local timeNow = skynet.timex()
      local flag = false
      if monEx > timeNow and monId == 0 then
          self:updateProperty({field = "monthCardId", value = 101})
          self:updateProperty({field = "getMailT1", value = 0})
          flag = true
      end
      if smonEx > timeNow and smonId == 0 then
          self:updateProperty({field = "smonthCardId", value = 102})
          self:updateProperty({field = "getMailT2", value = 0})
          flag = true
      end
      if flag then
          self:sendMonthCardEmail()
      end
 | 
| c5825110  saicom
 
新增用户商城相关数据 | 29
30 |   end
  
 | 
| 51d9d20b  测试
 
付费签到,应用市场反馈 | 31
32
33
34 |   ActGoodsType = {
      paySignIn = 1,  -- 付费签到
  }
  
 | 
| c5825110  saicom
 
新增用户商城相关数据 | 35 |   Store.schema = {
 | 
| fa992c94  测试
 
添加daily,diner,act... | 36 |   	id 		= {"number", 0, "pri"},		-- 角色id
 | 
| 3e20f499  测试
 
完善商城相关协议 | 37
38
39 |   	buyR		= {"table", {}},		-- 购买商品记录 {id=count}
  	payR	= {"table", {}},		-- 充值记录 {id=count}
  	growFund		= {"number", 0},		-- 成长基金
 | 
| 51d9d20b  测试
 
付费签到,应用市场反馈 | 40
41 |       growFundR  = {"string", ""},        -- 成长基金领取记录
  
 | 
| 3e20f499  测试
 
完善商城相关协议 | 42 |   	monthCardEx	= {"number", 0},		-- 月卡过期时间戳
 | 
| 2e283f60  测试
 
月卡升级 | 43 |   	monthCardId	= {"number", 0},		-- 月卡id
 | 
| 51d9d20b  测试
 
付费签到,应用市场反馈 | 44 |       smonthCardEx	= {"number", 0},		-- 超级月卡过期时间戳
 | 
| 2e283f60  测试
 
月卡升级 | 45 |       smonthCardId	= {"number", 0},		-- 超级月卡id
 | 
| 51d9d20b  测试
 
付费签到,应用市场反馈 | 46 |   
 | 
| fb3d084d  测试
 
月卡赛季卡发送邮件奖励 | 47 |   	battleCard	= {"number", 0},		-- 赛季卡
 | 
| 3e20f499  测试
 
完善商城相关协议 | 48
49 |   	battleFR = {"string", ""},		-- 免费赛季卡领取记录
      battleLR = {"string", ""},		-- 付费赛季卡领取记录
 | 
| 51d9d20b  测试
 
付费签到,应用市场反馈 | 50 |   
 | 
| 00bf6029  测试
 
限时礼包,抽卡ssr广播 | 51 |       limitTPack = {"table", {}},      -- 限时礼包 {id={expire_ts, trigger_type}}
 | 
| fb3d084d  测试
 
月卡赛季卡发送邮件奖励 | 52
53
54 |       privCardEx = {"number", 0},          -- 特权卡过期时间戳
      getMailT1 = {"number",0},       -- 上次发送月卡福利邮件的时间
      getMailT2 = {"number",0},       -- 上次发送超级月卡福利邮件的时间
 | 
| 00bf6029  测试
 
限时礼包,抽卡ssr广播 | 55 |       --packTrigger = {"table", {}},     -- 礼包触发记录 {关卡难度1={id, 通关关卡数,升级数,爬塔层数}, ...}
 | 
| 51d9d20b  测试
 
付费签到,应用市场反馈 | 56
57
58
59
60 |       
      -- 活动商品购买记录
      actGoodsFlag = {"table", {}},       -- ActGoodsType  1购买,0未购买
  
      bpInfo = {"table", {}},         -- battle pass 探索指令  1={flag=0 为1表示买了,br=""付费领取记录, fr=""免费领取记录},2,3,4
 | 
| 4f7cffe5  测试
 
多队挂机任务取消功能,累充奖励 | 61
62 |       
      totalRR  = {"string", ""},        -- 累计充值奖励领取记录
 | 
| c5825110  saicom
 
新增用户商城相关数据 | 63
64
65 |   }
  
  function Store:updateProperty(params)
 | 
| 3e20f499  测试
 
完善商城相关协议 | 66
67
68 |   	params = params or {}
  	if not self.schema[params.field] then
  		return
 | 
| c5825110  saicom
 
新增用户商城相关数据 | 69 |   	end
 | 
| 3e20f499  测试
 
完善商城相关协议 | 70 |   	local oldValue = self:getProperty(params.field)
 | 
| c5825110  saicom
 
新增用户商城相关数据 | 71
72 |   	if params.value then
  		self:setProperty(params.field, params.value)
 | 
| 3e20f499  测试
 
完善商城相关协议 | 73
74
75
76
77
78 |   	elseif params.delta then
  		self:incrProperty(params.field, params.delta)
  	else
  		return
  	end
  	local newValue = self:getProperty(params.field)
 | 
| 2e283f60  测试
 
月卡升级 | 79 |       if not params.notNotify then
 | 
| 3e20f499  测试
 
完善商城相关协议 | 80 |   		self:notifyUpdateProperty(params.field, newValue, oldValue)
 | 
| c5825110  saicom
 
新增用户商城相关数据 | 81 |   	end
 | 
| c5825110  saicom
 
新增用户商城相关数据 | 82
83 |   end
  
 | 
| fb3d084d  测试
 
月卡赛季卡发送邮件奖励 | 84
85
86 |   function Store:onCrossDay()
      self:sendMonthCardEmail()
      self:deleteExpireLimitGoods()
 | 
| 460afa6e  测试
 
付费签到改为主动领取,战斗关卡不一... | 87 |       --self:checkPaySignReward()
 | 
| c5825110  saicom
 
新增用户商城相关数据 | 88
89 |   end
  
 | 
| fb3d084d  测试
 
月卡赛季卡发送邮件奖励 | 90
91
92
93
94 |   -- 删除过期商品
  function Store:deleteExpireLimitGoods()
      local timeNow = skynet.timex()
      local limitGoodsList = self:getProperty("limitTPack")
      for k, v in pairs(limitGoodsList) do
 | 
| 00bf6029  测试
 
限时礼包,抽卡ssr广播 | 95 |           if timeNow > v[1] then
 | 
| fb3d084d  测试
 
月卡赛季卡发送邮件奖励 | 96
97 |               limitGoodsList[k] = nil
          end
 | 
| c5825110  saicom
 
新增用户商城相关数据 | 98 |       end
 | 
| 00bf6029  测试
 
限时礼包,抽卡ssr广播 | 99 |       self:updateProperty({field = "limitTPack", value = limitGoodsList, notNotify = true})
 | 
| c5825110  saicom
 
新增用户商城相关数据 | 100
101
102
103 |   end
  
  -- 发送月卡邮件
  function Store:sendMonthCardEmail()
 | 
| 3e20f499  测试
 
完善商城相关协议 | 104 |       local timeNow = skynet.timex()
 | 
| 2e283f60  测试
 
月卡升级 | 105
106
107 |   
      local tabs = {{ex="monthCardEx", t="getMailT1", id= self:getProperty("monthCardId")},
      {ex="smonthCardEx", t="getMailT2", id=self:getProperty("smonthCardId")}}
 | 
| fb3d084d  测试
 
月卡赛季卡发送邮件奖励 | 108
109
110 |       for _, v in ipairs(tabs) do
          local ex  = self:getProperty(v.ex)
          local ts  = self:getProperty(v.t) or 0
 | 
| 2e283f60  测试
 
月卡升级 | 111
112
113
114 |           local cfg = csvdb["shop_cardCsv"][v.id] or {}
  
          local mailId = cfg.email
          local alertId = cfg.email_2
 | 
| fb3d084d  测试
 
月卡赛季卡发送邮件奖励 | 115
116
117
118
119
120 |           local alertTs = dayLater(ex) - DAY_SEC
          if ex > timeNow then
              local cnt = 0
              if ts == 0 then
                  cnt = 1
              else
 | 
| 70aa8660  测试
 
发送多天邮件bug | 121 |                   local diff = math.floor((dayLater(timeNow) - dayLater(ts))/DAY_SEC)
 | 
| fb3d084d  测试
 
月卡赛季卡发送邮件奖励 | 122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137 |                   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  测试
 
完善商城相关协议 | 138 |       end
 | 
| c5825110  saicom
 
新增用户商城相关数据 | 139
140 |   end
  
 | 
| 317a46a9  测试
 
添加特权卡 | 141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158 |   function Store:isMonthCardExpire()
      local timeNow = skynet.timex()
      local ts = self:getProperty("monthCardEx")
      return ts < timeNow
  end
  
  function Store:isSuperMonthCardExpire()
      local timeNow = skynet.timex()
      local ts = self:getProperty("smonthCardEx")
      return ts < timeNow
  end
  
  function Store:isPrivCardExpire()
      local timeNow = skynet.timex()
      local ts = self:getProperty("privCardEx")
      return ts < timeNow
  end
  
 | 
| 317a46a9  测试
 
添加特权卡 | 159
160
161
162
163
164 |   -- 挂机栏位 特权卡额外个数
  function Store:getHangSlotExtraCount()
      if self:isPrivCardExpire() then
          return 0
      end
  
 | 
| d9d51454  测试
 
修改特权卡引用配置错误bug | 165 |       return globalCsv.shop_priv_card_hang_slot_cnt or 4
 | 
| 317a46a9  测试
 
添加特权卡 | 166
167
168
169
170
171
172 |   end
  
  -- 探索加速/餐厅加速 特权卡系数
  function Store:getProduceItemSpeedCoef()
      if self:isPrivCardExpire() then
          return 1
      end
 | 
| fb3d084d  测试
 
月卡赛季卡发送邮件奖励 | 173
174 |       local coef = (globalCsv.shop_priv_card_produce_coef or 25)/ 100
      return 1 + coef
 | 
| 317a46a9  测试
 
添加特权卡 | 175
176
177
178
179
180
181
182 |   end
  
  -- 拆解室栏位 特权卡额外个数
  function Store:getTimeBoxSlotExtraCount()
      if self:isPrivCardExpire() then
          return 0
      end
  
 | 
| d9d51454  测试
 
修改特权卡引用配置错误bug | 183 |       return globalCsv.shop_priv_time_box_slot_cnt or 3
 | 
| 317a46a9  测试
 
添加特权卡 | 184
185
186
187
188
189
190
191 |   end
  
  -- 齿轮兑换 特权卡系数
  function Store:getGearExchangeCoef()
      if self:isPrivCardExpire() then
          return 1
      end
  
 | 
| 7f9f002d  测试
 
循环周活动 | 192 |       local coef = (globalCsv.shop_priv_exchange_gear_coef or 50)/ 100
 | 
| fb3d084d  测试
 
月卡赛季卡发送邮件奖励 | 193 |       return 1 + coef
 | 
| 317a46a9  测试
 
添加特权卡 | 194
195 |   end
  
 | 
| 00bf6029  测试
 
限时礼包,抽卡ssr广播 | 196
197
198
199
200
201
202
203
204
205
206
207
208 |   -- 奖励关卡 特权卡额外数量
  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  测试
 
特权卡bug | 209 |           return 1, 1
 | 
| 00bf6029  测试
 
限时礼包,抽卡ssr广播 | 210
211
212
213
214 |       end
  
      return (1 + globalCsv.hang_drop_exp_coef) or 1, (1 + globalCsv.hang_drop_item_coef) or 1
  end
  
 | 
| 2e283f60  测试
 
月卡升级 | 215
216
217
218
219
220
221
222
223
224
225
226 |   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  测试
 
限时礼包,抽卡ssr广播 | 227 |   
 | 
| c5825110  saicom
 
新增用户商城相关数据 | 228 |   -- 购买通行证
 | 
| c756d4df  测试
 
新年将军令活动 | 229 |   function Store:onBuyCard(type, duration, id, actid)
 | 
| c5825110  saicom
 
新增用户商城相关数据 | 230 |       local timeNow = skynet.timex()
 | 
| 3e20f499  测试
 
完善商城相关协议 | 231 |       if type == CardType.NormalMonthCard then
 | 
| 317a46a9  测试
 
添加特权卡 | 232 |           if self:isMonthCardExpire() then
 | 
| 2e283f60  测试
 
月卡升级 | 233 |               self:updateProperty({field = "monthCardId", value = id})
 | 
| 317a46a9  测试
 
添加特权卡 | 234
235
236
237 |               self:updateProperty({field = "monthCardEx", value = timeNow + duration})
          else
              self:updateProperty({field = "monthCardEx", value = self:getProperty("monthCardEx") + duration})
          end
 | 
| fb3d084d  测试
 
月卡赛季卡发送邮件奖励 | 238 |           self:sendMonthCardEmail()
 | 
| 2e283f60  测试
 
月卡升级 | 239
240
241
242
243
244 |       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]
              if not cfg then return end 
 | 
| 30f12b27  测试
 
战令活动过期清购买记录, 升级月卡... | 245
246 |               local dif = cfg.level - self:getCurMonthCardLvl(false)
              if dif > 1 and dif < 0 then
 | 
| 2e283f60  测试
 
月卡升级 | 247
248
249
250
251
252 |                   return
              end
              self:updateProperty({field = "monthCardId", value = id})
              self:updateProperty({field = "monthCardEx", value = self:getProperty("monthCardEx") + duration})
          end
          self:sendMonthCardEmail()
 | 
| 3e20f499  测试
 
完善商城相关协议 | 253 |       elseif type == CardType.SuperMonthCard then
 | 
| 317a46a9  测试
 
添加特权卡 | 254 |           if self:isSuperMonthCardExpire() then
 | 
| 2e283f60  测试
 
月卡升级 | 255 |               self:updateProperty({field = "smonthCardId", value = id})
 | 
| 317a46a9  测试
 
添加特权卡 | 256
257
258
259 |               self:updateProperty({field = "smonthCardEx", value = timeNow + duration})
          else
              self:updateProperty({field = "smonthCardEx", value = self:getProperty("smonthCardEx") + duration})
          end
 | 
| fb3d084d  测试
 
月卡赛季卡发送邮件奖励 | 260 |           self:sendMonthCardEmail()
 | 
| 2e283f60  测试
 
月卡升级 | 261
262
263
264
265
266 |       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]
              if not cfg then return end 
 | 
| 30f12b27  测试
 
战令活动过期清购买记录, 升级月卡... | 267
268 |               local dif = cfg.level - self:getCurMonthCardLvl(true)
              if dif > 1 and dif < 0 then
 | 
| 2e283f60  测试
 
月卡升级 | 269
270
271
272
273
274 |                   return
              end
              self:updateProperty({field = "smonthCardId", value = id})
              self:updateProperty({field = "smonthCardEx", value = self:getProperty("smonthCardEx") + duration})
          end
          self:sendMonthCardEmail()
 | 
| 3e20f499  测试
 
完善商城相关协议 | 275 |       elseif type == CardType.PrivilegeCard then
 | 
| 317a46a9  测试
 
添加特权卡 | 276
277
278
279
280 |           if self:isPrivCardExpire() then
              self:updateProperty({field = "privCardEx", value = timeNow + duration})
          else
              self:updateProperty({field = "privCardEx", value = self:getProperty("privCardEx") + duration})
          end
 | 
| 3e20f499  测试
 
完善商城相关协议 | 281
282
283 |       elseif type == CardType.GrowFund then
          self:updateProperty({field = "growFund", value = 1})
      elseif type == CardType.BattleCard then
 | 
| fb3d084d  测试
 
月卡赛季卡发送邮件奖励 | 284 |           self:updateProperty({field = "battleCard", value = 1})
 | 
| 37bb4611  测试
 
付费签到,抽卡阶段奖励,探索指令 | 285
286
287
288 |       elseif type == CardType.PaySignCard then
          self:onBuyPaySignCard(duration)
      elseif type == CardType.BattlePassCard then
          local index = id - 400          -- 401:初级 402:中级 403:高级 404:终极
 | 
| 51d9d20b  测试
 
付费签到,应用市场反馈 | 289
290
291
292
293 |           local bpInfo = self:getProperty("bpInfo") or {}
          local info = bpInfo[index] or {}
          info["flag"] = 1
          bpInfo[index] = info
          self:updateProperty({field = "bpInfo", value = bpInfo})
 | 
| c756d4df  测试
 
新年将军令活动 | 294 |       elseif type == CardType.ActBattleCommandCard then
 | 
| 98be031a  测试
 
新年活动 | 295 |           if not self.owner.activity:isOpenById(actid, "ActShopGoods") then
 | 
| c756d4df  测试
 
新年将军令活动 | 296
297
298
299
300 |               return
          end
          local actCfg = csvdb["activity_ctrlCsv"][actid]
          if not actCfg then return end
          local actData = self.owner.activity:getActData("BattleCommand") or {}
 | 
| c756d4df  测试
 
新年将军令活动 | 301
302
303
304 |           actData["unlock"] = 1
          if actCfg.condition ~= 0 then
              actData["lvl"] = (actData["lvl"] or 0) + actCfg.condition
          end
 | 
| 98be031a  测试
 
新年活动 | 305 |           self.owner.activity:updateActData("BattleCommand", actData)
 | 
| c5825110  saicom
 
新增用户商城相关数据 | 306
307
308 |       end
  end
  
 | 
| fb3d084d  测试
 
月卡赛季卡发送邮件奖励 | 309 |   --检测购买是否超过限制数量
 | 
| 3e20f499  测试
 
完善商城相关协议 | 310 |   function Store:checkRechargeRecord(limit, id)
 | 
| 3a3a3ddf  测试
 
下单前检测商品限购次数 | 311 |       local rechargeRecord = self:getProperty("payR") or {}
 | 
| c5825110  saicom
 
新增用户商城相关数据 | 312 |       if limit ~= 0 and limit <= (rechargeRecord[id] or 0) then
 | 
| d705a315  zhouhaihai
 
充值 整理 | 313 |           skynet.error(string.format("[recharge] recharge id:%d count over limit, user id:%d", id, self.owner:getProperty("id")))
 | 
| c5825110  saicom
 
新增用户商城相关数据 | 314
315 |           return false
      end
 | 
| 3e20f499  测试
 
完善商城相关协议 | 316
317 |       rechargeRecord[id] = (rechargeRecord[id] or 0) + 1
      self:updateProperty({field = "payR", value = rechargeRecord})
 | 
| c5825110  saicom
 
新增用户商城相关数据 | 318
319
320 |       return true
  end
  
 | 
| 3e20f499  测试
 
完善商城相关协议 | 321
322
323
324
325 |   function Store:notifyUpdateProperty(field, newValue, oldValue)
  	local datas = {
  		key = field,
  		newValue = newValue,
  		oldValue = oldValue,
 | 
| 2e283f60  测试
 
月卡升级 | 326 |       }
 | 
| 3e20f499  测试
 
完善商城相关协议 | 327
328
329 |   	SendPacket(actionCodes.Store_updateproperty, MsgPack.pack(datas))
  end
  
 | 
| fb3d084d  测试
 
月卡赛季卡发送邮件奖励 | 330
331 |   -- 赛季卡重置 需要把未能领取的奖励通过邮件发送
  function Store:onBattleCardReset()
 | 
| 706b517e  测试
 
翻倍掉落活动,商城免费宝箱 | 332 |       local gift = {}
 | 
| fb3d084d  测试
 
月卡赛季卡发送邮件奖励 | 333 |       local function concatGift(data)
 | 
| 706b517e  测试
 
翻倍掉落活动,商城免费宝箱 | 334
335 |           for key, v in pairs(data:toNumMap()) do
              gift[key] = (gift[key] or 0) + v
 | 
| fb3d084d  测试
 
月卡赛季卡发送邮件奖励 | 336
337
338
339
340
341
342
343
344
345
346 |           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  测试
 
限时礼包 | 347 |   
 | 
| fb3d084d  测试
 
月卡赛季卡发送邮件奖励 | 348
349
350
351
352
353
354
355
356
357 |               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  测试
 
限时礼包 | 358 |       end
 | 
| 706b517e  测试
 
翻倍掉落活动,商城免费宝箱 | 359 |       self.owner:sendMail(MailId.BattleCardAward, nil, gift)
 | 
| fb3d084d  测试
 
月卡赛季卡发送邮件奖励 | 360
361 |       -- 计算剩余奖励
      self:updateProperty({field = "battleCard", value=0})
 | 
| fb3d084d  测试
 
月卡赛季卡发送邮件奖励 | 362
363
364
365
366
367 |       self:updateProperty({field = "battleFR", value=""})
      self:updateProperty({field = "battleLR", value=""})
      self.owner:updateProperty({field = "battlePoint", value=0})
  end
  
  -- 重置购买记录
 | 
| 1a0b3c56  测试
 
抽卡保底,切换定向卡池 | 368
369
370
371
372
373
374
375 |   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  测试
 
月卡赛季卡发送邮件奖励 | 376
377
378
379
380
381 |                   --通行证商店
                  if config.shop == 2 then
                      if config.type == CardType.BattleCard then
                          self:onBattleCardReset()
                      end
                  end
 | 
| 1a0b3c56  测试
 
抽卡保底,切换定向卡池 | 382 |               end
 | 
| 8e892c71  测试
 
挑战关卡活动打完再扣门票 | 383
384 |           else
              payRecord[k] = nil
 | 
| 1a0b3c56  测试
 
抽卡保底,切换定向卡池 | 385
386
387
388
389
390
391
392
393 |           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  测试
 
挑战关卡活动打完再扣门票 | 394
395 |           else
              buyRecord[k] = nil
 | 
| 1a0b3c56  测试
 
抽卡保底,切换定向卡池 | 396
397
398
399
400 |           end
      end
      self:updateProperty({field = "buyR", value = buyRecord})
  end
  
 | 
| 9ea0c502  测试
 
限时礼包 | 401
402
403 |   --触发限时礼包
  function Store:OnTriggerLimitTimePack(eventType, param)
      local limitPack = self:getProperty("limitTPack")
 | 
| 00bf6029  测试
 
限时礼包,抽卡ssr广播 | 404 |       --local payRecord = self:getProperty("payR")
 | 
| 9ea0c502  测试
 
限时礼包 | 405 |       local timeNow = skynet.timex()
 | 
| 00bf6029  测试
 
限时礼包,抽卡ssr广播 | 406 |       --local find = false
 | 
| 9ea0c502  测试
 
限时礼包 | 407 |       -- 有未过期的限时礼包不再推送
 | 
| 00bf6029  测试
 
限时礼包,抽卡ssr广播 | 408
409
410
411
412
413
414
415
416
417
418
419
420 |       --for k, v in pairs(limitPack) do
      --    if v > timeNow and not payRecord[k] then
      --        find = true
      --        break
      --    end
      --end
      --if find == true then
      --    return
      --end
      --local hangPass = self.owner:getProperty("hangPass")
      --local triggerRecord = self:getProperty("packTrigger")
      --local result = {}
      --local maxDiff = 0
 | 
| 9ea0c502  测试
 
限时礼包 | 421 |       -- 取满足限时礼包关卡要求的对应数据
 | 
| 00bf6029  测试
 
限时礼包,抽卡ssr广播 | 422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437 |       --for diff, maxCarbonId in pairs(hangPass) do
      --    for id, cfg in pairs(csvdb["shop_packCsv"]) do
      --        local range = cfg.showRange:toArray(true, "=")
      --        local beginRange = range[1] or 0
      --        local endRange = range[2] or 0
      --        if maxCarbonId > beginRange and maxCarbonId <= endRange and cfg.type == eventType then
      --            result[diff] = cfg
      --            maxDiff = math.max(maxDiff, diff)
      --            break
      --        end
      --    end
      --end
      local config = nil
      for id, cfg in pairs(csvdb["shop_packCsv"]) do
          if cfg.type == eventType and cfg.condition == param then
              config = cfg
 | 
| 9ea0c502  测试
 
限时礼包 | 438
439 |           end
      end
 | 
| 00bf6029  测试
 
限时礼包,抽卡ssr广播 | 440
441 |       if config ~= nil then
          local rechargeCfg = csvdb["shop_rechargeCsv"][config.packId]
 | 
| 9ea0c502  测试
 
限时礼包 | 442 |           if rechargeCfg then
 | 
| 00bf6029  测试
 
限时礼包,抽卡ssr广播 | 443 |               limitPack[rechargeCfg.id] = {timeNow + rechargeCfg.time, config.id}
 | 
| 97807511  zhouhaihai
 
增加日志 | 444
445
446
447 |               self.owner:log("push_gift", {
                  gift_id = rechargeCfg.id, --礼包ID
                  gift_name = rechargeCfg.title,   --礼包名称
              })
 | 
| bf096b07  测试
 
每日抽卡限时礼包触发时,清空购买记录 | 448
449
450
451
452
453
454
455 |               -- 每日抽卡限时礼包 触发重置
              if eventType == TriggerEventType.DrawHeroCnt then
                  local payR = self:getProperty("payR")
                  if payR[rechargeCfg.id] then
                      payR[rechargeCfg.id] = nil
                      self:updateProperty({field = "payR", value = payR})
                  end
              end
 | 
| 5226a156  测试
 
每日抽卡礼包bug | 456 |               self:updateProperty({field = "limitTPack", value = limitPack})
 | 
| 9ea0c502  测试
 
限时礼包 | 457
458 |           end
      end
 | 
| 00bf6029  测试
 
限时礼包,抽卡ssr广播 | 459
460
461 |       --if next(result) then
      --    self:updateProperty({field = "packTrigger", value = triggerRecord})
      --end
 | 
| 9ea0c502  测试
 
限时礼包 | 462
463 |   end
  
 | 
| 51d9d20b  测试
 
付费签到,应用市场反馈 | 464
465
466
467 |   function GetActGoodsIndex(goodsType)
      return ActGoodsType[goodsType] or 0
  end
  
 | 
| 460afa6e  测试
 
付费签到改为主动领取,战斗关卡不一... | 468 |   function Store:SetActGoodsFlag(goodsType, flag)
 | 
| 51d9d20b  测试
 
付费签到,应用市场反馈 | 469 |       local actGoodsFlag = self:getProperty("actGoodsFlag") or {}
 | 
| 460afa6e  测试
 
付费签到改为主动领取,战斗关卡不一... | 470 |       local goodsIndex = GetActGoodsIndex(goodsType)
 | 
| 51d9d20b  测试
 
付费签到,应用市场反馈 | 471
472
473
474 |       if goodsIndex == 0 then
          print("get act goods index fail :paySignIn")
          return
      end
 | 
| 460afa6e  测试
 
付费签到改为主动领取,战斗关卡不一... | 475 |       actGoodsFlag[goodsIndex] = flag
 | 
| 53b4b8bd  测试
 
自动挂机下一关 | 476 |       self:updateProperty({field = "actGoodsFlag", value = actGoodsFlag})
 | 
| 460afa6e  测试
 
付费签到改为主动领取,战斗关卡不一... | 477 |   end
 | 
| 51d9d20b  测试
 
付费签到,应用市场反馈 | 478 |   
 | 
| 460afa6e  测试
 
付费签到改为主动领取,战斗关卡不一... | 479
480
481 |   -- 购买付费签到 按开服时间算奖励
  function Store:onBuyPaySignCard(dur)
      local curTs = skynet.timex()
 | 
| d4d00016  测试
 
付费签到开始时间改为开服时间 | 482 |   	curTs = getServerOpenTs()
 | 
| 51d9d20b  测试
 
付费签到,应用市场反馈 | 483 |   
 | 
| 460afa6e  测试
 
付费签到改为主动领取,战斗关卡不一... | 484 |       self:SetActGoodsFlag("paySignIn", curTs)
 | 
| ede282c0  测试
 
付费签到规则改为按登录天数计算进度... | 485
486
487 |       local actData = self.owner.activity:getActData("PaySignIn")
      actData[0] = 1
      self.owner.activity:updateActData("PaySignIn", actData)
 | 
| 460afa6e  测试
 
付费签到改为主动领取,战斗关卡不一... | 488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511 |   
      --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  测试
 
付费签到,应用市场反馈 | 512
513
514
515
516
517
518
519
520
521 |   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  测试
 
新增cb2临时限时礼包 | 522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548 |   -- 临时用 登录触发限时礼包 时间点以后
  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
  
 | 
| c5825110  saicom
 
新增用户商城相关数据 | 549 |   function Store:data()
 | 
| f7a55da3  测试
 
新增cb2临时限时礼包 | 550 |       self:OnTriggerLimitTimePackAfterTs(TriggerEventType.AfterTs, skynet.timex())
 | 
| c5825110  saicom
 
新增用户商城相关数据 | 551 |   	return {
 | 
| 3e20f499  测试
 
完善商城相关协议 | 552
553
554
555
556
557 |           buyR		= self:getProperty("buyR"),
          payR	= self:getProperty("payR"),
          growFund		= self:getProperty("growFund"),
          growFundR  = self:getProperty("growFundR"),
          monthCardEx  = self:getProperty("monthCardEx"),
          smonthCardEx  = self:getProperty("smonthCardEx"),
 | 
| fb3d084d  测试
 
月卡赛季卡发送邮件奖励 | 558
559
560 |           battleCard  = self:getProperty("battleCard"),
          battleFR  = self:getProperty("battleFR"),
          battleLR  = self:getProperty("battleLR"),
 | 
| 3e20f499  测试
 
完善商城相关协议 | 561 |           limitTPack = self:getProperty("limitTPack"),
 | 
| 317a46a9  测试
 
添加特权卡 | 562 |           privCardEx = self:getProperty("privCardEx"),
 | 
| 00bf6029  测试
 
限时礼包,抽卡ssr广播 | 563 |           --packTrigger = self:getProperty("packTrigger"),
 | 
| 51d9d20b  测试
 
付费签到,应用市场反馈 | 564
565 |           actGoodsFlag = self:getProperty("actGoodsFlag"),
          bpInfo = self:getProperty("bpInfo"),
 | 
| 4f7cffe5  测试
 
多队挂机任务取消功能,累充奖励 | 566 |           totalRR = self:getProperty("totalRR"),
 | 
| 2e283f60  测试
 
月卡升级 | 567
568 |           monthCardId  = self:getProperty("monthCardId"),
          smonthCardId  = self:getProperty("smonthCardId"),
 | 
| c5825110  saicom
 
新增用户商城相关数据 | 569
570
571
572 |   	}
  end
  
  return Store
 |