源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

766 regels
23 KiB

4 weken geleden
  1. --[[@------------------------------------------------------------------
  2. @description:VIP
  3. @author:huangcong
  4. ----------------------------------------------------------------------]]
  5. require("game.proto.450.Require450")
  6. require("game.proto.158.Require158")
  7. require("game.proto.420.Require420")
  8. require("game.vip.VipModel")
  9. require("game.vip.VipConst")
  10. require("game.vip.view.VipBaseView")
  11. require("game.vip.view.RechargeView")
  12. require("game.vip.view.RechargeItem")
  13. require("game.vip.view.CustomRechargeView")
  14. require("game.vip.view.VipNobleViewNew")--vip特权界面
  15. require("game.vip.view.VipNobleTab")--贵族页签
  16. require("game.vip.view.VipNobleBuyGiftView")--vip贵族礼包购买提示界面
  17. require("game.vip.view.VipExperienceView")--VIP体验界面
  18. require("game.vip.view.VipNobleShowView")--VIP特权界面
  19. require("game.vip.view.VipNobleShowItem")--VIP特权界面Item
  20. require("game.vip.view.VipShowSkillEffectView")--VIP特权技能界面
  21. require("game.vip.view.VipExperienceVThreeView")--VIP体验贵族V3界面
  22. require("game.vip.view.VipExperienceVThreeExView")--VIP体验贵族V3信息查看界面
  23. --直购礼包
  24. require("game.vip.view.VipPurchaseGiftView")--直购礼包界面
  25. require("game.vip.view.VipPurchaseGiftTab")--直购礼包Tab
  26. require("game.vip.view.VipPurchaseGiftItem")--直购礼包Item
  27. -- 投资计划
  28. require("game.vip.investmentPlan.InvestmentPlanView") -- 投资计划主界面
  29. require("game.vip.investmentPlan.InvestmentPlanTabItem") -- 投资计划主界面投资类型页签
  30. require("game.vip.investmentPlan.InvestmentPlanItem") -- 投资计划主界面item节点
  31. --幻魔UP卡
  32. require("game.vip.view.VipCardView") --幻魔UP卡界面
  33. require("game.vip.view.VipCardItem") --幻魔UP卡条目
  34. VipController = VipController or BaseClass(BaseController)
  35. function VipController:__init()
  36. VipController.Instance = self
  37. self.model = VipModel:getInstance()
  38. self:InitEvent()
  39. self:registerAllProtocals()
  40. self:EnableCheckoutClear()
  41. end
  42. function VipController:RemoveCheckOutEvent()
  43. end
  44. function VipController:getInstance()
  45. if VipController.Instance == nil then
  46. VipController.New()
  47. end
  48. return VipController.Instance
  49. end
  50. function VipController:InitEvent()
  51. local function onRequestHandler(...)
  52. local args = {...}
  53. if args[1] == 45006 then
  54. self:SendFmtToGame(args[1],"h",args[2])
  55. elseif args[1] == 15903 or args[1] == 42002 or args[1] == 45008 or args[1] == 45009 then
  56. self:SendFmtToGame(args[1],"c",args[2])
  57. elseif args[1] == 42003 then
  58. self:SendFmtToGame(args[1],"cc", args[2], args[3])
  59. elseif args[1] == 15904 then
  60. self:SendFmtToGame(args[1],"i",args[2])
  61. elseif args[1] == 15902 then
  62. self:SendFmtToGame(args[1],"i",args[2])
  63. elseif args[1] == 15803 then
  64. self:SendFmtToGame(args[1],"iic",args[2],args[3],args[4])
  65. else
  66. self:SendFmtToGame(args[1])
  67. end
  68. end
  69. self.model:Bind(VipModel.REQUEST_CCMD_EVENT, onRequestHandler)
  70. local game_start = function (level)
  71. --vip特权
  72. if GetModuleIsOpen(450,VipModel.TabType.Noble) and (level == nil or GetModuleOpenLevel(450,VipModel.TabType.Noble) == level ) then
  73. -- self:SendFmtToGame(15901)
  74. -- self:SendFmtToGame(15951)
  75. self:SendFmtToGame(15802)
  76. self:SendFmtToGame(45001)
  77. self:SendFmtToGame(45005)
  78. end
  79. if GetModuleIsOpen(159,4) and (level == nil or GetModuleOpenLevel(159,4) == level ) then
  80. self.model:Fire(VipModel.REQUEST_CCMD_EVENT, 15903, VipModel.Type.PurchaseGift)
  81. end
  82. --幻魔UP卡
  83. if GetModuleIsOpen(159,1) and (level == nil or GetModuleOpenLevel(159,1) == level ) then
  84. self.model:RequstVipCarInfo()
  85. end
  86. -- 投资计划
  87. if GetModuleIsOpen(420, 1) and (level == nil or GetModuleOpenLevel(420, 1) == level ) then
  88. self:SendFmtToGame(42001)
  89. end
  90. --客服信息
  91. self:SendFmtToGame(45004)
  92. end
  93. GlobalEventSystem:Bind(EventName.GAME_START, game_start)
  94. local function onTaskFinishHandler(taskId)
  95. for i,v in ipairs(CustomActivityModel.VIP_THREE_TASK_ID_LIST) do
  96. if v == taskId and RoleManager.Instance.mainRoleInfo.vip_flag < 3 then
  97. self.model:Fire(VipModel.OPEN_EXPERIENCE_V_THREE_VIEW)
  98. break
  99. end
  100. end
  101. if taskId == CustomActivityModel.VIP_EX_CARD_TASK_ID then--这个任务是做VIP体验卡的任务
  102. local vip_info = self.model.vip_info
  103. if vip_info and vip_info.vip_endtime and vip_info.vip_endtime - TimeUtil:getServerTime( ) <= 0 and RoleManager.Instance.mainRoleInfo.vip_flag > 0 then
  104. else--非VIP才停止
  105. GlobalEventSystem:Fire(EventName.STOP_AUTO_DO_TASK) --停止自动任务
  106. GlobalEventSystem:Fire(EventName.STOPAUTOFIGHT)--停止挂机
  107. end
  108. end
  109. end
  110. GlobalEventSystem:Bind(TaskEvent.ANS_FINISHED_TASK_LIST, onTaskFinishHandler)
  111. --升级
  112. local function onLevelUp(level)
  113. game_start(level)
  114. -- 升级刷新一下投资红点
  115. self.model:RefreshInvestmentViewDataRed()
  116. end
  117. RoleManager.Instance.mainRoleInfo:Bind(EventName.CHANGE_LEVEL, onLevelUp)
  118. local function changeDayFunc( type )
  119. if type == 0 then
  120. if GetModuleIsOpen(159,4) and (level == nil or GetModuleOpenLevel(159,4) == level ) then
  121. self.model:Fire(VipModel.REQUEST_CCMD_EVENT, 15903, VipModel.Type.PurchaseGift)
  122. end
  123. -- 跨天刷新一下投资红点
  124. local function delay_method( )
  125. self.model:RefreshInvestmentViewDataRed()
  126. end
  127. -- 最好做一个延时刷新
  128. setTimeout(delay_method, 5)
  129. if GetModuleIsOpen(159,1) then
  130. self.model:RequstVipCarInfo()
  131. end
  132. if self.model.vip_info and self.model.vip_info.vip_lv and self.model.vip_info.vip_lv<= 3 then
  133. VipModel:getInstance():Fire(VipModel.REQUEST_CCMD_EVENT, 45010)
  134. end
  135. end
  136. end
  137. GlobalEventSystem:Bind(EventName.CHANE_DAY, changeDayFunc)
  138. local onOpenVipView = function (tab_index, sub_index,is_close)
  139. if ClientConfig.alpha_mode then return end
  140. if is_close and self.VipBaseView and self.VipBaseView:HasOpen() then
  141. self.VipBaseView:Close(is_close)
  142. return
  143. end
  144. local tabIndex = tab_index
  145. local subIndex = sub_index
  146. if type(tab_index) == "table" then
  147. tabIndex = tab_index[1]
  148. subIndex = tab_index[2]
  149. end
  150. if self.VipBaseView == nil then
  151. self.VipBaseView = VipBaseView.New()
  152. end
  153. if not self.VipBaseView:HasOpen() then
  154. self.VipBaseView:Open(tabIndex, subIndex)
  155. else
  156. self.VipBaseView:UpdateView(tabIndex, subIndex)
  157. end
  158. -------------------------
  159. --彩钻复制机防重叠套娃界面
  160. KfActivityModel:getInstance():Fire(KfActivityModel.OPEN_MONEY_COPY_VIEW,nil,true)
  161. if OperateActivityController and OperateActivityController.Instance and OperateActivityController.Instance.opreversirefreshtip then
  162. OperateActivityController.Instance.opreversirefreshtip:Close()
  163. end
  164. end
  165. GlobalEventSystem:Bind(EventName.OPEN_VIP_VIEW, onOpenVipView)
  166. local onOpenCustomRechargeView = function ()
  167. if self.custom_recharge_view == nil then
  168. self.custom_recharge_view = CustomRechargeView.New()
  169. end
  170. if self.custom_recharge_view:HasOpen() then
  171. self.custom_recharge_view:Close()
  172. else
  173. self.custom_recharge_view:Open()
  174. end
  175. end
  176. self.model:Bind(VipModel.OPEN_CUSTOM_RECHARGE_VIEW, onOpenCustomRechargeView)
  177. local onOpenVipNobleBuyGiftView = function (view_data)
  178. if not view_data then return end
  179. if self.VipNobleBuyGiftView == nil then
  180. self.VipNobleBuyGiftView = VipNobleBuyGiftView.New()
  181. end
  182. if self.VipNobleBuyGiftView:HasOpen() then
  183. self.VipNobleBuyGiftView:Close()
  184. else
  185. self.VipNobleBuyGiftView:Open(view_data)
  186. end
  187. end
  188. self.model:Bind(VipModel.OPEN_NOBLE_BUY_VIEW, onOpenVipNobleBuyGiftView)
  189. local onOpenVipExperienceView = function (open_type,is_close)--VIP体验界面
  190. print("huangcong:VipController [208] : ",open_type,debug.traceback())
  191. if is_close and self.vip_experience_view and self.vip_experience_view:HasOpen() then
  192. self.vip_experience_view:Close()
  193. return
  194. end
  195. if self.vip_experience_view == nil then
  196. self.vip_experience_view = VipExperienceView.New()
  197. end
  198. if self.vip_experience_view:HasOpen() then
  199. -- self.vip_experience_view:Close()
  200. else
  201. self.vip_experience_view:Open(open_type)
  202. end
  203. end
  204. self.model:Bind(VipModel.OPEN_EXPERIENCE_VIEW, onOpenVipExperienceView)
  205. local onOpenVipExperienceVThreeView = function (is_close)--VIP体验贵族V3界面
  206. if is_close then
  207. if self.vip_experience_v_three_view and self.vip_experience_v_three_view:HasOpen() then
  208. self.vip_experience_v_three_view:Close()
  209. end
  210. return
  211. end
  212. if self.vip_experience_v_three_view == nil then
  213. self.vip_experience_v_three_view = VipExperienceVThreeView.New()
  214. end
  215. if self.vip_experience_v_three_view:HasOpen() then
  216. -- self.vip_experience_v_three_view:Close()
  217. else
  218. self.vip_experience_v_three_view:Open()
  219. end
  220. end
  221. self.model:Bind(VipModel.OPEN_EXPERIENCE_V_THREE_VIEW, onOpenVipExperienceVThreeView)
  222. local onOpenVipExperienceVThreeExView = function (index,is_close)--VIP体验贵族V3详情界面
  223. if is_close then
  224. if self.vip_experience_v_three_ex_view and self.vip_experience_v_three_ex_view:HasOpen() then
  225. self.vip_experience_v_three_ex_view:Close()
  226. end
  227. return
  228. end
  229. if self.vip_experience_v_three_ex_view == nil then
  230. self.vip_experience_v_three_ex_view = VipExperienceVThreeExView.New()
  231. end
  232. if self.vip_experience_v_three_ex_view:HasOpen() then
  233. -- self.vip_experience_v_three_ex_view:Close()
  234. else
  235. self.vip_experience_v_three_ex_view:Open(index)
  236. end
  237. end
  238. self.model:Bind(VipModel.OPEN_EXPERIENCE_V_THREE_EX_VIEW, onOpenVipExperienceVThreeExView)
  239. local onOpenVipNobleShowView = function (vip_lv)--VIP特权界面
  240. if self.VipNobleShowView == nil then
  241. self.VipNobleShowView = VipNobleShowView.New()
  242. end
  243. if self.VipNobleShowView:HasOpen() then
  244. -- self.VipNobleShowView:Close()
  245. else
  246. self.VipNobleShowView:Open(vip_lv)
  247. end
  248. end
  249. self.model:Bind(VipModel.OPEN_VIP_NOBLE_VIEW, onOpenVipNobleShowView)
  250. local onOpenVipShowSkillEffectView = function (skill_id, vip_lv)--VIP特权界面
  251. if self.VipShowSkillEffectView == nil then
  252. self.VipShowSkillEffectView = VipShowSkillEffectView.New()
  253. end
  254. if self.VipShowSkillEffectView:HasOpen() then
  255. -- self.VipNobleShowView:Close()
  256. else
  257. self.VipShowSkillEffectView:Open(skill_id, vip_lv)
  258. end
  259. end
  260. self.model:Bind(VipModel.OPEN_VIP_SKILL_EFFECT_VIEW, onOpenVipShowSkillEffectView)
  261. local onVIPChange = function ()
  262. self.model:IsNeedRed(VipModel.TabType.PurchaseGift)
  263. end
  264. RoleManager:getInstance().mainRoleInfo:BindOne("vip_flag", onVIPChange)
  265. end
  266. function VipController:registerAllProtocals()
  267. --VIP
  268. self:RegisterProtocal(45000,"handle45000")--错误码
  269. self:RegisterProtocal(45001,"handle45001")--获得角色vip信息
  270. self:RegisterProtocal(45002,"handle45002")--使用充值卡激活vip(直接扣钻石)
  271. self:RegisterProtocal(45003,"handle45003")--VIP到期提醒
  272. self:RegisterProtocal(45004,"handle45004")--客服信息
  273. self:RegisterProtocal(45005,"handle45005")--vip专属礼包信息
  274. self:RegisterProtocal(45006,"handle45006")--购买vip专属礼包
  275. self:RegisterProtocal(45007,"handle45007")--vip专属礼包查看信息
  276. self:RegisterProtocal(45008,"handle45008")--查看vip专属礼包
  277. self:RegisterProtocal(45009,"handle45009")--领取VIP等级礼包
  278. self:RegisterProtocal(45010,"handle45010")--查看V3每日引导礼包
  279. self:RegisterProtocal(45011,"handle45011")--领取V3每日引导礼包
  280. --充值
  281. self:RegisterProtocal(15800,"handle15800")--充值界面信息
  282. self:RegisterProtocal(15801,"handle15801")--充值返利信息
  283. self:RegisterProtocal(15899,"handle15899")--充值秘籍(封测阶段)
  284. self:RegisterProtocal(15802,"handle15802")--充值记录(客户端用于判断是否激活超级客服)
  285. self:RegisterProtocal(15803,"handle15803")--快速充值信息提交
  286. self:RegisterProtocal(15903,"handle15903")
  287. self:RegisterProtocal(15904,"handle15904") --商品购买检查
  288. -- 投资计划相关
  289. self:RegisterProtocal(42000, "handle42000") -- 投资计划错误码
  290. self:RegisterProtocal(42001, "handle42001") -- 投资信息:已投资信息
  291. self:RegisterProtocal(42002, "handle42002") -- 投资
  292. self:RegisterProtocal(42003, "handle42003") -- 投资领奖
  293. --幻魔UP卡
  294. self:RegisterProtocal(15901,"handle15901") --查看福利卡
  295. self:RegisterProtocal(15902,"handle15902") --领取福利卡福利
  296. -- --充值活动
  297. -- self:RegisterProtocal(15951,"handle15951")
  298. -- self:RegisterProtocal(15952,"handle15952")
  299. -- self:RegisterProtocal(15953,"handle15953")
  300. end
  301. -- ########### 错误码 ###############
  302. -- protocol=45000
  303. -- {
  304. -- s2c{
  305. -- res :int32 // 错误码
  306. -- }
  307. -- }
  308. function VipController:handle45000()
  309. local scmd = SCMD45000.New(true)
  310. -- print("45000scmd", scmd.res)
  311. -- ErrorCodeShow(scmd.res)
  312. end
  313. -- ############## 获得角色vip信息 ##############
  314. -- protocol=45001
  315. -- {
  316. -- c2s{
  317. -- }
  318. -- s2c{
  319. -- vip_lv :int16 // 当前vip等级
  320. -- experience_vip_lv :int16 // 体验vip等级
  321. -- vip_exp :int32 // 当前vip等级经验
  322. -- vip_endtime :int32 // Vip体验卡到期时间
  323. -- vip_award_list:array{
  324. -- not_got :int8 //尚未领取奖励的vip等级礼包
  325. -- }
  326. -- }
  327. -- }
  328. function VipController:handle45001()
  329. local scmd = SCMD45001.New(true)
  330. print("45001scmd", scmd.res)
  331. PrintTable(scmd)
  332. self.model:UpdateVipInfomation(scmd)
  333. self.model:Fire(VipModel.REQUEST_CCMD_EVENT,45005)
  334. SupremeVipModel:getInstance():Fire(SupremeVipConst.REQUEST_CCMD_EVENT,45101)--请求自己的贵族信息
  335. --达到能用小飞鞋的vip等级时,自动勾选设置中的“自动使用小飞鞋”一项
  336. if not lua_settingM:GetAutoFlyShoeSet() and self.model:CanFreeUseShoe() then
  337. lua_settingM:SetAutoFlyShoeSet(true)
  338. end
  339. end
  340. -- ################## 使用充值卡激活vip(直接扣钻石) ######################
  341. -- ## 注:充值成功后服务端会主动推送45001
  342. -- protocol = 45002
  343. -- {
  344. -- c2s{
  345. -- card_type :int32 // 激活vip类型(卡片类型)
  346. -- }
  347. -- s2c{
  348. -- res :int32 // 操作码
  349. -- }
  350. -- }
  351. function VipController:handle45002()
  352. local scmd = SCMD45002.New(true)
  353. if scmd.res == 1 then
  354. Message.show("购买成功")
  355. else
  356. ErrorCodeShow(scmd.res)
  357. end
  358. end
  359. -- ################## VIP到期提醒 ######################
  360. -- protocol = 45003
  361. -- {
  362. -- c2s{
  363. -- }
  364. -- s2c{
  365. -- res :int32 // 操作码 1-体验卡到期
  366. -- }
  367. -- }
  368. function VipController:handle45003()
  369. local scmd = SCMD45003.New(true)
  370. if scmd.res == 1 then
  371. Message.show("您的体验卡已到期!","fault")
  372. VipModel:getInstance():Fire(VipModel.OPEN_EXPERIENCE_VIEW,2)
  373. RoleManager.Instance.mainRoleInfo:ChangeVar("angry_value", 0, false, true)
  374. end
  375. self.model:Fire(VipModel.REQUEST_CCMD_EVENT,45001)
  376. end
  377. -- ########### 客服信息 ##############
  378. -- protocol = 45004
  379. -- {
  380. -- c2s{
  381. -- }
  382. -- s2c{
  383. -- display :int8 // 1:显示 0:隐藏
  384. -- display_code :int8 // 是否显示二维码
  385. -- medium :string // 渠道
  386. -- link_info_1 :string // 联系方式1
  387. -- link_info_2 :string // 联系方式2
  388. -- code_path :string // 二维码路径
  389. -- remark :string // 客服信息
  390. -- work_time :string // 工作时间
  391. -- }
  392. -- }
  393. function VipController:handle45004()
  394. local scmd = SCMD45004.New(true)
  395. --print("45004scmd", scmd.res)
  396. --PrintTable(scmd)
  397. self.model:SetServiceData(scmd)
  398. end
  399. -- ############ vip专属礼包信息 ##########
  400. -- protocol = 45005
  401. -- {
  402. -- c2s{
  403. -- }
  404. -- s2c{
  405. -- list:array{
  406. -- vip_lv :int8 //礼包id
  407. -- state :int8 //0不可购买, 1可购买, 2已购买
  408. -- }
  409. -- }
  410. -- }
  411. function VipController:handle45005()
  412. local scmd = SCMD45005.New(true)
  413. -- print("SCMD45005", scmd)
  414. -- PrintTable(scmd)
  415. self.model:SetVipGiftInfo(scmd.list)
  416. end
  417. -- ############ 购买vip专属礼包 ##########
  418. -- protocol = 45006
  419. -- {
  420. -- c2s{
  421. -- vip_lv :int16 // 当前vip等级
  422. -- }
  423. -- s2c{
  424. -- res :int8 // 1:成功
  425. -- reward_list :arr_object_list // 奖励列表
  426. -- }
  427. -- }
  428. function VipController:handle45006()
  429. local scmd = SCMD45006.New(true)
  430. -- print("SCMD45006", scmd)
  431. -- PrintTable(scmd)
  432. if scmd.res == 1 then
  433. Message.show("购买成功","success")
  434. -- self.model:Fire(VipModel.OPEN_RESULT_VIEW,scmd.goods_list)
  435. self.model:Fire(VipModel.REQUEST_CCMD_EVENT,45005)
  436. else
  437. ErrorCodeShow(scmd.res)
  438. end
  439. end
  440. -- ################## 领取VIP等级礼包 ######################
  441. -- protocol = 45009
  442. -- {
  443. -- c2s{
  444. -- vip_lv : int8 //VIP等级
  445. -- }
  446. -- s2c{
  447. -- res :int32 // 操作码
  448. -- vip_lv : int8 //VIP等级
  449. -- rewards:array{
  450. -- goods_type:int16
  451. -- goods_id:int32
  452. -- num:32
  453. -- }
  454. -- }
  455. -- }
  456. function VipController:handle45009()
  457. local scmd = SCMD45009.New(true)
  458. print("SCMD45009", scmd)
  459. PrintTable(scmd)
  460. if scmd.res == 1 then
  461. local new_award_list = {}
  462. for n,l in ipairs(scmd.rewards) do
  463. new_award_list[#new_award_list + 1] = {l.goods_type, l.goods_id, l.num}
  464. end
  465. if #new_award_list > 0 then
  466. GiftModel:getInstance():Fire(GiftModel.OPEN_SHOW_ACT_GOODS_VIEW, new_award_list)
  467. end
  468. Message.show("领取成功","success")
  469. self.model:Fire(VipModel.REQUEST_CCMD_EVENT,45001)
  470. else
  471. ErrorCodeShow(scmd.res)
  472. end
  473. end
  474. -- ############ 查看V3每日引导礼包 ##########
  475. -- protocol = 45010
  476. -- {
  477. -- c2s{
  478. -- }
  479. -- s2c{
  480. -- state:int8 //1是可领取2是已领取
  481. -- }
  482. -- }
  483. function VipController:handle45010()
  484. local scmd = SCMD45010.New(true)
  485. print("SCMD45010", scmd)
  486. PrintTable(scmd)
  487. self.model.vip_three_award_state = scmd.state
  488. self.model:Fire(VipModel.UPDATE_EXPERIENCE_V_THREE_EX_RED)
  489. end
  490. -- ################## 领取V3每日引导礼包 ######################
  491. -- protocol = 45011
  492. -- {
  493. -- c2s{
  494. -- }
  495. -- s2c{
  496. -- res :int32 // 操作码1领取成功
  497. -- }
  498. -- }
  499. function VipController:handle45011()
  500. local scmd = SCMD45011.New(true)
  501. print("SCMD45011", scmd)
  502. PrintTable(scmd)
  503. if scmd.res == 1 then
  504. Message.show("领取成功","success")
  505. self.model.vip_three_award_state = 2
  506. self.model:Fire(VipModel.UPDATE_EXPERIENCE_V_THREE_EX_RED)
  507. else
  508. ErrorCodeShow(scmd.res)
  509. end
  510. end
  511. -- ########### 充值界面信息 ##########
  512. -- protocol=15800
  513. -- {
  514. -- c2s{
  515. -- }
  516. -- s2c{
  517. -- product_list:array{
  518. -- product_id :int32 //商品id
  519. -- return_type :int8 //返利类型 (0无返利|1终生首次|2活动时间首次)
  520. -- }
  521. -- }
  522. -- }
  523. function VipController:handle15800()
  524. local scmd = SCMD15800.New(true)
  525. -- print("huangcong:VipController [start:275] scmd:", scmd)
  526. -- PrintTable(scmd)
  527. -- print("huangcong:VipController [end]")
  528. self.model:SetRechargeCardData(scmd)
  529. end
  530. function VipController:handle15801()
  531. local scmd = SCMD15801.New(true)
  532. Message.show("充值成功")
  533. self.model:Fire(VipModel.UPDATE_RECHARGE_ITEM_DATA, scmd)
  534. end
  535. function VipController:handle15899()
  536. local scmd = SCMD15899.New(true)
  537. if scmd.res == 1 then
  538. else
  539. ErrorCodeShow(scmd.res)
  540. end
  541. end
  542. function VipController:handle15802()
  543. local scmd = SCMD15802.New(true)
  544. self.model:SetSuperVipOpenData(scmd)
  545. end
  546. function VipController:handle15803( )
  547. local scmd = SCMD15803.New(true)
  548. if scmd.res ~= 1 then
  549. ErrorCodeShow(scmd.res)
  550. end
  551. end
  552. function VipController:handle15901()
  553. local scmd = SCMD15901.New(true)
  554. PrintTable(scmd)
  555. self.model:SetVipCarDayReward(scmd)
  556. end
  557. function VipController:handle15902()
  558. local scmd = SCMD15902.New(true)
  559. if scmd.errcode == 1 then
  560. else
  561. ErrorCodeShow(scmd.errcode)
  562. end
  563. end
  564. -- ########### 商品信息 ##########
  565. -- protocol=15903
  566. -- {
  567. -- c2s{
  568. -- product_type :int8
  569. -- // 1普通充值(含充值返利)
  570. -- // 2福利卡
  571. -- // 3每日礼包
  572. -- // 4直购礼包
  573. -- // 5首充奖励
  574. -- }
  575. -- s2c{
  576. -- product_type :int8
  577. -- product_list:array{
  578. -- product_id :int32// 商品id
  579. -- buy_counts :int32// 已购次数:对于有限购配置的才有效,其余均为0
  580. -- }
  581. -- time_list:array{
  582. -- sub_type :int32// 子类型 日 周 月 首充 不同类型的礼包
  583. -- end_time :int32// 结束时间
  584. -- }
  585. -- }
  586. -- }
  587. function VipController:handle15903()
  588. local scmd = SCMD15903.New(true)
  589. self.model:SetProductInfo(scmd)
  590. self.model:IsNeedRed(VipModel.TabType.PurchaseGift)
  591. end
  592. -- ########### 商品购买检查 ##########
  593. -- protocol=15904
  594. -- {
  595. -- c2s{
  596. -- product_id :int32 //商品id
  597. -- }
  598. -- s2c{
  599. -- product_id :int32 //商品id
  600. -- errcode :int32 //1成功可以购买|其他错误码
  601. -- }
  602. -- }
  603. function VipController:handle15904()
  604. local scmd = SCMD15904.New(true)
  605. -- print("huangcong:VipController [start:386] :", scmd)
  606. -- PrintTable(scmd)
  607. -- print("huangcong:VipController [end]")
  608. if scmd.errcode == 1 then
  609. if AppConst.UpdateMode then
  610. local callback = function(state)
  611. end
  612. local product_cfg = Config.Rechargeproduct[scmd.product_id]
  613. if not product_cfg then
  614. Message.show("没有商品配置"..scmd.product_id)
  615. end
  616. local custom_info = {
  617. pay_title = Trim(product_cfg.product_name),
  618. id = scmd.product_id,
  619. }
  620. PlatformMgr:getInstance():PayRequest(product_cfg.money, custom_info, callback)
  621. else
  622. local text = "recharge_" .. scmd.product_id
  623. print("点击充值卡,通过秘籍购买直购礼包====:", text)
  624. CheatModel:getInstance():Fire(CheatModel.SEND_CHEAT_TO_SERVER, text)
  625. end
  626. else
  627. ErrorCodeShow(scmd.errcode)
  628. end
  629. end
  630. -- 投资计划相关协议
  631. function VipController:handle42000( )
  632. local vo = SCMD42000.New(true)
  633. if vo.code ~= 1 then
  634. ErrorCodeShow(vo.code, vo.args)
  635. end
  636. end
  637. function VipController:handle42001( )
  638. local vo = SCMD42001.New(true)
  639. self.model:SetInvestmentData(vo)
  640. -- 特殊处理后不在这边更新了
  641. -- self.model:IsNeedRed(VipModel.TabType.Investment)
  642. -- self.model:Fire(VipModel.UPDATE_INVESTMENT_DATA)
  643. end
  644. function VipController:handle42002( )
  645. local vo = SCMD42002.New(true)
  646. if vo.res == 1 then
  647. -- 成功会主推42001,失败走42000错误码
  648. Message.show("投资成功")
  649. end
  650. end
  651. function VipController:handle42003( )
  652. local vo = SCMD42003.New(true)
  653. self.model:UpdateInvestmentRewardId(vo)
  654. self.model:IsNeedRed(VipModel.TabType.Investment)
  655. self.model:Fire(VipModel.UPDATE_INVESTMENT_DATA, vo.type)
  656. end
  657. -- ############ vip专属礼包查看信息 ##########
  658. -- protocol = 45007
  659. -- {
  660. -- c2s{
  661. -- }
  662. -- s2c{
  663. -- list:array{
  664. -- vip_lv :int8 //vip等级
  665. -- }
  666. -- }
  667. -- }
  668. function VipController:handle45007()
  669. local scmd = SCMD45007.New(true)
  670. -- print("huangcong:VipController [start:514] :", scmd)
  671. -- PrintTable(scmd)
  672. -- print("huangcong:VipController [end]")
  673. self.model:SetVipGiftFindInfo(scmd)
  674. self.model:IsNeedRed(VipModel.TabType.Noble)
  675. end
  676. -- ############ 查看vip专属礼包 ##########
  677. -- protocol = 45008
  678. -- {
  679. -- c2s{
  680. -- vip_lv :int8 //vip等级
  681. -- }
  682. -- s2c{
  683. -- res :int32 // 1:成功
  684. -- }
  685. -- }
  686. function VipController:handle45008()
  687. local scmd = SCMD45008.New(true)
  688. if scmd.res == 1 then
  689. self.model:Fire(VipModel.REQUEST_CCMD_EVENT,45007)
  690. else
  691. -- ErrorCodeShow(scmd.res)
  692. end
  693. end