difenduandada
2024-12-31 34abe6963b344c882358274957f4b992456fee40
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
"use strict";
cc._RF.push(module, '3233cqURXpAKa0bpEoK/Loq', 'action_controller');
// Scripts/mod/action/action_controller.js
 
"use strict";
 
// --------------------------------------------------------------------
// @author: xxx@syg.com(必填, 创建模块的人员)
// @description:
//      这里填写详细说明,主要填写该模块的功能简要
// <br/>Create: 2019-03-02 16:49:03
// --------------------------------------------------------------------
var ActionConst = require("action_const");
 
var MainuiController = require("mainui_controller");
 
var MainuiConst = require("mainui_const");
 
var ActionEvent = require("action_event");
 
var RoleController = require("role_controller");
 
var WelfareController = require("welfare_controller");
 
var OrderactionConst = require("orderaction_const");
 
var ActionController = cc.Class({
  "extends": BaseController,
  ctor: function ctor() {},
  // 初始化配置数据
  initConfig: function initConfig() {
    var ActionModel = require("action_model");
 
    this.model = new ActionModel();
    this.model.initConfig();
    this.mainui_ctrl = MainuiController.getInstance();
    this.holiday_list = {}; // 活动列表类型
 
    this.holiday_del_list = {}; //  -- 需要移除的标签页缓存列表
 
    this.holiday_award_list = {}; //未领取活动奖励的列表
 
    this.need_show_init_red = {}; //-- 登录的时候需要显示红点的列表
  },
  // 返回当前的model
  getModel: function getModel() {
    return this.model;
  },
  // 注册监听事件
  registerEvents: function registerEvents() {
    if (this.init_role_event == null) {
      this.init_role_event = gcore.GlobalEvent.bind(EventId.EVT_ROLE_CREATE_SUCCESS, function () {
        gcore.GlobalEvent.unbind(this.init_role_event);
        this.needRequireData();
        this.init_role_event = null; // this.requestActionStatus() //-- 请求所有活动图标
        //超值基金
        // this.sender24700()
        // 七天登录红点
        // this.cs21100();
        // 七天目标
        // this.cs13601();
      }.bind(this));
    }
  },
  // --- 断线重连或者0点更新或者初始化需要请求的
  needRequireData: function needRequireData() {
    var self = this;
    self.openActionMainPanel(false);
    self.holiday_list = {};
    self.holiday_award_list = {};
    self.need_show_init_red = {};
    self.holiday_del_list = {};
    self.is_init_require = true;
    self.model.clearFundSrvData(); // 断线时需要清掉基金缓存数据
 
    self.requestActionStatus(); // 请求所有活动图标
 
    self.requestHolidayList(ActionConst.ActionType.Wonderful); //-- 登陆的时候请求一下精彩活动的
  },
  // 注册协议接受事件
  registerProtocals: function registerProtocals() {
    // this.RegisterProtocal(1110, this.on16602);
    this.RegisterProtocal(10922, this.on10922); //-- 全服活动状态,服务端广播 
 
    this.RegisterProtocal(16601, this.on16601); // -- 所有子活动的显示数据,主要用于活动面板左侧标签显示,以及部分面板内容显示
 
    this.RegisterProtocal(16603, this.on16603); // -- 请求子活动
 
    this.RegisterProtocal(16604, this.on16604); //   领取奖励
 
    this.RegisterProtocal(10923, this.on10923); //- 主要是用于服务段更新全服活动状态数据的
 
    this.RegisterProtocal(10924, this.on10924); //-- 个人活动状态,服务端广播 
 
    this.RegisterProtocal(10925, this.on10925); //-- 主要是用于服务段更新个人活动状态数据的
 
    this.RegisterProtocal(16602, this.on16602); // 请求所有活动未领取奖励
 
    this.RegisterProtocal(16606, this.on16606); // 领取活动返回
 
    this.RegisterProtocal(16607, this.on16607); // 0点 5点更新
    // -- 基金相关
 
    this.RegisterProtocal(24700, this.handle24700);
    this.RegisterProtocal(24701, this.handle24701);
    this.RegisterProtocal(24702, this.handle24702); //7天登录
 
    this.RegisterProtocal(21100, this.on21100); // 7天登录信息
 
    this.RegisterProtocal(21101, this.on21101); // 领取7天登录奖励
    // 七天目标
 
    this.RegisterProtocal(13601, this.handle13601);
    this.RegisterProtocal(13602, this.handle13602); // --升级有礼
 
    this.RegisterProtocal(21200, this.handle21200);
    this.RegisterProtocal(21201, this.handle21201); //奖励排行信息(以后可以是活动的通用)
 
    this.RegisterProtocal(16650, this.handle16650); // 幸运转盘
 
    this.RegisterProtocal(16637, this.handle16637);
    this.RegisterProtocal(16638, this.handle16638);
    this.RegisterProtocal(16639, this.handle16639);
    this.RegisterProtocal(16641, this.handle16641);
    this.RegisterProtocal(16642, this.handle16642);
    this.RegisterProtocal(16643, this.handle16643); //神秘杂货铺
 
    this.RegisterProtocal(16688, this.handle16688);
    this.RegisterProtocal(16689, this.handle16689); // --限时礼包入口
 
    this.RegisterProtocal(21210, this.handle21210);
    this.RegisterProtocal(21211, this.handle21211); //-- 推送激活了显示礼包.
 
    this.RegisterProtocal(21016, this.handle21016);
    this.RegisterProtocal(16687, this.handle16687); // --元宵冒险
 
    this.RegisterProtocal(24810, this.handle24810); //--获取元宵冒险 任务信息
 
    this.RegisterProtocal(24811, this.handle24811); //--推送任务变化"
 
    this.RegisterProtocal(24812, this.handle24812); //--任务领取
    //触发礼包
 
    this.RegisterProtocal(21220, this.handle21220);
    this.RegisterProtocal(24813, this.handle24813);
    this.RegisterProtocal(24814, this.handle24814); //时装
 
    this.RegisterProtocal(30101, this.handle30101);
    this.RegisterProtocal(30100, this.handle30100);
    this.RegisterProtocal(30102, this.handle30102);
  },
  requestActionStatus: function requestActionStatus() {
    this.SendProtocal(10922, {});
    this.SendProtocal(10924, {});
    this.on10925(OrderactionConst.OrderActionEntranceID.entrance_id);
  },
  handleActionStatusData: function handleActionStatusData(data) {
    if (data) {
      var config = Config.function_data.data_info[data.id];
      if (config == null) return;
 
      if (data.status == ActionConst.ActionStatus.un_finish) {
        this.mainui_ctrl.removeFunctionIconById(data.id);
      } else {
        this.mainui_ctrl.addFunctionIconById(data.id, data); // -- 如果是7天排行就请求一下任务
 
        if (data.id == MainuiConst.icon.seven_rank) {// 7天排行
          // self:requestSevenDaysRank()
        } else if (data.id == MainuiConst.icon.fund) {
          this.model.checkFundRedStatus();
        }
      }
    }
  },
  setHolidayStatus: function setHolidayStatus(bid, status) {
    var self = this;
    if (self.holiday_list == null || self.holiday_list[bid] == null) return;
 
    if (self.holiday_award_list == null) {
      self.holiday_award_list = {};
    }
 
    var vo = {
      bid: bid,
      status: status
    };
    var vo1;
 
    if (status) {
      vo1 = {
        bid: bid,
        num: 1
      };
    } else {
      vo1 = {
        bid: bid,
        num: 0
      };
    }
 
    self.holiday_award_list[bid] = vo;
    var action_sub_vo = self.holiday_list[bid];
    var function_id = MainuiConst.icon.welfare;
 
    if (self.isSpecialBid(bid)) {
      self.mainui_ctrl.setFunctionTipsStatus(MainuiConst.icon.welfare, vo1);
    } else {
      self.mainui_ctrl.setFunctionTipsStatus(action_sub_vo.cli_type, vo1);
      function_id = action_sub_vo.cli_type;
    }
 
    gcore.GlobalEvent.fire(ActionEvent.UPDATE_HOLIDAY_TAB_STATUS, function_id, vo);
  },
  // --desc:更新全服活动全部数据
  on10922: function on10922(data) {
    if (this.protocal_list_22 == null) {
      this.protocal_list_22 = {};
    }
 
    if (data != null && data.act_list) {
      for (var i = 0; i < data.act_list.length; ++i) {
        var v = data.act_list[i];
        this.handleActionStatusData(v); // -- 先储存一下吧
 
        if (v.status == ActionConst.ActionStatus.un_finish) {
          this.protocal_list_22[v.id] = null;
        } else {
          this.protocal_list_22[v.id] = v.id;
        }
      }
    }
  },
  on10923: function on10923(data) {
    this.handleActionStatusData(data);
 
    if (data) {
      if (this.protocal_list_22 == null) {
        this.protocal_list_22 = {};
      }
 
      if (data.status == ActionConst.ActionStatus.un_finish) {
        this.protocal_list_22[data.id] = null;
      } else {
        this.protocal_list_22[data.id] = data.id;
      }
    }
  },
  on10924: function on10924(data) {
    cc.log("个人活动on10924", data);
 
    if (data != null && data.act_list) {
      for (var i = 0; i < data.act_list.length; ++i) {
        var v = data.act_list[i];
        this.handleActionStatusData(v);
 
        if (MainuiConst.first_red_point[v.id] && v.status == 1) {
          this.mainui_ctrl.setFunctionTipsStatus(v.id, MainuiConst.first_red_point[v.id]);
        }
      }
    }
  },
  on10925: function on10925(data) {
    this.handleActionStatusData(data);
 
    if (MainuiConst.first_red_point[data.id] && data.status == 1) {
      this.mainui_ctrl.setFunctionTipsStatus(data.id, MainuiConst.first_red_point[data.id]);
    }
  },
  //请求所有活动未领取奖励状态
  requestActionAwardStatus: function requestActionAwardStatus(type) {
    var proto = {};
    proto.type = type;
    this.SendProtocal(16602, proto);
  },
  requestHolidayList: function requestHolidayList(type) {
    var proto = {};
    proto.type = type;
    this.SendProtocal(16601, proto);
  },
  on16602: function on16602(data) {
    for (var i = 0; i < data.holiday_list.length; ++i) {
      var v = data.holiday_list[i];
      this.setHolidayStatus(v.bid, v.can_get_num != false);
    }
  },
  on16601: function on16601(data) {
    cc.log(data, "on16601");
    var temp_sub_vo;
    var type_list = {};
 
    for (var i = 0; i < data.holiday_list.length; ++i) {
      var v = data.holiday_list[i];
 
      if (this.holiday_del_list[v.bid] == null) {
        temp_sub_vo = this.holiday_list[v.bid];
 
        if (temp_sub_vo == null) {
          var ActionSubTabVo = require("action_sub_tab_vo");
 
          temp_sub_vo = new ActionSubTabVo();
          this.holiday_list[v.bid] = temp_sub_vo;
        }
 
        temp_sub_vo = this.holiday_list[v.bid];
 
        if (temp_sub_vo != null) {
          temp_sub_vo.update(v);
        } //活动类的投资计划和基金不在活动面板显示
 
 
        if (this.isSpecialBid(v.bid)) {
          temp_sub_vo.setShowStatus(false);
          this.cs16603(v.bid);
        } //判断这个活动所属的图标,并且动态设置他的名字
 
 
        if (temp_sub_vo.cli_type != 0) {
          if (type_list[temp_sub_vo.cli_type] == null) {
            type_list[temp_sub_vo.cli_type] = {
              action_num: 0,
              action_name: ""
            };
          }
 
          if (!this.isSpecialBid(temp_sub_vo.bid)) {
            type_list[temp_sub_vo.cli_type].action_num = type_list[temp_sub_vo.cli_type].action_num + 1;
 
            if (temp_sub_vo.cli_type_name != "" && temp_sub_vo.cli_type_name != "null" && type_list[temp_sub_vo.cli_type].action_name == "") {
              type_list[temp_sub_vo.cli_type].action_name = temp_sub_vo.cli_type_name;
            }
          }
        }
      }
    } //    -- 初始化之后请求对应的活动红点状态
 
 
    if (this.is_init_require == true) {
      this.requestActionAwardStatus();
      this.is_init_require = false;
    } //判断是增删图标
 
 
    for (var function_id in type_list) {
      var object = type_list[function_id];
 
      if (object) {
        if (object.action_num > 0) {
          this.mainui_ctrl.addFunctionIconById(function_id, object.action_name);
        } else {
          this.mainui_ctrl.removeFunctionIconById(function_id);
        }
      }
    }
  },
  on16603: function on16603(data) {
    //节日登录红点
    if (data.bid == ActionConst.ActionRankCommonType.common_day || data.bid == ActionConst.ActionRankCommonType.festval_day || data.bid == ActionConst.ActionRankCommonType.lover_day) {
      this.model.updataFestvalRedStatus(data.bid, data.aim_list);
    } else if (data.bid == 1011) {
      this.model.updataCombineLoginRedStatus(data.aim_list);
    } else if (data.bid == 991014) {
      this.model.updataPreferentialRedStatus(true, MainuiConst.icon.preferential);
    } else if (data.bid == 91014) {
      this.model.updataPreferentialRedStatus(true, MainuiConst.icon.other_preferential);
    } // -- 没有子活动列表了,直接移除掉标签,下次有效(现在作废)
    // if(data.aim_list.length == 0 ){
    //     this.handleHolidayList(0, data.bid)
    // }
    // -- 首充连冲
 
 
    if (data.bid == 91005) {
      this.handle91005Data(data);
    } else if (data.bid == ActionConst.ActionRankCommonType.seven_charge) {} // 暂时没有
    // this.model.setSevenChargeData(data)
    // - 现在只要活动列表是空的,那么是投资计划后者是基金就删掉标签页
 
 
    if (this.isSpecialBid(data.bid)) {
      if (data.finish == 0 && this.need_show_init_red[data.bid] == null && data.aim_list.length != 0) {
        var status = false;
        var base_config = Config.holiday_client_data.data_info[data.bid];
 
        if (base_config) {
          var is_open = base_config.open_lev;
          var role_vo = RoleController.getInstance().getRoleVo();
 
          if (is_open && role_vo.lev) {
            if (role_vo.lev >= is_open) {
              status = true;
            }
          }
        }
 
        this.need_show_init_red[data.bid] = status;
        this.setHolidayStatus(data.bid, status);
 
        if (data.bid == ActionConst.ActionSpecialID.growfund) {
          WelfareController.getInstance().setWelfareStatus(ActionConst.ActionSpecialID.growfund, status);
        }
      }
    }
 
    gcore.GlobalEvent.fire(ActionEvent.UPDATE_HOLIDAY_SIGNLE, data);
  },
  isSpecialBid: function isSpecialBid(bid) {
    return bid == ActionConst.ActionSpecialID.invest || bid == ActionConst.ActionSpecialID.growfund;
  },
  //每日充值额外处理
  handle91005Data: function handle91005Data(data) {
    // --找出今日累充和累充天数的数据
    if (!this.today_list) {
      this.today_list = {};
    }
 
    if (data.aim_list && Utils.next(data.aim_list) != null) {
      for (var k = 0; k < data.aim_list.length; ++k) {
        var v = data.aim_list[k];
 
        for (var a = 0; a < v.aim_args.length; ++a) {
          var j = v.aim_args[a];
 
          if (j.aim_args_key == 3) {
            if (j.aim_args_val == 1) {
              //--今日累充
              this.today_list[k] = v;
              this.today_list[k].has_num = this.has_num;
              this.today_list[k].item_effect_list = this.item_effect_list;
            }
          } else if (j.aim_args_key == 4) {
            // --需要充值多少钱
            if (this.today_list[k]) {
              this.today_list[k].need_charge = j.aim_args_val;
            }
          } else if (j.aim_args_key == 5) {
            // --目标值 需要冲多少天
            if (this.today_list[k]) {
              this.today_list[k].charge_day = j.aim_args_val;
            }
          } else if (j.aim_args_key == 6) {
            // --计数
            if (this.today_list[k]) {
              this.today_list[k].has_charge = j.aim_args_val;
            }
          }
        }
      }
    } // this.checkShowDayCharge()
 
  },
  //获取指定类型和指定活动的id的子活动基础数据
  getActionSubTabVo: function getActionSubTabVo(bid) {
    if (this.holiday_list != null) {
      return this.holiday_list[bid];
    }
  },
  getAllActionList: function getAllActionList() {
    return this.holiday_list;
  },
  // --desc:请求子活动列表
  // --time:2017-07-26 07:56:10
  // --@bid:子活动ID
  // --@return 
  cs16603: function cs16603(bid) {
    var protocal = {};
    protocal.bid = bid;
    this.SendProtocal(16603, protocal);
  },
  //领取奖励
  cs16604: function cs16604(bid, aim, arg) {
    var protocal = {};
    protocal.bid = bid;
    protocal.aim = aim;
    protocal.arg = arg || 0;
    this.SendProtocal(16604, protocal);
  },
  on16604: function on16604(data) {
    message(data.msg); // showAssetsMsg(data.msg)
  },
  // ------------------@ 基金相关协议
  // -- 请求基金开启数据
  sender24700: function sender24700() {
    var protocal = {};
    this.SendProtocal(24700, protocal);
  },
  handle24700: function handle24700(data) {
    if (data && data.ids) {
      this.model.setOpenFundIds(data.ids);
      gcore.GlobalEvent.fire(ActionEvent.UPDATA_FUND_ID_LIST_EVENT);
    }
  },
  //-- 请求基金数据
  sender24701: function sender24701(id) {
    var protocal = {};
    protocal.id = id;
    this.SendProtocal(24701, protocal);
  },
  handle24701: function handle24701(data) {
    if (data) {
      this.model.setFundSrvData(data);
      gcore.GlobalEvent.fire(ActionEvent.UPDATA_FUND_DATA_EVENT, data.id);
    }
  },
  // -- 请求领取基金
  sender24702: function sender24702(id) {
    var protocal = {};
    protocal.id = id;
    this.SendProtocal(24702, protocal);
  },
  handle24702: function handle24702(data) {
    if (data.msg) {
      message(data.msg);
    }
  },
  // -- 打开超值基金奖励预览界面
  openActionFundAwardWindow: function openActionFundAwardWindow(status, group_id, fund_id) {
    var self = this;
 
    if (status) {
      if (!self.fund_award_win) {
        var actionFundAward = require("action_fund_award_window");
 
        self.fund_award_win = new actionFundAward();
      }
 
      if (self.fund_award_win.isOpen() == false) {
        self.fund_award_win.open({
          group_id: group_id,
          fund_id: fund_id
        });
      }
    } else {
      if (self.fund_award_win) {
        self.fund_award_win.close();
        self.fund_award_win = null;
      }
    }
  },
  // ==============================
  // desc:7天登录状态
  // ==============================
  cs21100: function cs21100() {
    this.SendProtocal(21100, {});
  },
  on21100: function on21100(data) {
    var show_red = false;
 
    for (var i in data.status_list) {
      if (data.status_list[i].status == 2) {
        this.mainui_ctrl.setFunctionTipsStatus(MainuiConst.icon.seven_login, true);
        break;
      }
    }
 
    var i = 0;
 
    for (var k in data.status_list) {
      if (data.status_list[k].status == 3) {
        i = i + 1;
      }
    }
 
    if (i == data.status_list.length) {
      this.mainui_ctrl.setFunctionTipsStatus(MainuiConst.icon.seven_login, false);
    }
 
    this.model.updateSevenLoginData(data);
    gcore.GlobalEvent.fire(ActionEvent.UPDATE_SEVEN_LOGIN_STATUS, data);
  },
  // ==============================
  // desc:7天登录领取奖励
  // ==============================
  cs21101: function cs21101(day) {
    var protocal = {};
    protocal.day = day;
    this.SendProtocal(21101, protocal);
  },
  on21101: function on21101(data) {
    message(data.msg);
 
    if (data.code == 1) {
      gcore.GlobalEvent.fire(ActionEvent.UPDATE_SEVEN_LOGIN_REWARDS, data);
      this.cs21100();
    }
  },
  // 打开七天登录界面
  openSevenLoginWin: function openSevenLoginWin(status) {
    if (status) {
      if (!this.seven_login_win) {
        this.seven_login_win = Utils.createClass("action_seven_login_window", this);
      }
 
      if (this.seven_login_win && this.seven_login_win.isOpen() == false) {
        this.seven_login_win.open();
      }
    } else {
      if (this.seven_login_win) {
        this.seven_login_win.close();
        this.seven_login_win = null;
      }
    }
  },
  // 打开七天目标界面
  openSevenGoalView: function openSevenGoalView(status) {
    if (status) {
      if (!this.seven_goal_win) {
        this.seven_goal_win = Utils.createClass("action_seven_goal_window", this);
      }
 
      if (this.seven_goal_win && this.seven_goal_win.isOpen() == false) {
        this.seven_goal_win.open();
      }
    } else {
      if (this.seven_goal_win) {
        this.seven_goal_win.close();
        this.seven_goal_win = null;
      }
    }
  },
  cs13601: function cs13601() {
    this.SendProtocal(13601, {});
  },
  handle13601: function handle13601(data) {
    if (data.period == 0) return;
    this.model.setSevenGoldPeriod(data.period || 1);
    this.model.initSevenWalfare(data.period || 1);
    this.model.setSevenGoalWelfareList(data.welfare_list);
    this.model.setSevenGoalGrowList(data.grow_list);
    this.model.setHalfGiftList(data.price_list);
    this.model.setSevenGoalBoxList(data.finish_list, data.num);
    this.model.checkRedPoint(data.cur_day);
    gcore.GlobalEvent.fire(ActionEvent.UPDATE_SEVENT_GOAL, data);
  },
  // 请求七日活动领取
  cs13602: function cs13602(type, day, id, item) {
    var protocal = {};
    protocal.type = type;
    protocal.day_type = day;
    protocal.id = id;
    protocal.item = item;
    this.SendProtocal(13602, protocal);
  },
  handle13602: function handle13602(data) {
    message(data.msg);
 
    if (data.flag == 1) {
      gcore.GlobalEvent.fire(ActionEvent.UPDATE_SEVENT_GET, data);
    }
  },
  //活动主界面
  //属于竞猜活动 还是属于节日活动,MainuiConst.icon.action 或者 MainuiConst.icon.festival
  openActionMainPanel: function openActionMainPanel(status, function_id, action_bid) {
    if (status == false) {
      if (this.action_operate != null) {
        this.action_operate.close();
        this.action_operate = null;
      }
    } else {
      if (action_bid != null) {
        var action_vo = this.holiday_list[action_bid];
 
        if (action_vo) {
          function_id = action_vo.cli_type;
        }
      }
 
      if (function_id == null) {
        function_id = MainuiConst.icon.action;
      }
 
      if (this.action_operate == null) {
        this.action_operate = Utils.createClass("action_main_window");
      }
 
      if (this.action_operate.isOpen() == false) this.action_operate.open({
        function_id: function_id,
        action_bid: action_bid
      });
    }
  },
  //获得指定类型活动的所有子活动列表,用于主界面显示,这里做一个排序处理吧
  getActionSubList: function getActionSubList(function_id) {
    var action_sub_list = [];
 
    if (this.holiday_list) {
      for (var k in this.holiday_list) {
        var v = this.holiday_list[k];
 
        if (v.cli_type == function_id && v.isShowInAction() == true) {
          action_sub_list.push(v);
        }
      }
    }
 
    if (Utils.next(action_sub_list) != null) {
      action_sub_list.sort(function (a, b) {
        return a.sort_val - b.sort_val;
      });
    }
 
    return action_sub_list;
  },
  // -------------------------------升级有礼协议-------------------------------------
  send21200: function send21200() {
    var protocal = {};
    this.SendProtocal(21200, protocal);
  },
  handle21200: function handle21200(data) {
    gcore.GlobalEvent.fire(ActionEvent.UPDATE_LEVEL_UP_GIFT, data);
  },
  send21201: function send21201(id) {
    var protocal = {};
    protocal.id = id;
    this.SendProtocal(21201, protocal);
  },
  handle21201: function handle21201(data) {
    message(data.msg);
  },
  //获取一个指定类型活动指定子活动可领取状态数据
  getHolidayAweradsStatus: function getHolidayAweradsStatus(bid) {
    if (this.holiday_award_list != null && this.holiday_award_list[bid] != null) {
      return this.holiday_award_list[bid];
    }
  },
  //排行榜奖励预览协议(以后可能是活动通用排行奖励信息)
  send16650: function send16650(bid) {
    var protocal = {};
    protocal.bid = bid;
    this.SendProtocal(16650, protocal);
  },
  handle16650: function handle16650(data) {
    message(data.msg);
    gcore.GlobalEvent.fire(ActionEvent.RANK_REWARD_LIST, data);
  },
  // --desc:活动领取返回
  on16606: function on16606(data) {
    this.setHolidayStatus(data.bid, data.can_get_num != false);
  },
  on16607: function on16607(data) {
    if (data && data.type == 0) {
      //--0点更新
      this.needRequireData(true);
    }
  },
  //  幸运转盘
  requestLucky: function requestLucky() {
    this.SendProtocal(16637, {});
  },
  handle16637: function handle16637(data) {
    this.model.setTreasureInitData(data.dial_data);
    this.model.lucklyRedPoint();
    gcore.GlobalEvent.fire(ActionEvent.UPDATE_LUCKYROUND_GET, data);
  },
  send16638: function send16638(type, count) {
    var protocal = {};
    protocal.type = type;
    protocal.type2 = count;
    this.SendProtocal(16638, protocal);
  },
  handle16638: function handle16638(data) {
    gcore.GlobalEvent.fire(ActionEvent.TREASURE_SUCCESS_DATA, data);
  },
  handle16639: function handle16639(data) {
    gcore.GlobalEvent.fire(ActionEvent.UPDATE_LUCKLY_DATA, data);
  },
  send16640: function send16640(type, id) {
    var protocal = {};
    protocal.type = type;
    protocal.id = id;
    this.SendProtocal(16640, protocal);
  },
  handle16641: function handle16641(data) {
    gcore.GlobalEvent.fire(ActionEvent.UPDATA_TREASURE_LOG_DATA, data);
  },
  send16642: function send16642(type) {
    var protocal = {};
    protocal.type = type;
    this.SendProtocal(16642, protocal);
  },
  handle16642: function handle16642(data) {
    message(data.msg); // -- GlobalEvent:getInstance():Fire(ActionEvent.UPDATA_TREASURE_REFRESH, data)
  },
  // 弹窗的
  send16643: function send16643(type, count) {
    var protocal = {};
    protocal.type = type;
    protocal.type2 = count;
    this.SendProtocal(16643, protocal);
  },
  handle16643: function handle16643(data) {
    message(data.msg);
 
    if (data.code == 1) {
      gcore.GlobalEvent.fire(ActionEvent.UPDATA_TREASURE_POPUPS_SEND, data);
    }
  },
  // -----打开幸运探宝界面-----
  openLuckyTreasureWin: function openLuckyTreasureWin(status, index) {
    index = index || 1;
 
    if (status) {
      var is_open = this.mainui_ctrl.checkMainFunctionOpenStatus(MainuiConst.icon.lucky_treasure, MainuiConst.function_type.other, false);
 
      if (is_open == false) {
        return;
      } // 高级探宝的时候
 
 
      if (index == 2) {
        this.model.setBuyRewardData();
        var open_data = this.model.getBuyRewardData(index);
        var open = this.mainui_ctrl.checkIsOpenByActivate(open_data[1].limit_open);
 
        if (open == false) {
          message(Utils.TI18N("人物等级不足"));
          return;
        }
      }
 
      if (!this.treasure_win) {
        this.treasure_win = Utils.createClass("action_treasure_window", this);
      }
 
      if (this.treasure_win && this.treasure_win.isOpen() == false) {
        this.treasure_win.open(index);
      }
    } else {
      if (this.treasure_win) {
        this.treasure_win.close();
        this.treasure_win = null;
      }
    }
  },
  getTreasureView: function getTreasureView() {
    if (this.treasure_win) {
      return this.treasure_win;
    }
  },
  checkOpenActionLimitGiftMainWindow: function checkOpenActionLimitGiftMainWindow() {
    var self = this;
 
    if (self.active_limit_gift_id == 2001) {
      //-- 18级的不提示
      self.active_limit_gift_id = null;
      return;
    }
 
    if (self.active_limit_gift_id != null) {
      var config = Config.star_gift_data.data_limit_gift[self.active_limit_gift_id];
 
      if (config) {
        var gift_id = self.active_limit_gift_id;
 
        var CommonAlert = require("commonalert");
 
        CommonAlert.show(config.desc, Utils.TI18N('前往'), function () {
          this.openActionLimitGiftMainWindow(true, gift_id);
        }.bind(this), Utils.TI18N('取消'));
      }
    }
 
    self.active_limit_gift_id = null;
  },
  // --打开限时礼包入口
  // --打开显示礼包id
  openActionLimitGiftMainWindow: function openActionLimitGiftMainWindow(status, id) {
    var self = this;
 
    if (status) {
      if (!self.action_limit_gift) {
        var ActionLimitGiftMainWindow = require("action_limit_gift_main_window");
 
        self.action_limit_gift = new ActionLimitGiftMainWindow();
      }
 
      self.action_limit_gift.open(id);
    } else {
      if (self.action_limit_gift) {
        self.action_limit_gift.close();
        self.action_limit_gift = null;
      }
    }
  },
  send21210: function send21210() {
    var protocal = {};
    this.SendProtocal(21210, protocal);
  },
  handle21210: function handle21210(data) {
    message(data.msg);
    gcore.GlobalEvent.fire(ActionEvent.LIMIT_GIFT_MAIN_EVENT, data);
  },
  // --推送激活了显示礼包.并且在某些操作后需要显示
  handle21211: function handle21211(data) {
    this.active_limit_gift_id = data.id;
  },
  //  探宝获得物品界面
  openTreasureGetItemWindow: function openTreasureGetItemWindow(status, data, index, count_type) {
    if (status) {
      if (!this.treasure_get_win) {
        var ActionTreasureGetWindow = require("action_treasure_get_window");
 
        this.treasure_get_win = new ActionTreasureGetWindow(this, data, index, count_type);
      }
 
      if (this.treasure_get_win && this.treasure_get_win.isOpen() == false) {
        this.treasure_get_win.open();
      }
    } else {
      if (this.treasure_get_win) {
        this.treasure_get_win.close();
        this.treasure_get_win = null;
      }
    }
  },
  getSevenLoginRoot: function getSevenLoginRoot() {
    if (this.seven_login_win) return this.seven_login_win.root_wnd;
  },
  getTreasureRoot: function getTreasureRoot() {
    if (this.treasure_win) return this.treasure_win.root_wnd;
  },
  //是否可以创建指定活动类型,只有活动总列表里面有这个活动类型才可以创建
  checkCanAddWonderful: function checkCanAddWonderful(function_id) {
    if (function_id == null) return false;
    if (this.holiday_list == null || Utils.next(this.holiday_list) == null) return false;
 
    for (var k in this.holiday_list) {
      var v = this.holiday_list[k];
 
      if (v.cli_type == function_id) {
        return true;
      }
    }
 
    return false;
  },
  //--------------------杂货铺协议开始-------------------------------------
  sender16688: function sender16688() {
    this.SendProtocal(16688, {});
  },
  handle16688: function handle16688(data) {
    this.model.setStoneShopData(data.buy_info);
    gcore.GlobalEvent.fire(ActionEvent.UPDATE_STORE_DATA_EVENT);
  },
  sender16689: function sender16689(id, num) {
    var protocal = {};
    protocal.id = id;
    protocal.num = num;
    this.SendProtocal(16689, protocal);
  },
  handle16689: function handle16689(data) {
    message(data.msg);
 
    if (data.code == 1) {
      gcore.GlobalEvent.fire(ActionEvent.UPDATE_STORE_DATA_SUCCESS_EVENT, data);
    }
  },
  //--------------------新服限购协议结束-------------------------------------
  // --------------------新服限购协议开始-------------------------------------
  // 红点
  sender16687: function sender16687(send_protocal) {
    var protocal = send_protocal || {};
    var len = 0;
 
    for (var i in send_protocal) {
      len += 1;
      break;
    }
 
    if (len == 0) {
      protocal.bid = 91029;
    }
 
    this.SendProtocal(16687, protocal);
  },
  handle16687: function handle16687(data) {
    var status = false;
 
    if (data.code == 1) {
      status = true;
    }
 
    data.status = status;
 
    if (data.bid == ActionConst.ActionRankCommonType.open_server) {
      MainuiController.getInstance().setFunctionTipsStatus(MainuiConst.icon.open_server_recharge, status);
    } else if (data.bid == ActionConst.ActionRankCommonType.high_value_gift || data.bid == ActionConst.ActionRankCommonType.mysterious_store) {
      this.model.updateGiftRedPointStatus(data);
    }
  },
  //--------------------新服限购协议结束-------------------------------------
  // 判断是否能充值
  sender21016: function sender21016(charge_id) {
    var protocal = {};
    protocal.charge_id = charge_id;
    this.SendProtocal(21016, protocal);
  },
  handle21016: function handle21016(data) {
    gcore.GlobalEvent.fire(ActionEvent.Is_Charge_Event, data);
  },
  // ==============================--
  // desc:登录时候请求一些特殊活动id的红点数据
  // time:2017-07-18 05:15:10
  // @return 
  // ==============================--
  requestActionRedStatus: function requestActionRedStatus() {
    this.sender16687({
      bid: ActionConst.ActionRankCommonType.open_server
    }); //小额直购请求红点
 
    this.sender16687({
      bid: ActionConst.ActionRankCommonType.high_value_gift
    }); //小额礼包请求红点
 
    this.sender16687({
      bid: ActionConst.ActionRankCommonType.mysterious_store
    }); //神秘杂货店请求红点
  },
  //--------------------元宵冒险协议开始-------------------------------------
  // -- 请求任务信息
  sender24810: function sender24810() {
    var protocal = {};
    this.SendProtocal(24810, protocal);
  },
  handle24810: function handle24810(data) {
    message(data.msg);
    gcore.GlobalEvent.fire(ActionEvent.YUAN_ZHEN_DATA_EVENT, data);
  },
  // --推送任务
  handle24811: function handle24811(data) {
    gcore.GlobalEvent.fire(ActionEvent.YUAN_ZHEN_UPDATA_EVENT, data);
  },
  // -- 完成任务
  sender24812: function sender24812(id) {
    var protocal = {};
    protocal.id = id;
    this.SendProtocal(24812, protocal);
  },
  handle24812: function handle24812(data) {
    message(data.msg);
 
    if (data.code == true) {
      gcore.GlobalEvent.fire(ActionEvent.YUAN_ZHEN_TASK_EVENT, data);
    }
  },
  //--------------------元宵冒险协议结束-------------------------------------
  // 触发礼包
  openTriggerGiftWindow: function openTriggerGiftWindow(status) {
    if (status) {
      if (!this.action_time_gift_big) {
        var ActionTimeGiftBigWindow = require("action_time_gift_big_window");
 
        this.action_time_gift_big = new ActionTimeGiftBigWindow(this);
      }
 
      if (this.action_time_gift_big && this.action_time_gift_big.isOpen() == false) {
        this.action_time_gift_big.open();
      }
    } else {
      if (this.action_time_gift_big) {
        this.action_time_gift_big.close();
        this.action_time_gift_big = null;
      }
    }
  },
  sender21220: function sender21220() {
    this.SendProtocal(21220, {});
  },
  handle21220: function handle21220(data) {
    message(data.msg);
    gcore.GlobalEvent.fire(ActionEvent.TRIGGER_GIFT_EVENT, data);
  },
  // --开服超值礼包界面
  openActionOpenServerGiftWindow: function openActionOpenServerGiftWindow(status, bid) {
    if (status) {
      if (!this.action_open_server_recharge) {
        var ActionOpenServerGiftWindow = require("action_open_server_gift_window");
 
        this.action_open_server_recharge = new ActionOpenServerGiftWindow(this);
      }
 
      if (this.action_open_server_recharge && this.action_open_server_recharge.isOpen() == false) {
        this.action_open_server_recharge.open(bid);
      }
    } else {
      if (this.action_open_server_recharge) {
        this.action_open_server_recharge.close();
        this.action_open_server_recharge = null;
      }
    }
  },
  //--试炼之境
  sender24813: function sender24813() {
    this.SendProtocal(24813, {});
  },
  handle24813: function handle24813(data) {
    message(data.msg);
    gcore.GlobalEvent.fire(ActionEvent.YUAN_ZHEN_DATA_EVENT, data);
  },
  //检查活动是否存在exist
  //@action_bid 活动基础id
  //@camp_id 活动id 属于可以选参数, 如果有值表示需要判定  如果为nil 表示 不需要判定
  checkActionExistByActionBid: function checkActionExistByActionBid(action_bid) {
    if (!action_bid) return false;
    var tab_vo = this.getActionSubTabVo(action_bid);
    if (tab_vo) return true;
    return false;
  },
  sender24814: function sender24814(id) {
    var protocal = {};
    protocal.id = id;
    this.SendProtocal(24814, protocal);
  },
  handle24814: function handle24814(data) {
    message(data.msg);
    gcore.GlobalEvent.fire(ActionEvent.YUAN_ZHEN_TASK_EVENT, data);
  },
  //时装---------
  sender30101: function sender30101() {
    this.SendProtocal(30101, {});
  },
  handle30101: function handle30101(data) {
    message(data.msg);
    gcore.GlobalEvent.fire(ActionEvent.SKIN_INFO_EVENT, data);
  },
  sender30100: function sender30100() {
    this.SendProtocal(30100, {});
  },
  handle30100: function handle30100(data) {
    message(data.msg);
  },
  handle30102: function handle30102(data) {
    MainuiController.getInstance().setFunctionTipsStatus(MainuiConst.icon.skin, data.code == 1);
  },
  openBuySkinWindow: function openBuySkinWindow(status) {
    if (status) {
      if (!this.action_buy_skin) {
        var ActionBuySkinWindow = require("action_buy_skin_window");
 
        this.action_buy_skin = new ActionBuySkinWindow(this);
 
        if (this.action_buy_skin && this.action_buy_skin.isOpen() == false) {
          this.action_buy_skin.open();
        }
      }
    } else {
      if (this.action_buy_skin) {
        this.action_buy_skin.close();
        this.action_buy_skin = null;
      }
    }
  }
});
module.exports = ActionController;
 
cc._RF.pop();