Selaa lähdekoodia

topon广告策略优先从user/income-strategy接口中获取,未获取到从打包配置中获取

kaka 4 vuotta sitten
vanhempi
commit
4bc106f408

+ 0 - 3
assets/script/game/data/GameData.ts

@@ -130,9 +130,6 @@ export class GameData {
         mk.console.logSingle("getAllConfigInfo", response.data);
         this.initConfigs(response.data);
 
-        //初始化topon
-        mk.ad.init();
-
         data = {};
         response = await mk.http.sendData('getInfoCrypt', data);
         if (response.errcode != 0) {

+ 15 - 12
assets/script/game/data/LoginData.ts

@@ -44,10 +44,12 @@ export class LoginData {
     public passAnti = false;
 
     public passPrivacy = false;
-    
+
     public userChannel = 1;
     public isMatched = 1;
 
+    public toponStr = '';
+
     /**
      * 初始化本地配置
      * @returns 
@@ -340,28 +342,29 @@ export class LoginData {
         let response = await mk.http.sendData('user/income-strategy', data);
         mk.console.logSingle('getUserChannel=>', response);
         if (response.errcode != 0) {
-            if(isDoIdentify)
-            {
+            if (isDoIdentify) {
                 this.passAnti = true;
-            }     
+            }
             return;
         }
 
         this.userChannel = response.data.tfChannel;
         this.isMatched = response.data.isMatched;
+        this.toponStr = response.data.strategyContent;
+
+        //初始化topon
+        mk.ad.init();
+
         console.log(`userChannel=========${this.userChannel}`);
         console.log(`isMatched=========${this.isMatched}`);
-        mk.data.setTAEventUser(0, 'kncdsf_zhubao_juliangwpp', this.userChannel);
-        if(isDoIdentify)
-        {
-            if(this.userChannel <= 5)
-            {
-                if(this.popIdentifySwitch[this.userChannel - 1] == "1")
-                {
+        mk.data.setTAEventUserStr(0, 'kncdsf_zhubao_juliangwpp', `${this.userChannel}_${this.isMatched}`);
+        if (isDoIdentify) {
+            if (this.userChannel <= 5) {
+                if (this.popIdentifySwitch[this.userChannel - 1] == "1") {
                     JsbSystem.ysdkInit();
                     JsbSystem.autologin();
                     mk.data.sendDataEvent(DataEventId.realName, `实名认证验证人数`);
-                }else{
+                } else {
                     this.passAnti = true;
                 }
             }

+ 19 - 16
assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATSDKMgr.ts

@@ -62,28 +62,31 @@ export default class ATSDKMgr extends zgSingleton implements IADSDKMgr {
 
     /** 获取投放渠道 和 广告位ID信息 */
     public getAdvertiseChannel() {
-        let str = JsbSystem.getAdvertisingChannel();
-        if (!str) {
-            //channelId,AppId,AppSecreate,激励视频,插屏,信息流,开屏,banner
-            str = '1,a60cac090a6eb0,66b742dd0e502b64d783d9c66a9d30c4,b60cac0e43c0e1,b60cac0e4892fa,b60cac0e4d08e8,b60cac0e5754fc,b60cac0e524313,b60cac0e524313';
+        let str = '';
+        if (gData.loginData.toponStr != '') {
+            str = gData.loginData.toponStr
         }
+        else {
+            str = JsbSystem.getAdvertisingChannel();
+            str = str.slice(1);
+        }
+
         console.log("getAdvertiseChannel..." + str);
 
         let arr = str.split(',')
-        let channel = arr[0];
-        ATSDKMgr.topon_android_appId = arr[1];
-        ATSDKMgr.topon_android_appSecret = arr[2];
-        ATSDKMgr.topon_rewardVideo_placementId = arr[3];
-        ATSDKMgr.topon_inter_placementId = arr[4];
-        ATSDKMgr.topon_native_placementId = arr[5];
-
-        ATSDKMgr.topon_banner_placementId = arr[7];
-        if (arr[8]) {
-            ATSDKMgr.topon_fullinter_placementId = arr[8];
+        ATSDKMgr.topon_android_appId = arr[0];
+        ATSDKMgr.topon_android_appSecret = arr[1];
+        ATSDKMgr.topon_rewardVideo_placementId = arr[2];
+        ATSDKMgr.topon_inter_placementId = arr[3];
+        ATSDKMgr.topon_native_placementId = arr[4];
+
+        ATSDKMgr.topon_banner_placementId = arr[6];
+        if (arr[7]) {
+            ATSDKMgr.topon_fullinter_placementId = arr[7];
         }
 
-        if (arr[9]) {
-            ATSDKMgr.topon_biginter_placementId = arr[9];
+        if (arr[8]) {
+            ATSDKMgr.topon_biginter_placementId = arr[8];
         }
     }