|
|
- --[[@------------------------------------------------------------------
- @description:充值活动
- @author:huangcong
- ----------------------------------------------------------------------]]
- RechargeActivityModel = RechargeActivityModel or BaseClass(BaseVo, true)
- RechargeActivityModel.REQUEST_CCMD_EVENT = "RechargeActivityModel.REQUEST_CCMD_EVENT"
- RechargeActivityModel.OPEN_FIRST_RECHARGE_VIEW = "RechargeActivityModel.OPEN_FIRST_RECHARGE_VIEW" --打开首充界面
- RechargeActivityModel.OPEN_DAILY_RECHARGE_VIEW = "RechargeActivityModel.OPEN_DAILY_RECHARGE_VIEW" --打开每日充值界面
- RechargeActivityModel.UPDATE_FIRST_RECHARGE_VIEW = "RechargeActivityModel.UPDATE_FIRST_RECHARGE_VIEW" --更新首充界面
- RechargeActivityModel.UPDATE_TODAY_RECHARGE_INFO = "RechargeActivityModel.UPDATE_TODAY_RECHARGE_INFO" --更新当天累计充值信息
- RechargeActivityModel.UPDATE_RECHARGE_REWARD_LIST = "RechargeActivityModel.UPDATE_RECHARGE_REWARD_LIST" --更新多天累计充值奖励
- RechargeActivityModel.OPEN_FIRST_RECHARGE_TIP_VIEW = "RechargeActivityModel.OPEN_FIRST_RECHARGE_TIP_VIEW" --打开首冲引导广告
- RechargeActivityModel.SHOW_FIRST_RECHARGE_TIP_VIEW = "RechargeActivityModel.SHOW_FIRST_RECHARGE_TIP_VIEW" --首冲引导提示
-
- RechargeActivityModel.UPDATE_PELLET_INFO = "RechargeActivityModel.UPDATE_PELLET_INFO" --更新当天累充弹珠信息
- RechargeActivityModel.OPEN_DAILY_PELLET_RECORD = "RechargeActivityModel.OPEN_DAILY_PELLET_RECORD" --打开弹珠记录
- RechargeActivityModel.UPDATE_PELLET_VALIDATION = "RechargeActivityModel.UPDATE_PELLET_VALIDATION" -- 更新弹珠机的抽奖验证
- RechargeActivityModel.PELLET_VALIDATION_SUCCEED = "RechargeActivityModel.PELLET_VALIDATION_SUCCEED" -- 弹珠机的抽奖验证成功推送
-
- RechargeActivityModel.ANS_PELLET_RECORD_INFO = 'RechargeActivityModel.ANS_PELLET_RECORD_INFO' -- 弹珠抽奖日志查询
-
- RechargeActivityModel.OPEN_JIPSAW_VIEW = 'RechargeActivityModel.OPEN_JIPSAW_VIEW' -- 打开拼图界面
- RechargeActivityModel.OPEN_GUAGUALE_VIEW = 'RechargeActivityModel.OPEN_GUAGUALE_VIEW' -- D打开刮刮乐界面
- RechargeActivityModel.OPEN_RECHARGE_ADD_VIEW = 'RechargeActivityModel.OPEN_RECHARGE_ADD_VIEW' -- 打开首充附加界面
-
- RechargeActivityModel.FIRST_RECHARGE_PRODUCKT_ID = 9999
-
-
- function RechargeActivityModel:__init()
- RechargeActivityModel.Instance = self
-
- self.first_recharge_info = nil --首充信息
- self.today_recharge_info = nil --当天累计充值信息
- self.recharge_reward_list = nil --多天累计充值奖励
- self.show_tip_time = 0--tip界面倒计时
- self.has_show_icon_effect = false
- self.login_tw_red_dot = true
- self.pellet_basic_info = nil--累充弹珠数据
- self.recharge_add_info = nil
- self.cur_live_ness = nil--当前记录的活跃值
- self.first_recharge_is_login_open = false--首充界面是否登陆第一次打开
- self.need_show_daily_recharge_effect = false--是否需要展示每日首充特效
- self:InitCfg()
- end
-
- function RechargeActivityModel:getInstance()
- if RechargeActivityModel.Instance == nil then
- RechargeActivityModel.New()
- end
- return RechargeActivityModel.Instance
- end
-
- function RechargeActivityModel:InitCfg( )
- self.recharge_award_list = {}--充值商品奖励数据 除了首充的
- local recharge_award_list = DeepCopy(Config.Rechargefirst)
- for k,v in pairs(recharge_award_list) do
- if v.product_id ~= RechargeActivityModel.FIRST_RECHARGE_PRODUCKT_ID then--排除首充
- local data = v
- data.reward = stringtotable(v.reward)--奖励展示
- data.title = Trim(v.title)
- data.content = Trim(v.content)
- if not self.recharge_award_list[v.product_id] then
- self.recharge_award_list[v.product_id] = {}
- end
- self.recharge_award_list[v.product_id][v.index] = data
- end
- end
- end
-
- --获得充值商品奖励数据
- function RechargeActivityModel:GetRechargeAwardCfg( product_id )
- return self.recharge_award_list[product_id]
- end
-
- --设置首充图标状态
- function RechargeActivityModel:SetFirstRechargeIconUpdate( scmd )
- local is_get_over = false--是否已经领完
- if scmd and scmd.product_list then
- for i,v in ipairs(scmd.product_list) do
- if v.state ~= 2 then
- is_get_over = false
- break
- else
- is_get_over = v.state == 2
- end
- end
- end
- local open_day = ServerTimeModel:getInstance():GetOpenServerDay()
- local level = RoleManager.Instance.mainRoleInfo.level
- -- local icon_cfg = ActivityIconManager:getInstance():getIconCfg(15901)
- -- if icon_cfg then
- -- icon_cfg.sub_location = open_day <= 3 and level >= 90 and 3 or 2
- -- end
- -- 状态:是否已经领完奖励
- self:SetFirstRechargeInfo(scmd)
- if not is_get_over then
- ActivityIconManager:getInstance():addIcon(15901, -1)
- else
- ActivityIconManager:getInstance():deleteIcon(15901)
- end
- -- --已购买首充才显示每日累充
- -- if scmd.open ~= 0 then --奖励状态(0时间未到 1可领取 2已领完)
- local sub_type = CustomActivityModel:getInstance():getActMinSubType(CustomActivityModel.CustomActBaseType.DAILY_RECHARGE)
- if sub_type then
- self:Fire(RechargeActivityModel.REQUEST_CCMD_EVENT, 15955, sub_type)
- end
- -- else
- -- if scmd.open == 0 then
- -- -- ActivityIconManager:getInstance():deleteIcon(23,true)
- -- end
- -- end
- end
-
- --设置首充数据
- function RechargeActivityModel:SetFirstRechargeInfo(vo)
- local product_list = {}
- if vo and vo.product_list then
- for i,v in ipairs(vo.product_list) do
- product_list[v.index] = v
- end
- end
- vo.product_list = product_list
- self.first_recharge_info = vo
- self:UpdateFirstRechargeRedDot()
-
- local open_day = ServerTimeModel:getInstance():GetOpenServerDay()
- local is_recharge = false--是否已经充值过
- for i,v in pairs(self.first_recharge_info.product_list) do
- if v.state ~= 0 then
- is_recharge = true
- break
- end
- end
- -- 状态:是否首充过
- 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--没有充值过要加--登陆给玩家弹一次首充
- self.need_open_first_recharge = true
- end
- ActivityIconManager:getInstance():UpdateActivityIconCurCustomShowDesc()--首充数据返回检查一次
- end
-
- --判断是否首充过
- function RechargeActivityModel:IsRecharge( )
- local is_recharge = nil--是否已经充值过
- if self.first_recharge_info then
- for i,v in pairs(self.first_recharge_info.product_list) do
- if v.state ~= 0 then
- is_recharge = true
- break
- end
- end
- is_recharge = is_recharge or false
- end
- if is_recharge == nil then--判断数据是否存在
- return true
- else
- return is_recharge
- end
- end
-
- --刷新首充红点
- function RechargeActivityModel:UpdateFirstRechargeRedDot( )
- local red_bool = false
- if self.first_recharge_info and self.first_recharge_info.product_list then
- for i,v in pairs(self.first_recharge_info.product_list) do
- if v.state == 1 then
- red_bool = true
- break
- end
- end
- end
- GlobalEventSystem:Fire(ActivityIconManager.UPDATE_ICON_TIPS, 15901, red_bool)--刷新红点
- end
-
- function RechargeActivityModel:GetFirstRechargeInfo()
- return self.first_recharge_info
- end
-
- --是否首充
- function RechargeActivityModel:IsFirstRechager( )
- if self.first_recharge_info and self.first_recharge_info.open then
- return self.first_recharge_info.open ~= 0
- end
- end
-
- --奖励尚未领完都显示图标
- function RechargeActivityModel:ShowRechargeIcon( )
- if self.first_recharge_info and self.first_recharge_info.open then
- return self.first_recharge_info.open ~= 3
- end
- end
-
- --是否未首充
- function RechargeActivityModel:IsNoFirstRecharge( )
- if self.first_recharge_info and self.first_recharge_info.open then
- return self.first_recharge_info.open == 0
- end
- end
-
- --设置每日奖励数据
- function RechargeActivityModel:SetTodayRechargeInfo(vo)
- self.today_recharge_info = vo
- self:CheckMainIconRedDot()
- self:Fire(RechargeActivityModel.UPDATE_TODAY_RECHARGE_INFO)
- end
-
- --返回每日奖励数据
- function RechargeActivityModel:GetTodayRechargeInfo( id )
- if id then
- if self.today_recharge_info and self.today_recharge_info.reward_infos then
- for k,v in pairs(self.today_recharge_info.reward_infos) do
- if v.id == id then
- return v
- end
- end
- end
- else
- return self.today_recharge_info
- end
- end
-
- --设置充值奖励数据
- function RechargeActivityModel:SetRechargeRewardList(vo)
- self.recharge_reward_list = vo.reward_list
- self:CheckMainIconRedDot()
- self:Fire(RechargeActivityModel.UPDATE_RECHARGE_REWARD_LIST)
- end
-
- --请求每日充值数据
- function RechargeActivityModel:RequestDailyRechargeData()
- --不需要再才遍历整个活动列表
- local list = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.DAILY_RECHARGE)
- if list then
- self:Fire(RechargeActivityModel.REQUEST_CCMD_EVENT, 15955, list.sub_type)
- self:Fire(RechargeActivityModel.REQUEST_CCMD_EVENT, 15956, list.sub_type)
- end
- end
-
- function RechargeActivityModel:CheckMainIconCanGroup( )--每日首充奖励 领取完就收纳进去
- local show = true
- if self.today_recharge_info then
- for _, v in ipairs(self.today_recharge_info.reward_infos) do
- if v.state ~= 2 then
- show = false
- break
- end
- end
- end
- local openDay = ServerTimeModel:getInstance():GetOpenServerDay()
- if show and openDay >= 5 and not ActivityIconManager:getInstance().icon_group_list[23] then
- end
- return show
- end
-
- function RechargeActivityModel:CheckMainIconRedDot()
- local show = false
- if self.today_recharge_info then
- for _, v in ipairs(self.today_recharge_info.reward_infos) do
- if v.state == 1 then
- show = true
- break
- end
- end
- end
-
- if show == false and self.recharge_reward_list then
- for _, v in ipairs(self.recharge_reward_list) do
- if v.state == 1 then
- show = true
- break
- end
- end
- end
-
- GlobalEventSystem:Fire(ActivityIconManager.UPDATE_ICON_TIPS, 23, show)
- end
-
- function RechargeActivityModel:CheckMainIconNeedEffect()
- local show = false
- if self.today_recharge_info then
- for _, v in ipairs(self.today_recharge_info.reward_infos) do
- if v.state == 0 then
- show = true
- break
- end
- end
- end
-
- if show == false and self.recharge_reward_list then
- for _, v in ipairs(self.recharge_reward_list) do
- if v.state == 0 then
- show = true
- break
- end
- end
- end
- if show and not self.has_show_icon_effect then
- local function callback( )
- GlobalEventSystem:Fire(EventName.CHANGE_ACTIVETY_ICON_EFFECT,23)
- end
- setTimeout(callback,1.5)
- self.has_show_icon_effect = true
- end
- end
-
- function RechargeActivityModel:UpdateDailyRechargeView(base_type, sub_type)
- if base_type == CustomActivityModel.CustomActBaseType.DAILY_RECHARGE then
- self:Fire(RechargeActivityModel.REQUEST_CCMD_EVENT, 15955, sub_type)
- self:Fire(RechargeActivityModel.REQUEST_CCMD_EVENT, 15956, sub_type)
- end
- end
-
- function RechargeActivityModel:UpdateDailyConsumeView(sub_type)
- self:Fire(RechargeActivityModel.REQUEST_CCMD_EVENT, 15958, sub_type)
- end
-
- function RechargeActivityModel:CheckConsumeMainIconOpen(sub_type)--检测今日消费图标是否需要开启
- if not sub_type then
- print("huangcong:InvestModel [162]不存在的每日消费类型: ",sub_type)
- return
- end
- local base_type = CustomActivityModel.CustomActBaseType.DAILY_CONSUME
- local level = RoleManager.Instance.mainRoleInfo.level
-
- local have_time
- local act_list = CustomActivityModel:getInstance():getActList(base_type, sub_type)
- if act_list and act_list.etime then
- have_time = act_list.etime - TimeUtil:getServerTime()
- local level_limit = 1
- local key = string.format("%s@%s",331,67)
- if Config.Moduleopenlv[key] then
- level_limit = Config.Moduleopenlv[key].lv
- end
- -- print("huangcong:RechargeActivityModel [181]: ",have_time,level_limit,base_type, sub_type)
- -- PrintTable(act_list)
- if level_limit then
- if have_time > 0 and tonumber(level_limit) <= level then
- ActivityIconManager:getInstance():addIcon(3316700+sub_type, have_time)
- else
- ActivityIconManager:getInstance():deleteIcon(3316700+sub_type,true)
- end
- else
- ActivityIconManager:getInstance():deleteIcon(3316700+sub_type,true)
- -- print("huangcong:InvestModel [431]: ",key)
- end
- else
- ActivityIconManager:getInstance():deleteIcon(3316700+sub_type,true)
- end
- self:CheckConsumeMainIconRedDot(sub_type)
- end
-
- --设置每日消费信息
- function RechargeActivityModel:SetDailyConsumeInfo( vo )
- if vo and vo.subtype then
- -- print("huangcong:RechargeActivityModel [201]vo: ",vo)
- -- PrintTable(vo)
- if vo.product_list and TableSize(vo.product_list) > 0 then
- self.consume_info[vo.subtype] = vo
- self.consume_info[vo.subtype].today_consume_info = {}
- self.consume_info[vo.subtype].consume_reward_list = {}
- self.consume_info[vo.subtype].daily_gold = 0
- for k,v in pairs(vo.product_list) do
- if v.award_type == 1 then
- if v.value > self.consume_info[vo.subtype].daily_gold then
- self.consume_info[vo.subtype].daily_gold = v.value
- end
- table.insert(self.consume_info[vo.subtype].today_consume_info, v)
- elseif v.award_type == 2 then
- table.insert(self.consume_info[vo.subtype].consume_reward_list, v)
- end
- end
- self:CheckConsumeMainIconOpen(vo.subtype)
- self:Fire(RechargeActivityModel.UPDATE_CONSUME_INFO,vo.subtype)
- end
- end
- end
-
- -- 弹珠奖池配置
- function RechargeActivityModel:GetPelletRewardCfg(show, need_sort, round, is_all, grade)
- if show then
- local result = {}
- for k,v in pairs(Config.Pelletreward) do
- if (v.is_show == 1) or is_all then
- if round then
- if v.round_min <= round and round <= v.round_max then
- if not grade or v.grade == grade then
- table.insert(result, stringtotable(v.award)[1])
- end
- end
- else
- if not grade or v.grade == grade then
- table.insert(result, stringtotable(v.award)[1])
- end
- end
- end
- end
- if need_sort then
- local basic = false
- for k,v in pairs(result) do
- basic = GoodsModel:getInstance():GetGoodsBasicByTypeId( tonumber(v[2]) )
- v.color = basic and basic.color or 0
- end
- local function sort_call( a,b )
- --从大到小
- return a.color > b.color
- end
- table.sort( result, sort_call )
- end
- return result
- else
- return Config.Pelletreward
- end
- end
-
- -- 弹珠次数配置
- function RechargeActivityModel:GetPelletCountRewardCfg( round )
- -- 奖励ID 弹珠轮次 弹珠次数 奖励 是否传闻
- -- 1 1 10 [{100,136008,24}] 1
- local result = {}
- for k,v in pairs(Config.Pelletcountreward) do
- if v.round == round then
- table.insert( result, v )
- end
- end
- local function sort_call( a,b )
- return a.count < b.count
- end
- table.sort( result, sort_call )
- return result
- end
-
- --累充活动弹珠台抽奖道具
- function RechargeActivityModel:GetPelletTicketId( )
- local act_list = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.DAILY_RECHARGE)
- if act_list then
- for k,v in pairs(act_list.condition_list) do
- if v[1] == "pellet_cost" then
- return tonumber(v[2][1][2])
- end
- end
- else
- return 0
- end
- end
-
- --累充活动弹珠台数据
- function RechargeActivityModel:GetPelletBasicInfo( )
- return self.pellet_basic_info
- end
-
- --累充活动弹珠台数据
- function RechargeActivityModel:SetPelletBasicInfo( value )
- local function sort_call( a,b )
- return a.count < b.count
- end
- table.sort( value.award_status, sort_call )
- self.pellet_basic_info = value
- for i,v in ipairs(self.pellet_basic_info.award_status) do--2021.8.12自动领取
- if v.status == 1 then
- CustomActivityModel:getInstance():Fire(CustomActivityModel.PROTO_CCMD_EVENT, 33181,v.count)
- end
- end
- end
-
- function RechargeActivityModel:GetDailyRechargeTabList( sub_type )
- local act_list = CustomActivityModel:getInstance():getOneActRewardList(CustomActivityModel.CustomActBaseType.DAILY_RECHARGE,sub_type)
- if not act_list then return {} end
- local result = {}
- for k,v in pairs(act_list.reward_list) do
- for kk,vv in pairs(v.condition_list) do
- if vv[1] == "type" and tonumber(vv[2]) == 1 then
- table.insert( result, v )
- end
- end
- end
- if TableSize(result) > 1 then
- local function sort_call( a,b )
- return a.grade < b.grade
- end
- table.sort( result, sort_call )
- end
- return result
- end
-
- --累充活动弹珠台红点
- function RechargeActivityModel:GetPelletRed( )
- local basic = self:GetPelletBasicInfo()
- if basic and basic.award_status then
- for k,v in pairs(basic.award_status) do
- if v.status == 1 then
- return true
- end
- end
- end
- -------------------------
- local tickid = self:GetPelletTicketId( )
- local num = GoodsModel:getInstance():GetTypeGoodsNum( tickid )
- if num > 0 then
- return true
- end
- -------------------------
- return false
- end
-
- --弹珠日志记录
- function RechargeActivityModel:ResetPelletRecordInfo( )
- self.pellet_record_info = {}
- end
-
- --弹珠日志记录
- function RechargeActivityModel:GetPelletRecordInfo( )
- return self.pellet_record_info or {}
- end
-
- --弹珠日志记录
- function RechargeActivityModel:SetPelletRecordInfo( value )
- self.pellet_record_info = self.pellet_record_info or {}
- if not value then return end
- for i,v in ipairs(value.list) do
- v.index = DailyRechargeRecordView.PageSize * (value.page_num-1) + i
- self.pellet_record_info[v.index] = v
- end
- end
-
- function RechargeActivityModel:CheckConsumeMainIconRedDot(subtype)--检查每日消费红点
- local show = false
- if self.consume_info[subtype] and self.consume_info[subtype].product_list then
- for _, v in ipairs(self.consume_info[subtype].product_list) do
- if v.state == 1 then
- show = true
- break
- end
- end
- end
- GlobalEventSystem:Fire(ActivityIconManager.UPDATE_ICON_TIPS, subtype+3316700, show)
- end
-
- function RechargeActivityModel:CheckConsumeMainIconCanGroup( sub_type )--每日首充奖励 领取完就收纳进去
- local show = true
- if self.consume_info[sub_type] and self.consume_info[sub_type].product_list then
- for _, v in ipairs(self.consume_info[sub_type].product_list) do
- if v.award_type == 1 and v.state ~= 2 then
- show = false
- break
- end
- end
- end
- return show
- end
-
- function RechargeActivityModel:CheckDailyRechargeMainIconOpen(sub_type)--检测累充消费图标是否需要开启
- local base_type = CustomActivityModel.CustomActBaseType.DAILY_RECHARGE
- local sub_type = sub_type or CustomActivityModel:getInstance():getActMinSubType(base_type)
- local level = RoleManager.Instance.mainRoleInfo.level
- local act_list = CustomActivityModel:getInstance():getActList(base_type, sub_type)
- local is_open = false
- local end_time = 0
- -------------------------
- local icon_sub_type = base_type*1000 + sub_type
- if sub_type >= 10001 then
- icon_sub_type = base_type*100000 + sub_type
- end
- -------------------------
- if act_list and act_list.etime then
- end_time = act_list.etime - TimeUtil:getServerTime()
- is_open = end_time > 0
- if GetModuleIsOpen(331,base_type) then
- if is_open then
- ActivityIconManager:getInstance():addIcon(icon_sub_type, -1)
- else
- ActivityIconManager:getInstance():deleteIcon(icon_sub_type)
- end
- else
- ActivityIconManager:getInstance():deleteIcon(icon_sub_type)
- -- print("huangcong:MobilizationModel [62]: ",key)
- end
- else
- ActivityIconManager:getInstance():deleteIcon(icon_sub_type)
- end
- self:CheckDailyRechargeMainIconRedDot(sub_type)
- end
-
- function RechargeActivityModel:GetInfoFromActList( data,grade,type_id, tag_id )
- --获取奖励列表
- if type_id == 2 then
- grade = grade + 100
- end
- for k,v in pairs(data) do
- if v.grade == grade then
- for kk,vv in pairs(v.condition_list) do
- if vv[1] == "type" and tonumber(vv[2]) == type_id then
- return v[tag_id]
- end
- end
- end
- end
- end
-
- function RechargeActivityModel:GetConditionInfo( data,tag_id )
- for k,v in pairs(data) do
- if v[1] == tag_id then
- return v[2]
- end
- end
- end
-
- --每日累充奖励红点
- function RechargeActivityModel:GetDailyRechargeRed( sub_type )
- local act_list = CustomActivityModel:getInstance():getOneActRewardList(CustomActivityModel.CustomActBaseType.DAILY_RECHARGE,sub_type)
- if not act_list then return false end
- -------------------------
- local tab_list = self:GetDailyRechargeTabList( sub_type )
- local grade = tab_list[#tab_list].grade
- local condition_list_1 = self:GetInfoFromActList(act_list.reward_list, grade, 1, "condition_list")--条件列表
- local need_add = self:GetConditionInfo(condition_list_1,"show_gold")--需要充值额
- local today_add = self:GetInfoFromActList(act_list.reward_list, grade, 1, "progress")--今日已经充值
- local show_tab_extra = tonumber(today_add) >= tonumber(need_add)
- -------------------------
- for k,v in pairs(act_list.reward_list) do
- if (not show_tab_extra) and (tonumber(v.grade) == 5 or tonumber(v.grade) == 105) then
- --如果是不显示第五等级的页签,就不用红点了
- else
- if v.status == 1 then
- return true
- end
- end
- end
- for k,v in pairs(act_list.reward_list) do--每日首次登陆红点
- if v.status ~= 2 and not self:GetDailyRechargeLoginCookie(sub_type) then
- return true
- end
- end
- return false
- end
-
- function RechargeActivityModel:CheckDailyRechargeAllMainIconRedDot( )
- local all_list = CustomActivityModel:getInstance():getAllActListByBaseType(CustomActivityModel.CustomActBaseType.DAILY_RECHARGE) or {}
- for k,v in pairs(all_list) do
- self:CheckDailyRechargeMainIconRedDot(v.sub_type)
- end
- end
-
- function RechargeActivityModel:CheckDailyRechargeMainIconRedDot(sub_type)
- sub_type = sub_type or CustomActivityModel:getInstance():getActMinSubType(CustomActivityModel.CustomActBaseType.DAILY_RECHARGE)
- local bool = self:GetPelletRed() or self:GetDailyRechargeRed(sub_type)
- local base_type = CustomActivityModel.CustomActBaseType.DAILY_RECHARGE
- if sub_type then
- local icon_sub_type = base_type*1000 + sub_type
- if sub_type >= 10001 then
- icon_sub_type = base_type*100000 + sub_type
- end
- GlobalEventSystem:Fire(ActivityIconManager.UPDATE_ICON_TIPS, icon_sub_type, bool)
- end
- end
-
- --设置所有充值的商品数据
- function RechargeActivityModel:SetAllRechargeInfo( scmd )
- self.recharge_add_info = {}
- local recharge_add_info = {}
- local product_list = {}
- for k,v in pairs(scmd) do
- v.award_cfg = DeepCopy(self:GetRechargeAwardCfg(v.product_id))
- v.product_cfg = DeepCopy(Config.Rechargeproduct[v.product_id])
- if v.product_cfg and v.award_cfg and TableSize(v.award_cfg) > #v.award_list then--证明有奖励未领取完
- for kk,vv in pairs(v.award_cfg) do
- local state = 0--奖励状态(0时间未到 1可领取 2已领完)
- local sort_id = vv.index+1000
- if v.open == 1 then
- state = v.days >= vv.index and 1 or 0
- if v.days + 1 == vv.index then--明日可领
- state = 3
- end
- for kkk,vvv in pairs(v.award_list) do
- if vvv.index == vv.index then
- state = 2
- break
- end
- end
- if state == 1 then
- sort_id = vv.index
- elseif state == 2 then
- sort_id = vv.index+100000
- elseif state == 3 then
- sort_id = vv.index + 100
- end
- else
- if vv.index == 1 then
- state = 5
- elseif vv.index == 2 then
- state = 3
- end
- end
- vv.state = state
- vv.sort_id = sort_id--进行排序
- end
- recharge_add_info[#recharge_add_info + 1] = v
- end
- end
-
- if #recharge_add_info > 0 then
- local sort_func = function ( a, b )
- return a.product_cfg.money < b.product_cfg.money
- end
- table.sort(recharge_add_info, sort_func)
- self.recharge_add_info = recharge_add_info
- ActivityIconManager:getInstance():addIcon(15908, -1)
- self:UpdateRechargeAddRedDot()
- else
- ActivityIconManager:getInstance():deleteIcon(15908)
- end
- local custom_info = ActivityIconManager:getInstance().cur_choose_custom_info
- if custom_info and (custom_info.icon_type == 15901 or custom_info.icon_type == 15908)then--首充和首充追加要刷新活动图标特殊提示
- ActivityIconManager:getInstance():UpdateActivityIconCurCustomShowDesc()
- end
- end
-
- function RechargeActivityModel:UpdateRechargeAddRedDot( )
- local red_bool = false
- local tab_list = self:GetAllRechargeInfo()
- if tab_list then
- for k,v in pairs(tab_list) do
- if red_bool then
- break
- end
- for kk,vv in pairs(v.award_cfg) do
- if vv.state == 1 then
- red_bool = true
- break
- end
- end
- end
- end
- if not red_bool then
- local need_find_add_recharge_list = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.RECHARGE_ADD_RED) or {}
- for k,v in pairs(need_find_add_recharge_list) do
- if v then
- red_bool = true
- break
- end
- end
- end
- if not red_bool then
- local tag_str = "chargeplus"
- red_bool = KfActivityModel:getInstance():IsMoneyCopyRedByTag( tag_str )
- end
- GlobalEventSystem:Fire(ActivityIconManager.UPDATE_ICON_TIPS, 15908, red_bool)--刷新红点
- end
-
- function RechargeActivityModel:GetAllRechargeInfo( )
- return self.recharge_add_info
- end
-
- --是否有首充追加的未完成
- function RechargeActivityModel:HaveAddRechargeComple( )
- local info = self:GetAllRechargeInfo()
- if info then
- for k,v in pairs(info) do
- if v.open == 0 then
- return true
- end
- end
- end
- end
-
- --得到首充图标是否显示特殊提示20210129
- --1、首充图标位于第二行的最左边,增加气泡框显示(3天返利888元),开服前7天:未首充玩家每次登录后自动显示气泡,打开界面后消失,另外未首充玩家本次登录累计在线60分钟、120分钟和180分钟也会弹出一次气泡框
- --2、首充追加图标位于第二行的最左边,开服前14天玩家首充但未完成首充追加的玩家,有气泡框显示(7天返利40倍),同样是每次登录后/在线60分钟/在线120分钟/在线180分钟弹出一次
- --3、未首充玩家开服前3天,每天登陆后自动弹出首充界面
- function RechargeActivityModel:GetFirstRechagerIconNeedShowSpeacial( )
- if self.first_recharge_info and self.first_recharge_info.product_list then
- local open_day = ServerTimeModel:getInstance():GetOpenServerDay()
- local is_recharge = false--是否已经领完
- for i,v in pairs(self.first_recharge_info.product_list) do
- if v.state ~= 0 then
- is_recharge = true
- break
- end
- end
- -- 状态:是否首充过
- if not is_recharge and open_day <= 7 then
-
- end
- end
- end
-
-
- --获得登陆需要自动打开首充界面参数
- function RechargeActivityModel:GetNeedAutoOpenRechargeValue( )
- return self.first_recharge_is_login_open
- end
-
-
- --设置每日累充cookie
- function RechargeActivityModel:SetDailyActCookie( sub_type )
- local list = self:GetDailyActCookie() or {}
- list[sub_type] = true
- CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,CookieTimeType.TYPE_ALWAYS,CookieKey.DAYLIY_RECHARGE_ACT_JUJIAO,list)
- CookieWrapper.Instance:WriteAll()
- end
-
- --获得每日累充cookie
- function RechargeActivityModel:GetDailyActCookie( sub_type )
- local list = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.DAYLIY_RECHARGE_ACT_JUJIAO) or {}
- return list[sub_type]
- end
-
-
-
- --设置每日累充首次登陆红点
- function RechargeActivityModel:SetDailyRechargeLoginCookie( sub_type )
- local list = self:GetDailyActCookie() or {}
- list[sub_type] = true
- CookieWrapper.Instance:SaveCookie(CookieLevelType.Account,CookieTimeType.TYPE_DAY2,CookieKey.DAYLIY_RECHARGE_LOGIN_RED,list)
- CookieWrapper.Instance:WriteAll()
- end
-
- --获得每日累充cookie
- function RechargeActivityModel:GetDailyRechargeLoginCookie( sub_type )
- local list = CookieWrapper.Instance:GetCookie(CookieLevelType.Account,CookieKey.DAYLIY_RECHARGE_LOGIN_RED) or {}
- return list[sub_type]
- end
|