|
|
- --[[@------------------------------------------------------------------
- @description:VIP
- @author:huangcong
- ----------------------------------------------------------------------]]
- require("game.proto.450.Require450")
- require("game.proto.158.Require158")
- require("game.proto.420.Require420")
- require("game.vip.VipModel")
- require("game.vip.VipConst")
- require("game.vip.view.VipBaseView")
- require("game.vip.view.RechargeView")
- require("game.vip.view.RechargeItem")
- require("game.vip.view.CustomRechargeView")
- require("game.vip.view.VipNobleViewNew")--vip特权界面
- require("game.vip.view.VipNobleTab")--贵族页签
- require("game.vip.view.VipNobleBuyGiftView")--vip贵族礼包购买提示界面
- require("game.vip.view.VipExperienceView")--VIP体验界面
- require("game.vip.view.VipNobleShowView")--VIP特权界面
- require("game.vip.view.VipNobleShowItem")--VIP特权界面Item
- require("game.vip.view.VipShowSkillEffectView")--VIP特权技能界面
- require("game.vip.view.VipExperienceVThreeView")--VIP体验贵族V3界面
- require("game.vip.view.VipExperienceVThreeExView")--VIP体验贵族V3信息查看界面
-
-
- --直购礼包
- require("game.vip.view.VipPurchaseGiftView")--直购礼包界面
- require("game.vip.view.VipPurchaseGiftTab")--直购礼包Tab
- require("game.vip.view.VipPurchaseGiftItem")--直购礼包Item
-
- -- 投资计划
- require("game.vip.investmentPlan.InvestmentPlanView") -- 投资计划主界面
- require("game.vip.investmentPlan.InvestmentPlanTabItem") -- 投资计划主界面投资类型页签
- require("game.vip.investmentPlan.InvestmentPlanItem") -- 投资计划主界面item节点
-
- --幻魔UP卡
- require("game.vip.view.VipCardView") --幻魔UP卡界面
- require("game.vip.view.VipCardItem") --幻魔UP卡条目
-
-
- VipController = VipController or BaseClass(BaseController)
- function VipController:__init()
- VipController.Instance = self
- self.model = VipModel:getInstance()
-
- self:InitEvent()
- self:registerAllProtocals()
- self:EnableCheckoutClear()
- end
-
- function VipController:RemoveCheckOutEvent()
-
- end
-
- function VipController:getInstance()
- if VipController.Instance == nil then
- VipController.New()
- end
- return VipController.Instance
- end
-
- function VipController:InitEvent()
- local function onRequestHandler(...)
- local args = {...}
- if args[1] == 45006 then
- self:SendFmtToGame(args[1],"h",args[2])
-
- elseif args[1] == 15903 or args[1] == 42002 or args[1] == 45008 or args[1] == 45009 then
- self:SendFmtToGame(args[1],"c",args[2])
- elseif args[1] == 42003 then
- self:SendFmtToGame(args[1],"cc", args[2], args[3])
- elseif args[1] == 15904 then
- self:SendFmtToGame(args[1],"i",args[2])
- elseif args[1] == 15902 then
- self:SendFmtToGame(args[1],"i",args[2])
- elseif args[1] == 15803 then
- self:SendFmtToGame(args[1],"iic",args[2],args[3],args[4])
- else
- self:SendFmtToGame(args[1])
- end
- end
- self.model:Bind(VipModel.REQUEST_CCMD_EVENT, onRequestHandler)
-
- local game_start = function (level)
- --vip特权
- if GetModuleIsOpen(450,VipModel.TabType.Noble) and (level == nil or GetModuleOpenLevel(450,VipModel.TabType.Noble) == level ) then
- -- self:SendFmtToGame(15901)
- -- self:SendFmtToGame(15951)
- self:SendFmtToGame(15802)
- self:SendFmtToGame(45001)
- self:SendFmtToGame(45005)
- end
-
- if GetModuleIsOpen(159,4) and (level == nil or GetModuleOpenLevel(159,4) == level ) then
- self.model:Fire(VipModel.REQUEST_CCMD_EVENT, 15903, VipModel.Type.PurchaseGift)
- end
-
- --幻魔UP卡
- if GetModuleIsOpen(159,1) and (level == nil or GetModuleOpenLevel(159,1) == level ) then
- self.model:RequstVipCarInfo()
- end
-
- -- 投资计划
- if GetModuleIsOpen(420, 1) and (level == nil or GetModuleOpenLevel(420, 1) == level ) then
- self:SendFmtToGame(42001)
- end
-
- --客服信息
- self:SendFmtToGame(45004)
- end
- GlobalEventSystem:Bind(EventName.GAME_START, game_start)
-
-
- local function onTaskFinishHandler(taskId)
- for i,v in ipairs(CustomActivityModel.VIP_THREE_TASK_ID_LIST) do
- if v == taskId and RoleManager.Instance.mainRoleInfo.vip_flag < 3 then
- self.model:Fire(VipModel.OPEN_EXPERIENCE_V_THREE_VIEW)
- break
- end
- end
-
- if taskId == CustomActivityModel.VIP_EX_CARD_TASK_ID then--这个任务是做VIP体验卡的任务
- local vip_info = self.model.vip_info
- if vip_info and vip_info.vip_endtime and vip_info.vip_endtime - TimeUtil:getServerTime( ) <= 0 and RoleManager.Instance.mainRoleInfo.vip_flag > 0 then
-
- else--非VIP才停止
- GlobalEventSystem:Fire(EventName.STOP_AUTO_DO_TASK) --停止自动任务
- GlobalEventSystem:Fire(EventName.STOPAUTOFIGHT)--停止挂机
- end
- end
- end
- GlobalEventSystem:Bind(TaskEvent.ANS_FINISHED_TASK_LIST, onTaskFinishHandler)
-
- --升级
- local function onLevelUp(level)
- game_start(level)
- -- 升级刷新一下投资红点
- self.model:RefreshInvestmentViewDataRed()
- end
- RoleManager.Instance.mainRoleInfo:Bind(EventName.CHANGE_LEVEL, onLevelUp)
-
- local function changeDayFunc( type )
- if type == 0 then
- if GetModuleIsOpen(159,4) and (level == nil or GetModuleOpenLevel(159,4) == level ) then
- self.model:Fire(VipModel.REQUEST_CCMD_EVENT, 15903, VipModel.Type.PurchaseGift)
- end
-
- -- 跨天刷新一下投资红点
- local function delay_method( )
- self.model:RefreshInvestmentViewDataRed()
- end
- -- 最好做一个延时刷新
- setTimeout(delay_method, 5)
-
- if GetModuleIsOpen(159,1) then
- self.model:RequstVipCarInfo()
- end
- if self.model.vip_info and self.model.vip_info.vip_lv and self.model.vip_info.vip_lv<= 3 then
- VipModel:getInstance():Fire(VipModel.REQUEST_CCMD_EVENT, 45010)
- end
- end
- end
- GlobalEventSystem:Bind(EventName.CHANE_DAY, changeDayFunc)
-
- local onOpenVipView = function (tab_index, sub_index,is_close)
- if ClientConfig.alpha_mode then return end
- if is_close and self.VipBaseView and self.VipBaseView:HasOpen() then
- self.VipBaseView:Close(is_close)
- return
- end
- local tabIndex = tab_index
- local subIndex = sub_index
- if type(tab_index) == "table" then
- tabIndex = tab_index[1]
- subIndex = tab_index[2]
- end
- if self.VipBaseView == nil then
- self.VipBaseView = VipBaseView.New()
- end
- if not self.VipBaseView:HasOpen() then
- self.VipBaseView:Open(tabIndex, subIndex)
- else
- self.VipBaseView:UpdateView(tabIndex, subIndex)
- end
- -------------------------
- --彩钻复制机防重叠套娃界面
- KfActivityModel:getInstance():Fire(KfActivityModel.OPEN_MONEY_COPY_VIEW,nil,true)
- if OperateActivityController and OperateActivityController.Instance and OperateActivityController.Instance.opreversirefreshtip then
- OperateActivityController.Instance.opreversirefreshtip:Close()
- end
- end
- GlobalEventSystem:Bind(EventName.OPEN_VIP_VIEW, onOpenVipView)
-
- local onOpenCustomRechargeView = function ()
- if self.custom_recharge_view == nil then
- self.custom_recharge_view = CustomRechargeView.New()
- end
- if self.custom_recharge_view:HasOpen() then
- self.custom_recharge_view:Close()
- else
- self.custom_recharge_view:Open()
- end
- end
- self.model:Bind(VipModel.OPEN_CUSTOM_RECHARGE_VIEW, onOpenCustomRechargeView)
-
- local onOpenVipNobleBuyGiftView = function (view_data)
- if not view_data then return end
- if self.VipNobleBuyGiftView == nil then
- self.VipNobleBuyGiftView = VipNobleBuyGiftView.New()
- end
- if self.VipNobleBuyGiftView:HasOpen() then
- self.VipNobleBuyGiftView:Close()
- else
- self.VipNobleBuyGiftView:Open(view_data)
- end
- end
- self.model:Bind(VipModel.OPEN_NOBLE_BUY_VIEW, onOpenVipNobleBuyGiftView)
-
- local onOpenVipExperienceView = function (open_type,is_close)--VIP体验界面
- print("huangcong:VipController [208] : ",open_type,debug.traceback())
- if is_close and self.vip_experience_view and self.vip_experience_view:HasOpen() then
- self.vip_experience_view:Close()
- return
- end
- if self.vip_experience_view == nil then
- self.vip_experience_view = VipExperienceView.New()
- end
- if self.vip_experience_view:HasOpen() then
- -- self.vip_experience_view:Close()
- else
- self.vip_experience_view:Open(open_type)
- end
- end
- self.model:Bind(VipModel.OPEN_EXPERIENCE_VIEW, onOpenVipExperienceView)
-
-
- local onOpenVipExperienceVThreeView = function (is_close)--VIP体验贵族V3界面
- if is_close then
- if self.vip_experience_v_three_view and self.vip_experience_v_three_view:HasOpen() then
- self.vip_experience_v_three_view:Close()
- end
- return
- end
- if self.vip_experience_v_three_view == nil then
- self.vip_experience_v_three_view = VipExperienceVThreeView.New()
- end
- if self.vip_experience_v_three_view:HasOpen() then
- -- self.vip_experience_v_three_view:Close()
- else
- self.vip_experience_v_three_view:Open()
- end
- end
- self.model:Bind(VipModel.OPEN_EXPERIENCE_V_THREE_VIEW, onOpenVipExperienceVThreeView)
-
- local onOpenVipExperienceVThreeExView = function (index,is_close)--VIP体验贵族V3详情界面
- if is_close then
- if self.vip_experience_v_three_ex_view and self.vip_experience_v_three_ex_view:HasOpen() then
- self.vip_experience_v_three_ex_view:Close()
- end
- return
- end
- if self.vip_experience_v_three_ex_view == nil then
- self.vip_experience_v_three_ex_view = VipExperienceVThreeExView.New()
- end
- if self.vip_experience_v_three_ex_view:HasOpen() then
- -- self.vip_experience_v_three_ex_view:Close()
- else
- self.vip_experience_v_three_ex_view:Open(index)
- end
- end
- self.model:Bind(VipModel.OPEN_EXPERIENCE_V_THREE_EX_VIEW, onOpenVipExperienceVThreeExView)
-
- local onOpenVipNobleShowView = function (vip_lv)--VIP特权界面
- if self.VipNobleShowView == nil then
- self.VipNobleShowView = VipNobleShowView.New()
- end
- if self.VipNobleShowView:HasOpen() then
- -- self.VipNobleShowView:Close()
- else
- self.VipNobleShowView:Open(vip_lv)
- end
- end
- self.model:Bind(VipModel.OPEN_VIP_NOBLE_VIEW, onOpenVipNobleShowView)
-
-
- local onOpenVipShowSkillEffectView = function (skill_id, vip_lv)--VIP特权界面
- if self.VipShowSkillEffectView == nil then
- self.VipShowSkillEffectView = VipShowSkillEffectView.New()
- end
- if self.VipShowSkillEffectView:HasOpen() then
- -- self.VipNobleShowView:Close()
- else
- self.VipShowSkillEffectView:Open(skill_id, vip_lv)
- end
- end
- self.model:Bind(VipModel.OPEN_VIP_SKILL_EFFECT_VIEW, onOpenVipShowSkillEffectView)
-
- local onVIPChange = function ()
- self.model:IsNeedRed(VipModel.TabType.PurchaseGift)
- end
- RoleManager:getInstance().mainRoleInfo:BindOne("vip_flag", onVIPChange)
- end
-
- function VipController:registerAllProtocals()
- --VIP
- self:RegisterProtocal(45000,"handle45000")--错误码
- self:RegisterProtocal(45001,"handle45001")--获得角色vip信息
- self:RegisterProtocal(45002,"handle45002")--使用充值卡激活vip(直接扣钻石)
- self:RegisterProtocal(45003,"handle45003")--VIP到期提醒
- self:RegisterProtocal(45004,"handle45004")--客服信息
- self:RegisterProtocal(45005,"handle45005")--vip专属礼包信息
- self:RegisterProtocal(45006,"handle45006")--购买vip专属礼包
- self:RegisterProtocal(45007,"handle45007")--vip专属礼包查看信息
- self:RegisterProtocal(45008,"handle45008")--查看vip专属礼包
- self:RegisterProtocal(45009,"handle45009")--领取VIP等级礼包
- self:RegisterProtocal(45010,"handle45010")--查看V3每日引导礼包
- self:RegisterProtocal(45011,"handle45011")--领取V3每日引导礼包
-
-
- --充值
- self:RegisterProtocal(15800,"handle15800")--充值界面信息
- self:RegisterProtocal(15801,"handle15801")--充值返利信息
- self:RegisterProtocal(15899,"handle15899")--充值秘籍(封测阶段)
- self:RegisterProtocal(15802,"handle15802")--充值记录(客户端用于判断是否激活超级客服)
- self:RegisterProtocal(15803,"handle15803")--快速充值信息提交
-
- self:RegisterProtocal(15903,"handle15903")
- self:RegisterProtocal(15904,"handle15904") --商品购买检查
-
- -- 投资计划相关
- self:RegisterProtocal(42000, "handle42000") -- 投资计划错误码
- self:RegisterProtocal(42001, "handle42001") -- 投资信息:已投资信息
- self:RegisterProtocal(42002, "handle42002") -- 投资
- self:RegisterProtocal(42003, "handle42003") -- 投资领奖
-
- --幻魔UP卡
- self:RegisterProtocal(15901,"handle15901") --查看福利卡
- self:RegisterProtocal(15902,"handle15902") --领取福利卡福利
-
- -- --充值活动
-
- -- self:RegisterProtocal(15951,"handle15951")
- -- self:RegisterProtocal(15952,"handle15952")
- -- self:RegisterProtocal(15953,"handle15953")
- end
-
- -- ########### 错误码 ###############
- -- protocol=45000
- -- {
- -- s2c{
- -- res :int32 // 错误码
- -- }
- -- }
- function VipController:handle45000()
- local scmd = SCMD45000.New(true)
- -- print("45000scmd", scmd.res)
- -- ErrorCodeShow(scmd.res)
- end
-
- -- ############## 获得角色vip信息 ##############
- -- protocol=45001
- -- {
- -- c2s{
- -- }
- -- s2c{
- -- vip_lv :int16 // 当前vip等级
- -- experience_vip_lv :int16 // 体验vip等级
- -- vip_exp :int32 // 当前vip等级经验
- -- vip_endtime :int32 // Vip体验卡到期时间
- -- vip_award_list:array{
- -- not_got :int8 //尚未领取奖励的vip等级礼包
- -- }
- -- }
- -- }
- function VipController:handle45001()
- local scmd = SCMD45001.New(true)
- print("45001scmd", scmd.res)
- PrintTable(scmd)
- self.model:UpdateVipInfomation(scmd)
- self.model:Fire(VipModel.REQUEST_CCMD_EVENT,45005)
- SupremeVipModel:getInstance():Fire(SupremeVipConst.REQUEST_CCMD_EVENT,45101)--请求自己的贵族信息
-
- --达到能用小飞鞋的vip等级时,自动勾选设置中的“自动使用小飞鞋”一项
- if not lua_settingM:GetAutoFlyShoeSet() and self.model:CanFreeUseShoe() then
- lua_settingM:SetAutoFlyShoeSet(true)
- end
- end
-
- -- ################## 使用充值卡激活vip(直接扣钻石) ######################
- -- ## 注:充值成功后服务端会主动推送45001
- -- protocol = 45002
- -- {
- -- c2s{
- -- card_type :int32 // 激活vip类型(卡片类型)
- -- }
- -- s2c{
- -- res :int32 // 操作码
- -- }
- -- }
- function VipController:handle45002()
- local scmd = SCMD45002.New(true)
- if scmd.res == 1 then
- Message.show("购买成功")
- else
- ErrorCodeShow(scmd.res)
- end
- end
-
- -- ################## VIP到期提醒 ######################
- -- protocol = 45003
- -- {
- -- c2s{
- -- }
- -- s2c{
- -- res :int32 // 操作码 1-体验卡到期
- -- }
- -- }
- function VipController:handle45003()
- local scmd = SCMD45003.New(true)
- if scmd.res == 1 then
- Message.show("您的体验卡已到期!","fault")
- VipModel:getInstance():Fire(VipModel.OPEN_EXPERIENCE_VIEW,2)
- RoleManager.Instance.mainRoleInfo:ChangeVar("angry_value", 0, false, true)
- end
- self.model:Fire(VipModel.REQUEST_CCMD_EVENT,45001)
- end
-
- -- ########### 客服信息 ##############
- -- protocol = 45004
- -- {
- -- c2s{
- -- }
- -- s2c{
- -- display :int8 // 1:显示 0:隐藏
- -- display_code :int8 // 是否显示二维码
- -- medium :string // 渠道
- -- link_info_1 :string // 联系方式1
- -- link_info_2 :string // 联系方式2
- -- code_path :string // 二维码路径
- -- remark :string // 客服信息
- -- work_time :string // 工作时间
- -- }
- -- }
- function VipController:handle45004()
- local scmd = SCMD45004.New(true)
- --print("45004scmd", scmd.res)
- --PrintTable(scmd)
- self.model:SetServiceData(scmd)
- end
-
- -- ############ vip专属礼包信息 ##########
- -- protocol = 45005
- -- {
- -- c2s{
- -- }
- -- s2c{
- -- list:array{
- -- vip_lv :int8 //礼包id
- -- state :int8 //0不可购买, 1可购买, 2已购买
- -- }
- -- }
- -- }
- function VipController:handle45005()
- local scmd = SCMD45005.New(true)
- -- print("SCMD45005", scmd)
- -- PrintTable(scmd)
- self.model:SetVipGiftInfo(scmd.list)
- end
-
- -- ############ 购买vip专属礼包 ##########
- -- protocol = 45006
- -- {
- -- c2s{
- -- vip_lv :int16 // 当前vip等级
- -- }
- -- s2c{
- -- res :int8 // 1:成功
- -- reward_list :arr_object_list // 奖励列表
- -- }
- -- }
- function VipController:handle45006()
- local scmd = SCMD45006.New(true)
- -- print("SCMD45006", scmd)
- -- PrintTable(scmd)
- if scmd.res == 1 then
- Message.show("购买成功","success")
- -- self.model:Fire(VipModel.OPEN_RESULT_VIEW,scmd.goods_list)
- self.model:Fire(VipModel.REQUEST_CCMD_EVENT,45005)
- else
- ErrorCodeShow(scmd.res)
- end
- end
-
- -- ################## 领取VIP等级礼包 ######################
- -- protocol = 45009
- -- {
- -- c2s{
- -- vip_lv : int8 //VIP等级
- -- }
- -- s2c{
- -- res :int32 // 操作码
- -- vip_lv : int8 //VIP等级
- -- rewards:array{
- -- goods_type:int16
- -- goods_id:int32
- -- num:32
- -- }
- -- }
- -- }
- function VipController:handle45009()
- local scmd = SCMD45009.New(true)
- print("SCMD45009", scmd)
- PrintTable(scmd)
- if scmd.res == 1 then
- local new_award_list = {}
- for n,l in ipairs(scmd.rewards) do
- new_award_list[#new_award_list + 1] = {l.goods_type, l.goods_id, l.num}
- end
- if #new_award_list > 0 then
- GiftModel:getInstance():Fire(GiftModel.OPEN_SHOW_ACT_GOODS_VIEW, new_award_list)
- end
- Message.show("领取成功","success")
- self.model:Fire(VipModel.REQUEST_CCMD_EVENT,45001)
- else
- ErrorCodeShow(scmd.res)
- end
- end
-
- -- ############ 查看V3每日引导礼包 ##########
- -- protocol = 45010
- -- {
- -- c2s{
- -- }
- -- s2c{
- -- state:int8 //1是可领取2是已领取
- -- }
- -- }
-
- function VipController:handle45010()
- local scmd = SCMD45010.New(true)
- print("SCMD45010", scmd)
- PrintTable(scmd)
- self.model.vip_three_award_state = scmd.state
- self.model:Fire(VipModel.UPDATE_EXPERIENCE_V_THREE_EX_RED)
- end
-
- -- ################## 领取V3每日引导礼包 ######################
- -- protocol = 45011
- -- {
- -- c2s{
- -- }
- -- s2c{
- -- res :int32 // 操作码1领取成功
- -- }
- -- }
- function VipController:handle45011()
- local scmd = SCMD45011.New(true)
- print("SCMD45011", scmd)
- PrintTable(scmd)
- if scmd.res == 1 then
- Message.show("领取成功","success")
- self.model.vip_three_award_state = 2
- self.model:Fire(VipModel.UPDATE_EXPERIENCE_V_THREE_EX_RED)
- else
- ErrorCodeShow(scmd.res)
- end
- end
-
-
- -- ########### 充值界面信息 ##########
- -- protocol=15800
- -- {
- -- c2s{
- -- }
- -- s2c{
- -- product_list:array{
- -- product_id :int32 //商品id
- -- return_type :int8 //返利类型 (0无返利|1终生首次|2活动时间首次)
- -- }
- -- }
- -- }
- function VipController:handle15800()
- local scmd = SCMD15800.New(true)
- -- print("huangcong:VipController [start:275] scmd:", scmd)
- -- PrintTable(scmd)
- -- print("huangcong:VipController [end]")
- self.model:SetRechargeCardData(scmd)
- end
-
- function VipController:handle15801()
- local scmd = SCMD15801.New(true)
- Message.show("充值成功")
- self.model:Fire(VipModel.UPDATE_RECHARGE_ITEM_DATA, scmd)
- end
-
- function VipController:handle15899()
- local scmd = SCMD15899.New(true)
- if scmd.res == 1 then
-
- else
- ErrorCodeShow(scmd.res)
- end
- end
-
- function VipController:handle15802()
- local scmd = SCMD15802.New(true)
- self.model:SetSuperVipOpenData(scmd)
- end
-
- function VipController:handle15803( )
- local scmd = SCMD15803.New(true)
- if scmd.res ~= 1 then
- ErrorCodeShow(scmd.res)
- end
- end
-
- function VipController:handle15901()
- local scmd = SCMD15901.New(true)
- PrintTable(scmd)
- self.model:SetVipCarDayReward(scmd)
- end
-
- function VipController:handle15902()
- local scmd = SCMD15902.New(true)
- if scmd.errcode == 1 then
-
- else
- ErrorCodeShow(scmd.errcode)
- end
- end
-
- -- ########### 商品信息 ##########
- -- protocol=15903
- -- {
- -- c2s{
- -- product_type :int8
- -- // 1普通充值(含充值返利)
- -- // 2福利卡
- -- // 3每日礼包
- -- // 4直购礼包
- -- // 5首充奖励
- -- }
- -- s2c{
- -- product_type :int8
- -- product_list:array{
- -- product_id :int32// 商品id
- -- buy_counts :int32// 已购次数:对于有限购配置的才有效,其余均为0
- -- }
- -- time_list:array{
- -- sub_type :int32// 子类型 日 周 月 首充 不同类型的礼包
- -- end_time :int32// 结束时间
- -- }
- -- }
- -- }
- function VipController:handle15903()
- local scmd = SCMD15903.New(true)
- self.model:SetProductInfo(scmd)
- self.model:IsNeedRed(VipModel.TabType.PurchaseGift)
- end
-
- -- ########### 商品购买检查 ##########
- -- protocol=15904
- -- {
- -- c2s{
- -- product_id :int32 //商品id
- -- }
- -- s2c{
- -- product_id :int32 //商品id
- -- errcode :int32 //1成功可以购买|其他错误码
- -- }
- -- }
- function VipController:handle15904()
- local scmd = SCMD15904.New(true)
- -- print("huangcong:VipController [start:386] :", scmd)
- -- PrintTable(scmd)
- -- print("huangcong:VipController [end]")
- if scmd.errcode == 1 then
- if AppConst.UpdateMode then
- local callback = function(state)
- end
- local product_cfg = Config.Rechargeproduct[scmd.product_id]
- if not product_cfg then
- Message.show("没有商品配置"..scmd.product_id)
- end
- local custom_info = {
- pay_title = Trim(product_cfg.product_name),
- id = scmd.product_id,
- }
- PlatformMgr:getInstance():PayRequest(product_cfg.money, custom_info, callback)
- else
- local text = "recharge_" .. scmd.product_id
- print("点击充值卡,通过秘籍购买直购礼包====:", text)
- CheatModel:getInstance():Fire(CheatModel.SEND_CHEAT_TO_SERVER, text)
- end
- else
- ErrorCodeShow(scmd.errcode)
- end
- end
-
- -- 投资计划相关协议
- function VipController:handle42000( )
- local vo = SCMD42000.New(true)
- if vo.code ~= 1 then
- ErrorCodeShow(vo.code, vo.args)
- end
- end
-
- function VipController:handle42001( )
- local vo = SCMD42001.New(true)
- self.model:SetInvestmentData(vo)
- -- 特殊处理后不在这边更新了
- -- self.model:IsNeedRed(VipModel.TabType.Investment)
- -- self.model:Fire(VipModel.UPDATE_INVESTMENT_DATA)
- end
-
- function VipController:handle42002( )
- local vo = SCMD42002.New(true)
- if vo.res == 1 then
- -- 成功会主推42001,失败走42000错误码
- Message.show("投资成功")
- end
- end
-
- function VipController:handle42003( )
- local vo = SCMD42003.New(true)
- self.model:UpdateInvestmentRewardId(vo)
- self.model:IsNeedRed(VipModel.TabType.Investment)
- self.model:Fire(VipModel.UPDATE_INVESTMENT_DATA, vo.type)
- end
-
- -- ############ vip专属礼包查看信息 ##########
- -- protocol = 45007
- -- {
- -- c2s{
- -- }
- -- s2c{
- -- list:array{
- -- vip_lv :int8 //vip等级
- -- }
- -- }
- -- }
- function VipController:handle45007()
- local scmd = SCMD45007.New(true)
- -- print("huangcong:VipController [start:514] :", scmd)
- -- PrintTable(scmd)
- -- print("huangcong:VipController [end]")
- self.model:SetVipGiftFindInfo(scmd)
- self.model:IsNeedRed(VipModel.TabType.Noble)
- end
-
- -- ############ 查看vip专属礼包 ##########
- -- protocol = 45008
- -- {
- -- c2s{
- -- vip_lv :int8 //vip等级
- -- }
- -- s2c{
- -- res :int32 // 1:成功
- -- }
- -- }
- function VipController:handle45008()
- local scmd = SCMD45008.New(true)
- if scmd.res == 1 then
- self.model:Fire(VipModel.REQUEST_CCMD_EVENT,45007)
- else
- -- ErrorCodeShow(scmd.res)
- end
- end
|