Kaynağa Gözat

合并代码,修改登录流程

kaka 4 yıl önce
ebeveyn
işleme
59bc0b8a12

+ 8 - 2
assets/script/before/view/data/HarvestData.ts

@@ -42,8 +42,14 @@ export default class HarvestData extends Data {
             if (!isTeaching && rand <= rate) {
                 if(gData.gameData.playerProp.orderData && gData.gameData.playerProp.orderData.overTimes >0)
                 {
-                    this.isTouchBtn = false;
-                    mk.ui.openPanel('game/prefab/uiPanel/HarvestPanel');
+                    if (gData.gameData.prohibiJBAd[gData.loginData.userChannel - 1] == "1") {
+                        this.isTouchBtn = false;
+                        mk.ui.openPanel('game/prefab/uiPanel/HarvestPanel');
+                    } else {
+                        this.isCdOver = false;
+                        console.log("=========isCdOver == false");
+                        this.getNormalReward();
+                    }
                 }else{
                     this.isCdOver = false;
                     console.log("=========isCdOver == false");

+ 7 - 1
assets/script/game/data/AdData.ts

@@ -105,7 +105,7 @@ export class AdData {
     }
 
 
-    public async watchVideo(type: AdFun) {
+    public async watchVideo(type: AdFun, callBack: Function = null) {
         this.ad_subType = type;
         let data = {
             "imei": gData.appData.machineInfo.imei,
@@ -150,6 +150,11 @@ export class AdData {
         if (curData) {
             curData.setAdData(response.data);
         }
+
+        if(callBack)
+        {
+            callBack(response.data);
+        }
     }
 
     /** 更新其他广告次数
@@ -493,6 +498,7 @@ export enum AdFun {
     harvest = 9,        //收获超级加倍视频
     farmMap = 10,       //图鉴领取视频
     lineUp = 11,        //插队视频
+    addProductTimes = 12,//获得生产次数
 }
 
 export enum RateConfig {

+ 15 - 2
assets/script/game/data/GameData.ts

@@ -108,6 +108,10 @@ export class GameData {
     public maxProductToServer = false;
 
     public authUIType = 0;
+
+    public prohibiJBAd: string[] = [];
+    public prohibitProductionAd: string[] = [];
+    public productionAdMaxTimes = 20;
     /**
      * 初始化游戏数据:网络配置信息,用户信息
      * @returns 
@@ -177,7 +181,9 @@ export class GameData {
         //从服务器解析配置
         this.setProductMapFromJson();
 
-        gData.loginData.popIdentifySwitch = this.configs.ServerConfig.popIdentifySwitch == '1';
+        gData.loginData.popIdentifySwitch = this.configs.ServerConfig.popIdentifySwitch.split(",");
+        this.prohibiJBAd = this.configs.ServerConfig.ProhibitJBAd.split(",");
+        this.prohibitProductionAd = this.configs.ServerConfig.ProhibitProductionAd.split(",");
 
         gData.gameData.shareUrl = this.configs.ServerConfig.shareUrl;
         gData.gameData.shareTitle = this.configs.ServerConfig.shareTitle;
@@ -226,6 +232,8 @@ export class GameData {
         mk.console.logSingle('userOrderTaskInfo', res_data.userOrderTaskInfo);
         this.cloneOrderData();
 
+        this.playerProp.curProductionAdTimes = res_data.dailyProductionTimes;
+
         mk.data.setTAUserID(gData.loginData.uin);
         mk.data.setTAEventUser(0, 'logindays_total', this.playerProp.loginDays);
         if (this.playerProp.completeFarmTaskTimes == 0) {
@@ -1734,6 +1742,9 @@ class PlayerProp {
 
     //插队看视频次数限制
     lineRedMoney = 0;
+
+    //当前生产次数
+    curProductionAdTimes = 0;
 }
 
 /**
@@ -1872,7 +1883,9 @@ export enum DataEventId {
     /** 加载 */
     loading = 'loading',
     /** 排队 */
-    queue = 'queue'
+    queue = 'queue',
+    //实名认证
+    realName = 'realName'
 }
 
 

+ 35 - 1
assets/script/game/data/LoginData.ts

@@ -1,3 +1,5 @@
+import JsbSystem from "../../mk/system/JsbSystem";
+import { DataEventId } from "./GameData";
 import { StorageKey } from "./StorageData";
 
 /**
@@ -37,11 +39,13 @@ export class LoginData {
     public privacy_data: string[];
 
     /** 身份认证开关 */
-    public popIdentifySwitch = false;
+    public popIdentifySwitch: string[] = [];
     /** 身份认证通过 */
     public passAnti = false;
 
     public passPrivacy = false;
+    
+    public userChannel = 1;
 
     /**
      * 初始化本地配置
@@ -330,6 +334,36 @@ export class LoginData {
         gData.gameData.init();
     }
 
+    public async getUserChannel(isDoIdentify = true) {
+        let data = {};
+        let response = await mk.http.sendData('user/getUserChannel', data);
+        mk.console.logSingle('getUserChannel=>', response);
+        if (response.errcode != 0) {
+            if(isDoIdentify)
+            {
+                this.passAnti = true;
+            }     
+            return;
+        }
+
+        this.userChannel = response.data.channel;
+        if(isDoIdentify)
+        {
+            if(this.userChannel <= 5)
+            {
+                if(this.popIdentifySwitch[this.userChannel - 1] == "1")
+                {
+                    JsbSystem.ysdkInit();
+                    JsbSystem.autologin();
+
+                    mk.data.sendDataEvent(DataEventId.realName, `实名认证验证人数`);
+                }else{
+                    this.passAnti = true;
+                }
+            }
+        }
+    }
+
     /**
      * 本地数据不是本账户的 清空数据 重新登录游戏
      */

+ 1 - 1
assets/script/game/data/module/RewardData.ts

@@ -62,7 +62,7 @@ export class RewardData extends Data {
             let num = 10;
             if(isMatchOrder)
             {
-                num = 1;
+                num = 3;
             }
             let scale = -1;
             if( gData.reward.data[i].rewardType === RewardType.productTimes)

+ 14 - 6
assets/script/game/game/Game.ts

@@ -534,7 +534,14 @@ export default class Game extends cc.Component {
             return;
         }
 
-
+        if(gData.gameData.prohibitProductionAd[gData.loginData.userChannel - 1] == "1")
+        {
+            if(gData.gameData.playerProp.curProductionAdTimes >= gData.gameData.productionAdMaxTimes)
+            {
+                mk.tip.pop('今日领取生产次数已达上限!');
+                return;
+            }
+        }
 
         let flyRed = await gData.gameData.makeProduct();
 
@@ -592,9 +599,9 @@ export default class Game extends cc.Component {
     public doFlyExpAni(exp: number, startPos: cc.Node, data) {
         let pos = this.lbl_farmLevel.node.parent.convertToWorldSpaceAR(this.lbl_farmLevel.node.getPosition());
         let num = 3;
-        if (gData.harvestData.isMatchOrder) {
-            num = 1;
-        }
+        // if (gData.harvestData.isMatchOrder) {
+        //     num = 3;
+        // }
         mk.fly.PlayCoinAnim(2, num, startPos, pos, () => {
             if (gData.gameData.playerProp.gradeLevel < data.farmLevel) {
                 gData.gameData.playerProp.gradeLevel = data.farmLevel;
@@ -1033,6 +1040,7 @@ export default class Game extends cc.Component {
             mk.tip.pop("订单未完成");
         } else {
             this.getOrderReward();
+            mk.data.sendDataEvent(DataEventId.button_click, "订单领奖按钮");
         }
     }
 
@@ -1072,12 +1080,12 @@ export default class Game extends cc.Component {
                     }
                     await this.updataOrderProgress(this.orderPicIdArray[i].ID);
                     //await mk.time.WaitForSeconds(1);
-                    for (let index = 0; index != 3; ++index) {
+                    for (let index = 0; index != 5; ++index) {
                         let crop = await mk.pool.getPrefab('game/prefab/crop');
                         let sf = await mk.loader.load(plantPath + plantId, cc.SpriteFrame);
                         crop.getComponent(cc.Sprite).spriteFrame = sf;
                         mk.fly.playFlyAniExtra(farmNode, this.sp_cropIcon[i].node, crop, 0.6, index * 0.2, () => {
-                            if (index == 1) {
+                            if (index == 2) {
                                 this.doFlyOrderAni(i);
                             }
                         });

+ 23 - 20
assets/script/game/module/login/Login.ts

@@ -32,7 +32,7 @@ export default class Login extends cc.Component {
 
     private hasDeviceBackInit = false;
 
-    private hasCheckAnti = false;
+    private hasLogin = false;
 
     private hasCheckPermission = false;
 
@@ -42,6 +42,8 @@ export default class Login extends cc.Component {
 
     private coreGame = null;
 
+    private hasCheckChannel = false;
+
     private initShuzilm = false;
 
     onLoad() {
@@ -77,6 +79,7 @@ export default class Login extends cc.Component {
     }
 
     update() {
+        //隐私弹窗
         if (!this.hasCheckPrivacy) {
             this.hasCheckPrivacy = true
             this.checkPrivacy()
@@ -118,35 +121,23 @@ export default class Login extends cc.Component {
             return;
         }
 
-        if (!CC_DEBUG) {
-            if (gData.loginData.popIdentifySwitch) {
-                if (!this.hasCheckAnti) {
-                    this.hasCheckAnti = true
-                    // this.checkShowIdentification()
-                    JsbSystem.ysdkInit();
-                    JsbSystem.autologin();
-                }
-
-                if (!gData.loginData.passAnti) {
-                    return
-                }
-            }
-        }
-
         if (gData.loginData.loadResCompelete) {
+            //数盟初始化
             if (!this.initShuzilm) {
                 this.initShuzilm = true;
                 mk.shuzilmM.init();
                 return;
             }
 
-            if (mk.shuzilmM.hasGot && mk.tongdunM.hasGot) {
-                if (mk.aliRiskManager.getRiskCode) {
-                    mk.aliRiskManager.getRiskCode = false;
+            if (mk.shuzilmM.hasGot && mk.tongdunM.hasGot && mk.aliRiskManager.getRiskCode) {
+                //开始登陆
+                if (!this.hasLogin) {
+                    this.hasLogin = true;
 
                     this.login();
                 }
                 else if (gData.gameData.dataFinish) {//登录流程完毕
+                    //微信登录按钮 注释
                     // if (gData.loginData.isAuth || CC_DEBUG) {
                     //     if (!this.loadSceneState) {
                     //         this.loadSceneState = true;
@@ -158,15 +149,27 @@ export default class Login extends cc.Component {
                     //     this.node_btnLogin.active = true;
                     // }
 
+                    if (!CC_DEBUG) {
+                        //检查用户来源渠道
+                        if (!this.hasCheckChannel) {
+                            this.hasCheckChannel = true;
+                            gData.loginData.getUserChannel();
+                        }
+
+                        if (!gData.loginData.passAnti) {
+                            return
+                        }
+                    }
+
                     if (!this.loadSceneState) {
                         this.loadSceneState = true;
+
                         this.loadMain();
                     }
 
                     gData.gameData.dataFinish = false;
                 }
             }
-
         }
     }
 

+ 12 - 1
assets/script/game/module/speedUpUI/ProductReward.ts

@@ -1,3 +1,4 @@
+import { AdFun } from "../../data/AdData";
 import { GameProp, VideoAdType } from "../../data/GameData";
 
 
@@ -130,7 +131,12 @@ export default class ProductReward extends cc.Component {
         mk.ad.videoAdType = VideoAdType.video_init_16;
         mk.ad.watchAd((success: boolean) => {
             if (success) {
-                gData.adData.watchVideo(null);
+                if(gData.gameData.prohibitProductionAd[gData.loginData.userChannel - 1] == "1")
+                {
+                    gData.adData.watchVideo(AdFun.addProductTimes, this.refreshMaxAdTimes);
+                }else{
+                    gData.adData.watchVideo(null);
+                }
 
                 let rewardData = [{ rewardType: 4, rewardNum: parseInt(gData.gameData.configs.ServerConfig.ProductionAd) }];
                 gData.reward.data = rewardData;
@@ -146,6 +152,11 @@ export default class ProductReward extends cc.Component {
         })
     }
 
+    refreshMaxAdTimes(value)
+    {
+        gData.gameData.playerProp.curProductionAdTimes = value;
+    }
+
     addTimes() {
         let add = parseInt(gData.gameData.configs.ServerConfig.ProductionAd);
         gData.gameData.changeLeftTimes(add);

+ 1 - 1
assets/script/mk/system/AdSystem.ts

@@ -202,7 +202,7 @@ export default class AdSystem {
         if (gap_time_stamp < needTime) {
             const time = Math.ceil((needTime - gap_time_stamp) / 1000);
             const leftTime = mk.time.formatWithUnit(time);
-            mk.tip.pop('视频内点击太频繁了,请' + leftTime + '后再试');
+            mk.tip.pop('看广告太频繁,请' + leftTime + '后再试');
 
             return true;
         }

+ 1 - 0
assets/script/mk/system/JsbSystem.ts

@@ -627,6 +627,7 @@ export default class JsbSystem {
 
     public static ysdkAuthSuccess() {
         gData.loginData.passAnti = true;
+        mk.data.sendDataEvent(DataEventId.realName, '认证通过人数');
     }
 
     /** 统计时长 */