源战役客户端
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

820 Zeilen
27 KiB

  1. --[[@------------------------------------------------------------------
  2. @description:
  3. @author:huangcong
  4. ----------------------------------------------------------------------]]
  5. RechargeActivityModel = RechargeActivityModel or BaseClass(BaseVo, true)
  6. RechargeActivityModel.REQUEST_CCMD_EVENT = "RechargeActivityModel.REQUEST_CCMD_EVENT"
  7. RechargeActivityModel.OPEN_FIRST_RECHARGE_VIEW = "RechargeActivityModel.OPEN_FIRST_RECHARGE_VIEW" --打开首充界面
  8. RechargeActivityModel.OPEN_DAILY_RECHARGE_VIEW = "RechargeActivityModel.OPEN_DAILY_RECHARGE_VIEW" --打开每日充值界面
  9. RechargeActivityModel.UPDATE_FIRST_RECHARGE_VIEW = "RechargeActivityModel.UPDATE_FIRST_RECHARGE_VIEW" --更新首充界面
  10. RechargeActivityModel.UPDATE_TODAY_RECHARGE_INFO = "RechargeActivityModel.UPDATE_TODAY_RECHARGE_INFO" --更新当天累计充值信息
  11. RechargeActivityModel.UPDATE_RECHARGE_REWARD_LIST = "RechargeActivityModel.UPDATE_RECHARGE_REWARD_LIST" --更新多天累计充值奖励
  12. RechargeActivityModel.OPEN_FIRST_RECHARGE_TIP_VIEW = "RechargeActivityModel.OPEN_FIRST_RECHARGE_TIP_VIEW" --打开首冲引导广告
  13. RechargeActivityModel.SHOW_FIRST_RECHARGE_TIP_VIEW = "RechargeActivityModel.SHOW_FIRST_RECHARGE_TIP_VIEW" --首冲引导提示
  14. RechargeActivityModel.UPDATE_PELLET_INFO = "RechargeActivityModel.UPDATE_PELLET_INFO" --更新当天累充弹珠信息
  15. RechargeActivityModel.OPEN_DAILY_PELLET_RECORD = "RechargeActivityModel.OPEN_DAILY_PELLET_RECORD" --打开弹珠记录
  16. RechargeActivityModel.UPDATE_PELLET_VALIDATION = "RechargeActivityModel.UPDATE_PELLET_VALIDATION" -- 更新弹珠机的抽奖验证
  17. RechargeActivityModel.PELLET_VALIDATION_SUCCEED = "RechargeActivityModel.PELLET_VALIDATION_SUCCEED" -- 弹珠机的抽奖验证成功推送
  18. RechargeActivityModel.ANS_PELLET_RECORD_INFO = 'RechargeActivityModel.ANS_PELLET_RECORD_INFO' -- 弹珠抽奖日志查询
  19. RechargeActivityModel.OPEN_JIPSAW_VIEW = 'RechargeActivityModel.OPEN_JIPSAW_VIEW' -- 打开拼图界面
  20. RechargeActivityModel.OPEN_GUAGUALE_VIEW = 'RechargeActivityModel.OPEN_GUAGUALE_VIEW' -- D打开刮刮乐界面
  21. RechargeActivityModel.OPEN_RECHARGE_ADD_VIEW = 'RechargeActivityModel.OPEN_RECHARGE_ADD_VIEW' -- 打开首充附加界面
  22. RechargeActivityModel.FIRST_RECHARGE_PRODUCKT_ID = 9999
  23. function RechargeActivityModel:__init()
  24. RechargeActivityModel.Instance = self
  25. self.first_recharge_info = nil --首充信息
  26. self.today_recharge_info = nil --当天累计充值信息
  27. self.recharge_reward_list = nil --多天累计充值奖励
  28. self.show_tip_time = 0--tip界面倒计时
  29. self.has_show_icon_effect = false
  30. self.login_tw_red_dot = true
  31. self.pellet_basic_info = nil--累充弹珠数据
  32. self.recharge_add_info = nil
  33. self.cur_live_ness = nil--当前记录的活跃值
  34. self.first_recharge_is_login_open = false--首充界面是否登陆第一次打开
  35. self.need_show_daily_recharge_effect = false--是否需要展示每日首充特效
  36. self:InitCfg()
  37. end
  38. function RechargeActivityModel:getInstance()
  39. if RechargeActivityModel.Instance == nil then
  40. RechargeActivityModel.New()
  41. end
  42. return RechargeActivityModel.Instance
  43. end
  44. function RechargeActivityModel:InitCfg( )
  45. self.recharge_award_list = {}--充值商品奖励数据 除了首充的
  46. local recharge_award_list = DeepCopy(Config.Rechargefirst)
  47. for k,v in pairs(recharge_award_list) do
  48. if v.product_id ~= RechargeActivityModel.FIRST_RECHARGE_PRODUCKT_ID then--排除首充
  49. local data = v
  50. data.reward = stringtotable(v.reward)--奖励展示
  51. data.title = Trim(v.title)
  52. data.content = Trim(v.content)
  53. if not self.recharge_award_list[v.product_id] then
  54. self.recharge_award_list[v.product_id] = {}
  55. end
  56. self.recharge_award_list[v.product_id][v.index] = data
  57. end
  58. end
  59. end
  60. --获得充值商品奖励数据
  61. function RechargeActivityModel:GetRechargeAwardCfg( product_id )
  62. return self.recharge_award_list[product_id]
  63. end
  64. --设置首充图标状态
  65. function RechargeActivityModel:SetFirstRechargeIconUpdate( scmd )
  66. local is_get_over = false--是否已经领完
  67. if scmd and scmd.product_list then
  68. for i,v in ipairs(scmd.product_list) do
  69. if v.state ~= 2 then
  70. is_get_over = false
  71. break
  72. else
  73. is_get_over = v.state == 2
  74. end
  75. end
  76. end
  77. local open_day = ServerTimeModel:getInstance():GetOpenServerDay()
  78. local level = RoleManager.Instance.mainRoleInfo.level
  79. -- local icon_cfg = ActivityIconManager:getInstance():getIconCfg(15901)
  80. -- if icon_cfg then
  81. -- icon_cfg.sub_location = open_day <= 3 and level >= 90 and 3 or 2
  82. -- end
  83. -- 状态:是否已经领完奖励
  84. self:SetFirstRechargeInfo(scmd)
  85. if not is_get_over then
  86. ActivityIconManager:getInstance():addIcon(15901, -1)
  87. else
  88. ActivityIconManager:getInstance():deleteIcon(15901)
  89. end
  90. -- --已购买首充才显示每日累充
  91. -- if scmd.open ~= 0 then --奖励状态(0时间未到 1可领取 2已领完)
  92. local sub_type = CustomActivityModel:getInstance():getActMinSubType(CustomActivityModel.CustomActBaseType.DAILY_RECHARGE)
  93. if sub_type then
  94. self:Fire(RechargeActivityModel.REQUEST_CCMD_EVENT, 15955, sub_type)
  95. end
  96. -- else
  97. -- if scmd.open == 0 then
  98. -- -- ActivityIconManager:getInstance():deleteIcon(23,true)
  99. -- end
  100. -- end
  101. end
  102. --设置首充数据
  103. function RechargeActivityModel:SetFirstRechargeInfo(vo)
  104. local product_list = {}
  105. if vo and vo.product_list then
  106. for i,v in ipairs(vo.product_list) do
  107. product_list[v.index] = v
  108. end
  109. end
  110. vo.product_list = product_list
  111. self.first_recharge_info = vo
  112. self:UpdateFirstRechargeRedDot()
  113. local open_day = ServerTimeModel:getInstance():GetOpenServerDay()
  114. local is_recharge = false--是否已经充值过
  115. for i,v in pairs(self.first_recharge_info.product_list) do
  116. if v.state ~= 0 then
  117. is_recharge = true
  118. break
  119. end
  120. end
  121. -- 状态:是否首充过
  122. if not is_recharge and open_day <= 3 and GetModuleIsOpen(159) and not self.is_log_open and not self.is_not_aotu_open_recharge_view then--没有充值过要加--登陆给玩家弹一次首充
  123. self.need_open_first_recharge = true
  124. end
  125. ActivityIconManager:getInstance():UpdateActivityIconCurCustomShowDesc()--首充数据返回检查一次
  126. end
  127. --判断是否首充过
  128. function RechargeActivityModel:IsRecharge( )
  129. local is_recharge = nil--是否已经充值过
  130. if self.first_recharge_info then
  131. for i,v in pairs(self.first_recharge_info.product_list) do
  132. if v.state ~= 0 then
  133. is_recharge = true
  134. break
  135. end
  136. end
  137. is_recharge = is_recharge or false
  138. end
  139. if is_recharge == nil then--判断数据是否存在
  140. return true
  141. else
  142. return is_recharge
  143. end
  144. end
  145. --刷新首充红点
  146. function RechargeActivityModel:UpdateFirstRechargeRedDot( )
  147. local red_bool = false
  148. if self.first_recharge_info and self.first_recharge_info.product_list then
  149. for i,v in pairs(self.first_recharge_info.product_list) do
  150. if v.state == 1 then
  151. red_bool = true
  152. break
  153. end
  154. end
  155. end
  156. GlobalEventSystem:Fire(ActivityIconManager.UPDATE_ICON_TIPS, 15901, red_bool)--刷新红点
  157. end
  158. function RechargeActivityModel:GetFirstRechargeInfo()
  159. return self.first_recharge_info
  160. end
  161. --是否首充
  162. function RechargeActivityModel:IsFirstRechager( )
  163. if self.first_recharge_info and self.first_recharge_info.open then
  164. return self.first_recharge_info.open ~= 0
  165. end
  166. end
  167. --奖励尚未领完都显示图标
  168. function RechargeActivityModel:ShowRechargeIcon( )
  169. if self.first_recharge_info and self.first_recharge_info.open then
  170. return self.first_recharge_info.open ~= 3
  171. end
  172. end
  173. --是否未首充
  174. function RechargeActivityModel:IsNoFirstRecharge( )
  175. if self.first_recharge_info and self.first_recharge_info.open then
  176. return self.first_recharge_info.open == 0
  177. end
  178. end
  179. --设置每日奖励数据
  180. function RechargeActivityModel:SetTodayRechargeInfo(vo)
  181. self.today_recharge_info = vo
  182. self:CheckMainIconRedDot()
  183. self:Fire(RechargeActivityModel.UPDATE_TODAY_RECHARGE_INFO)
  184. end
  185. --返回每日奖励数据
  186. function RechargeActivityModel:GetTodayRechargeInfo( id )
  187. if id then
  188. if self.today_recharge_info and self.today_recharge_info.reward_infos then
  189. for k,v in pairs(self.today_recharge_info.reward_infos) do
  190. if v.id == id then
  191. return v
  192. end
  193. end
  194. end
  195. else
  196. return self.today_recharge_info
  197. end
  198. end
  199. --设置充值奖励数据
  200. function RechargeActivityModel:SetRechargeRewardList(vo)
  201. self.recharge_reward_list = vo.reward_list
  202. self:CheckMainIconRedDot()
  203. self:Fire(RechargeActivityModel.UPDATE_RECHARGE_REWARD_LIST)
  204. end
  205. --请求每日充值数据
  206. function RechargeActivityModel:RequestDailyRechargeData()
  207. --不需要再才遍历整个活动列表
  208. local list = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.DAILY_RECHARGE)
  209. if list then
  210. self:Fire(RechargeActivityModel.REQUEST_CCMD_EVENT, 15955, list.sub_type)
  211. self:Fire(RechargeActivityModel.REQUEST_CCMD_EVENT, 15956, list.sub_type)
  212. end
  213. end
  214. function RechargeActivityModel:CheckMainIconCanGroup( )--每日首充奖励 领取完就收纳进去
  215. local show = true
  216. if self.today_recharge_info then
  217. for _, v in ipairs(self.today_recharge_info.reward_infos) do
  218. if v.state ~= 2 then
  219. show = false
  220. break
  221. end
  222. end
  223. end
  224. local openDay = ServerTimeModel:getInstance():GetOpenServerDay()
  225. if show and openDay >= 5 and not ActivityIconManager:getInstance().icon_group_list[23] then
  226. end
  227. return show
  228. end
  229. function RechargeActivityModel:CheckMainIconRedDot()
  230. local show = false
  231. if self.today_recharge_info then
  232. for _, v in ipairs(self.today_recharge_info.reward_infos) do
  233. if v.state == 1 then
  234. show = true
  235. break
  236. end
  237. end
  238. end
  239. if show == false and self.recharge_reward_list then
  240. for _, v in ipairs(self.recharge_reward_list) do
  241. if v.state == 1 then
  242. show = true
  243. break
  244. end
  245. end
  246. end
  247. GlobalEventSystem:Fire(ActivityIconManager.UPDATE_ICON_TIPS, 23, show)
  248. end
  249. function RechargeActivityModel:CheckMainIconNeedEffect()
  250. local show = false
  251. if self.today_recharge_info then
  252. for _, v in ipairs(self.today_recharge_info.reward_infos) do
  253. if v.state == 0 then
  254. show = true
  255. break
  256. end
  257. end
  258. end
  259. if show == false and self.recharge_reward_list then
  260. for _, v in ipairs(self.recharge_reward_list) do
  261. if v.state == 0 then
  262. show = true
  263. break
  264. end
  265. end
  266. end
  267. if show and not self.has_show_icon_effect then
  268. local function callback( )
  269. GlobalEventSystem:Fire(EventName.CHANGE_ACTIVETY_ICON_EFFECT,23)
  270. end
  271. setTimeout(callback,1.5)
  272. self.has_show_icon_effect = true
  273. end
  274. end
  275. function RechargeActivityModel:UpdateDailyRechargeView(base_type, sub_type)
  276. if base_type == CustomActivityModel.CustomActBaseType.DAILY_RECHARGE then
  277. self:Fire(RechargeActivityModel.REQUEST_CCMD_EVENT, 15955, sub_type)
  278. self:Fire(RechargeActivityModel.REQUEST_CCMD_EVENT, 15956, sub_type)
  279. end
  280. end
  281. function RechargeActivityModel:UpdateDailyConsumeView(sub_type)
  282. self:Fire(RechargeActivityModel.REQUEST_CCMD_EVENT, 15958, sub_type)
  283. end
  284. function RechargeActivityModel:CheckConsumeMainIconOpen(sub_type)--检测今日消费图标是否需要开启
  285. if not sub_type then
  286. print("huangcong:InvestModel [162]不存在的每日消费类型: ",sub_type)
  287. return
  288. end
  289. local base_type = CustomActivityModel.CustomActBaseType.DAILY_CONSUME
  290. local level = RoleManager.Instance.mainRoleInfo.level
  291. local have_time
  292. local act_list = CustomActivityModel:getInstance():getActList(base_type, sub_type)
  293. if act_list and act_list.etime then
  294. have_time = act_list.etime - TimeUtil:getServerTime()
  295. local level_limit = 1
  296. local key = string.format("%s@%s",331,67)
  297. if Config.Moduleopenlv[key] then
  298. level_limit = Config.Moduleopenlv[key].lv
  299. end
  300. -- print("huangcong:RechargeActivityModel [181]: ",have_time,level_limit,base_type, sub_type)
  301. -- PrintTable(act_list)
  302. if level_limit then
  303. if have_time > 0 and tonumber(level_limit) <= level then
  304. ActivityIconManager:getInstance():addIcon(3316700+sub_type, have_time)
  305. else
  306. ActivityIconManager:getInstance():deleteIcon(3316700+sub_type,true)
  307. end
  308. else
  309. ActivityIconManager:getInstance():deleteIcon(3316700+sub_type,true)
  310. -- print("huangcong:InvestModel [431]: ",key)
  311. end
  312. else
  313. ActivityIconManager:getInstance():deleteIcon(3316700+sub_type,true)
  314. end
  315. self:CheckConsumeMainIconRedDot(sub_type)
  316. end
  317. --设置每日消费信息
  318. function RechargeActivityModel:SetDailyConsumeInfo( vo )
  319. if vo and vo.subtype then
  320. -- print("huangcong:RechargeActivityModel [201]vo: ",vo)
  321. -- PrintTable(vo)
  322. if vo.product_list and TableSize(vo.product_list) > 0 then
  323. self.consume_info[vo.subtype] = vo
  324. self.consume_info[vo.subtype].today_consume_info = {}
  325. self.consume_info[vo.subtype].consume_reward_list = {}
  326. self.consume_info[vo.subtype].daily_gold = 0
  327. for k,v in pairs(vo.product_list) do
  328. if v.award_type == 1 then
  329. if v.value > self.consume_info[vo.subtype].daily_gold then
  330. self.consume_info[vo.subtype].daily_gold = v.value
  331. end
  332. table.insert(self.consume_info[vo.subtype].today_consume_info, v)
  333. elseif v.award_type == 2 then
  334. table.insert(self.consume_info[vo.subtype].consume_reward_list, v)
  335. end
  336. end
  337. self:CheckConsumeMainIconOpen(vo.subtype)
  338. self:Fire(RechargeActivityModel.UPDATE_CONSUME_INFO,vo.subtype)
  339. end
  340. end
  341. end
  342. -- 弹珠奖池配置
  343. function RechargeActivityModel:GetPelletRewardCfg(show, need_sort, round, is_all, grade)
  344. if show then
  345. local result = {}
  346. for k,v in pairs(Config.Pelletreward) do
  347. if (v.is_show == 1) or is_all then
  348. if round then
  349. if v.round_min <= round and round <= v.round_max then
  350. if not grade or v.grade == grade then
  351. table.insert(result, stringtotable(v.award)[1])
  352. end
  353. end
  354. else
  355. if not grade or v.grade == grade then
  356. table.insert(result, stringtotable(v.award)[1])
  357. end
  358. end
  359. end
  360. end
  361. if need_sort then
  362. local basic = false
  363. for k,v in pairs(result) do
  364. basic = GoodsModel:getInstance():GetGoodsBasicByTypeId( tonumber(v[2]) )
  365. v.color = basic and basic.color or 0
  366. end
  367. local function sort_call( a,b )
  368. --从大到小
  369. return a.color > b.color
  370. end
  371. table.sort( result, sort_call )
  372. end
  373. return result
  374. else
  375. return Config.Pelletreward
  376. end
  377. end
  378. -- 弹珠次数配置
  379. function RechargeActivityModel:GetPelletCountRewardCfg( round )
  380. -- 奖励ID 弹珠轮次 弹珠次数 奖励 是否传闻
  381. -- 1 1 10 [{100,136008,24}] 1
  382. local result = {}
  383. for k,v in pairs(Config.Pelletcountreward) do
  384. if v.round == round then
  385. table.insert( result, v )
  386. end
  387. end
  388. local function sort_call( a,b )
  389. return a.count < b.count
  390. end
  391. table.sort( result, sort_call )
  392. return result
  393. end
  394. --累充活动弹珠台抽奖道具
  395. function RechargeActivityModel:GetPelletTicketId( )
  396. local act_list = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.DAILY_RECHARGE)
  397. if act_list then
  398. for k,v in pairs(act_list.condition_list) do
  399. if v[1] == "pellet_cost" then
  400. return tonumber(v[2][1][2])
  401. end
  402. end
  403. else
  404. return 0
  405. end
  406. end
  407. --累充活动弹珠台数据
  408. function RechargeActivityModel:GetPelletBasicInfo( )
  409. return self.pellet_basic_info
  410. end
  411. --累充活动弹珠台数据
  412. function RechargeActivityModel:SetPelletBasicInfo( value )
  413. local function sort_call( a,b )
  414. return a.count < b.count
  415. end
  416. table.sort( value.award_status, sort_call )
  417. self.pellet_basic_info = value
  418. for i,v in ipairs(self.pellet_basic_info.award_status) do--2021.8.12自动领取
  419. if v.status == 1 then
  420. CustomActivityModel:getInstance():Fire(CustomActivityModel.PROTO_CCMD_EVENT, 33181,v.count)
  421. end
  422. end
  423. end
  424. function RechargeActivityModel:GetDailyRechargeTabList( sub_type )
  425. local act_list = CustomActivityModel:getInstance():getOneActRewardList(CustomActivityModel.CustomActBaseType.DAILY_RECHARGE,sub_type)
  426. if not act_list then return {} end
  427. local result = {}
  428. for k,v in pairs(act_list.reward_list) do
  429. for kk,vv in pairs(v.condition_list) do
  430. if vv[1] == "type" and tonumber(vv[2]) == 1 then
  431. table.insert( result, v )
  432. end
  433. end
  434. end
  435. if TableSize(result) > 1 then
  436. local function sort_call( a,b )
  437. return a.grade < b.grade
  438. end
  439. table.sort( result, sort_call )
  440. end
  441. return result
  442. end
  443. --累充活动弹珠台红点
  444. function RechargeActivityModel:GetPelletRed( )
  445. local basic = self:GetPelletBasicInfo()
  446. if basic and basic.award_status then
  447. for k,v in pairs(basic.award_status) do
  448. if v.status == 1 then
  449. return true
  450. end
  451. end
  452. end
  453. -------------------------
  454. local tickid = self:GetPelletTicketId( )
  455. local num = GoodsModel:getInstance():GetTypeGoodsNum( tickid )
  456. if num > 0 then
  457. return true
  458. end
  459. -------------------------
  460. return false
  461. end
  462. --弹珠日志记录
  463. function RechargeActivityModel:ResetPelletRecordInfo( )
  464. self.pellet_record_info = {}
  465. end
  466. --弹珠日志记录
  467. function RechargeActivityModel:GetPelletRecordInfo( )
  468. return self.pellet_record_info or {}
  469. end
  470. --弹珠日志记录
  471. function RechargeActivityModel:SetPelletRecordInfo( value )
  472. self.pellet_record_info = self.pellet_record_info or {}
  473. if not value then return end
  474. for i,v in ipairs(value.list) do
  475. v.index = DailyRechargeRecordView.PageSize * (value.page_num-1) + i
  476. self.pellet_record_info[v.index] = v
  477. end
  478. end
  479. function RechargeActivityModel:CheckConsumeMainIconRedDot(subtype)--检查每日消费红点
  480. local show = false
  481. if self.consume_info[subtype] and self.consume_info[subtype].product_list then
  482. for _, v in ipairs(self.consume_info[subtype].product_list) do
  483. if v.state == 1 then
  484. show = true
  485. break
  486. end
  487. end
  488. end
  489. GlobalEventSystem:Fire(ActivityIconManager.UPDATE_ICON_TIPS, subtype+3316700, show)
  490. end
  491. function RechargeActivityModel:CheckConsumeMainIconCanGroup( sub_type )--每日首充奖励 领取完就收纳进去
  492. local show = true
  493. if self.consume_info[sub_type] and self.consume_info[sub_type].product_list then
  494. for _, v in ipairs(self.consume_info[sub_type].product_list) do
  495. if v.award_type == 1 and v.state ~= 2 then
  496. show = false
  497. break
  498. end
  499. end
  500. end
  501. return show
  502. end
  503. function RechargeActivityModel:CheckDailyRechargeMainIconOpen(sub_type)--检测累充消费图标是否需要开启
  504. local base_type = CustomActivityModel.CustomActBaseType.DAILY_RECHARGE
  505. local sub_type = sub_type or CustomActivityModel:getInstance():getActMinSubType(base_type)
  506. local level = RoleManager.Instance.mainRoleInfo.level
  507. local act_list = CustomActivityModel:getInstance():getActList(base_type, sub_type)
  508. local is_open = false
  509. local end_time = 0
  510. -------------------------
  511. local icon_sub_type = base_type*1000 + sub_type
  512. if sub_type >= 10001 then
  513. icon_sub_type = base_type*100000 + sub_type
  514. end
  515. -------------------------
  516. if act_list and act_list.etime then
  517. end_time = act_list.etime - TimeUtil:getServerTime()
  518. is_open = end_time > 0
  519. if GetModuleIsOpen(331,base_type) then
  520. if is_open then
  521. ActivityIconManager:getInstance():addIcon(icon_sub_type, -1)
  522. else
  523. ActivityIconManager:getInstance():deleteIcon(icon_sub_type)
  524. end
  525. else
  526. ActivityIconManager:getInstance():deleteIcon(icon_sub_type)
  527. -- print("huangcong:MobilizationModel [62]: ",key)
  528. end
  529. else
  530. ActivityIconManager:getInstance():deleteIcon(icon_sub_type)
  531. end
  532. self:CheckDailyRechargeMainIconRedDot(sub_type)
  533. end
  534. function RechargeActivityModel:GetInfoFromActList( data,grade,type_id, tag_id )
  535. --获取奖励列表
  536. if type_id == 2 then
  537. grade = grade + 100
  538. end
  539. for k,v in pairs(data) do
  540. if v.grade == grade then
  541. for kk,vv in pairs(v.condition_list) do
  542. if vv[1] == "type" and tonumber(vv[2]) == type_id then
  543. return v[tag_id]
  544. end
  545. end
  546. end
  547. end
  548. end
  549. function RechargeActivityModel:GetConditionInfo( data,tag_id )
  550. for k,v in pairs(data) do
  551. if v[1] == tag_id then
  552. return v[2]
  553. end
  554. end
  555. end
  556. --每日累充奖励红点
  557. function RechargeActivityModel:GetDailyRechargeRed( sub_type )
  558. local act_list = CustomActivityModel:getInstance():getOneActRewardList(CustomActivityModel.CustomActBaseType.DAILY_RECHARGE,sub_type)
  559. if not act_list then return false end
  560. -------------------------
  561. local tab_list = self:GetDailyRechargeTabList( sub_type )
  562. local grade = tab_list[#tab_list].grade
  563. local condition_list_1 = self:GetInfoFromActList(act_list.reward_list, grade, 1, "condition_list")--条件列表
  564. local need_add = self:GetConditionInfo(condition_list_1,"show_gold")--需要充值额
  565. local today_add = self:GetInfoFromActList(act_list.reward_list, grade, 1, "progress")--今日已经充值
  566. local show_tab_extra = tonumber(today_add) >= tonumber(need_add)
  567. -------------------------
  568. for k,v in pairs(act_list.reward_list) do
  569. if (not show_tab_extra) and (tonumber(v.grade) == 5 or tonumber(v.grade) == 105) then
  570. --如果是不显示第五等级的页签,就不用红点了
  571. else
  572. if v.status == 1 then
  573. return true
  574. end
  575. end
  576. end
  577. for k,v in pairs(act_list.reward_list) do--每日首次登陆红点
  578. if v.status ~= 2 and not self:GetDailyRechargeLoginCookie(sub_type) then
  579. return true
  580. end
  581. end
  582. return false
  583. end
  584. function RechargeActivityModel:CheckDailyRechargeAllMainIconRedDot( )
  585. local all_list = CustomActivityModel:getInstance():getAllActListByBaseType(CustomActivityModel.CustomActBaseType.DAILY_RECHARGE) or {}
  586. for k,v in pairs(all_list) do
  587. self:CheckDailyRechargeMainIconRedDot(v.sub_type)
  588. end
  589. end
  590. function RechargeActivityModel:CheckDailyRechargeMainIconRedDot(sub_type)
  591. sub_type = sub_type or CustomActivityModel:getInstance():getActMinSubType(CustomActivityModel.CustomActBaseType.DAILY_RECHARGE)
  592. local bool = self:GetPelletRed() or self:GetDailyRechargeRed(sub_type)
  593. local base_type = CustomActivityModel.CustomActBaseType.DAILY_RECHARGE
  594. if sub_type then
  595. local icon_sub_type = base_type*1000 + sub_type
  596. if sub_type >= 10001 then
  597. icon_sub_type = base_type*100000 + sub_type
  598. end
  599. GlobalEventSystem:Fire(ActivityIconManager.UPDATE_ICON_TIPS, icon_sub_type, bool)
  600. end
  601. end
  602. --设置所有充值的商品数据
  603. function RechargeActivityModel:SetAllRechargeInfo( scmd )
  604. self.recharge_add_info = {}
  605. local recharge_add_info = {}
  606. local product_list = {}
  607. for k,v in pairs(scmd) do
  608. v.award_cfg = DeepCopy(self:GetRechargeAwardCfg(v.product_id))
  609. v.product_cfg = DeepCopy(Config.Rechargeproduct[v.product_id])
  610. if v.product_cfg and v.award_cfg and TableSize(v.award_cfg) > #v.award_list then--证明有奖励未领取完
  611. for kk,vv in pairs(v.award_cfg) do
  612. local state = 0--奖励状态(0时间未到 1可领取 2已领完)
  613. local sort_id = vv.index+1000
  614. if v.open == 1 then
  615. state = v.days >= vv.index and 1 or 0
  616. if v.days + 1 == vv.index then--明日可领
  617. state = 3
  618. end
  619. for kkk,vvv in pairs(v.award_list) do
  620. if vvv.index == vv.index then
  621. state = 2
  622. break
  623. end
  624. end
  625. if state == 1 then
  626. sort_id = vv.index
  627. elseif state == 2 then
  628. sort_id = vv.index+100000
  629. elseif state == 3 then
  630. sort_id = vv.index + 100
  631. end
  632. else
  633. if vv.index == 1 then
  634. state = 5
  635. elseif vv.index == 2 then
  636. state = 3
  637. end
  638. end
  639. vv.state = state
  640. vv.sort_id = sort_id--进行排序
  641. end
  642. recharge_add_info[#recharge_add_info + 1] = v
  643. end
  644. end
  645. if #recharge_add_info > 0 then
  646. local sort_func = function ( a, b )
  647. return a.product_cfg.money < b.product_cfg.money
  648. end
  649. table.sort(recharge_add_info, sort_func)
  650. self.recharge_add_info = recharge_add_info
  651. ActivityIconManager:getInstance():addIcon(15908, -1)
  652. self:UpdateRechargeAddRedDot()
  653. else
  654. ActivityIconManager:getInstance():deleteIcon(15908)
  655. end
  656. local custom_info = ActivityIconManager:getInstance().cur_choose_custom_info
  657. if custom_info and (custom_info.icon_type == 15901 or custom_info.icon_type == 15908)then--首充和首充追加要刷新活动图标特殊提示
  658. ActivityIconManager:getInstance():UpdateActivityIconCurCustomShowDesc()
  659. end
  660. end
  661. function RechargeActivityModel:UpdateRechargeAddRedDot( )
  662. local red_bool = false
  663. local tab_list = self:GetAllRechargeInfo()
  664. if tab_list then
  665. for k,v in pairs(tab_list) do
  666. if red_bool then
  667. break
  668. end
  669. for kk,vv in pairs(v.award_cfg) do
  670. if vv.state == 1 then
  671. red_bool = true
  672. break
  673. end
  674. end
  675. end
  676. end
  677. if not red_bool then
  678. local need_find_add_recharge_list = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.RECHARGE_ADD_RED) or {}
  679. for k,v in pairs(need_find_add_recharge_list) do
  680. if v then
  681. red_bool = true
  682. break
  683. end
  684. end
  685. end
  686. if not red_bool then
  687. local tag_str = "chargeplus"
  688. red_bool = KfActivityModel:getInstance():IsMoneyCopyRedByTag( tag_str )
  689. end
  690. GlobalEventSystem:Fire(ActivityIconManager.UPDATE_ICON_TIPS, 15908, red_bool)--刷新红点
  691. end
  692. function RechargeActivityModel:GetAllRechargeInfo( )
  693. return self.recharge_add_info
  694. end
  695. --是否有首充追加的未完成
  696. function RechargeActivityModel:HaveAddRechargeComple( )
  697. local info = self:GetAllRechargeInfo()
  698. if info then
  699. for k,v in pairs(info) do
  700. if v.open == 0 then
  701. return true
  702. end
  703. end
  704. end
  705. end
  706. --得到首充图标是否显示特殊提示20210129
  707. --1、首充图标位于第二行的最左边,增加气泡框显示(3天返利888元),开服前7天:未首充玩家每次登录后自动显示气泡,打开界面后消失,另外未首充玩家本次登录累计在线60分钟、120分钟和180分钟也会弹出一次气泡框
  708. --2、首充追加图标位于第二行的最左边,开服前14天玩家首充但未完成首充追加的玩家,有气泡框显示(7天返利40倍),同样是每次登录后/在线60分钟/在线120分钟/在线180分钟弹出一次
  709. --3、未首充玩家开服前3天,每天登陆后自动弹出首充界面
  710. function RechargeActivityModel:GetFirstRechagerIconNeedShowSpeacial( )
  711. if self.first_recharge_info and self.first_recharge_info.product_list then
  712. local open_day = ServerTimeModel:getInstance():GetOpenServerDay()
  713. local is_recharge = false--是否已经领完
  714. for i,v in pairs(self.first_recharge_info.product_list) do
  715. if v.state ~= 0 then
  716. is_recharge = true
  717. break
  718. end
  719. end
  720. -- 状态:是否首充过
  721. if not is_recharge and open_day <= 7 then
  722. end
  723. end
  724. end
  725. --获得登陆需要自动打开首充界面参数
  726. function RechargeActivityModel:GetNeedAutoOpenRechargeValue( )
  727. return self.first_recharge_is_login_open
  728. end
  729. --设置每日累充cookie
  730. function RechargeActivityModel:SetDailyActCookie( sub_type )
  731. local list = self:GetDailyActCookie() or {}
  732. list[sub_type] = true
  733. CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,CookieTimeType.TYPE_ALWAYS,CookieKey.DAYLIY_RECHARGE_ACT_JUJIAO,list)
  734. CookieWrapper.Instance:WriteAll()
  735. end
  736. --获得每日累充cookie
  737. function RechargeActivityModel:GetDailyActCookie( sub_type )
  738. local list = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.DAYLIY_RECHARGE_ACT_JUJIAO) or {}
  739. return list[sub_type]
  740. end
  741. --设置每日累充首次登陆红点
  742. function RechargeActivityModel:SetDailyRechargeLoginCookie( sub_type )
  743. local list = self:GetDailyActCookie() or {}
  744. list[sub_type] = true
  745. CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,CookieTimeType.TYPE_DAY2,CookieKey.DAYLIY_RECHARGE_LOGIN_RED,list)
  746. CookieWrapper.Instance:WriteAll()
  747. end
  748. --获得每日累充cookie
  749. function RechargeActivityModel:GetDailyRechargeLoginCookie( sub_type )
  750. local list = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.DAYLIY_RECHARGE_LOGIN_RED) or {}
  751. return list[sub_type]
  752. end