future 1 år sedan
förälder
incheckning
6c352a6484

+ 4 - 4
assets/resources/ui/home.prefab

@@ -146,7 +146,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1920.0000000000002
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -293,7 +293,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": 285.0000000000001,
+      "y": 285,
       "z": 0
     },
     "_lrot": {
@@ -4443,7 +4443,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": -960.0000000000001,
+      "y": -960,
       "z": 0
     },
     "_lrot": {
@@ -11835,7 +11835,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1920.0000000000002
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

+ 17 - 1
assets/script/GameManager.ts

@@ -16,6 +16,22 @@ export class GameManager extends Component {
     public static openId:string = 'asd'
     public static settingData:settingData = null
 
+    // 获取平台标识
+    public static getPlatformId() {
+        let platform_id = config.Platform_id.browser
+        if(sys.platform == sys.Platform.BYTEDANCE_MINI_GAME) {
+            platform_id =  config.Platform_id.tt
+        }
+        else if (sys.platform == sys.Platform.WECHAT_GAME) {
+            if(SdkUtil.KS_GAME) {
+                platform_id =  config.Platform_id.ks
+            } else {
+                platform_id =  config.Platform_id.wx
+            }
+        }
+        return platform_id
+    }
+
     // 开启webscoket
     public static openWebScoket() {
         gameSocket.Instance.connect(config.websocket_domain)
@@ -76,7 +92,7 @@ export class GameManager extends Component {
                     call_back()
                     return
                 }
-                SdkUtil.shareGame(tools.sys_config.share_des,(r)=>{
+                SdkUtil.shareGame('',tools.sys_config.share_des,(r)=>{
                     if(r==true) {
                         userDataManager.addTodayShareNumber()
                         v.closeSelf()

+ 11 - 3
assets/script/config.ts

@@ -6,9 +6,11 @@ export class config  {
     static debug = false
     static gameName = "开局自行车";
     static websocket_domain = config.debug?'wss://snakews.xwrun.com':"wss://snakews.hainanmlwl.com" 
-    public static Platform = {
-        platform: "douyin",
-        // platform: "wx"
+    public static Platform_id = {
+        browser: "browser",
+        tt: "douyin",
+        wx: "wx",
+        ks: "ks",
     }
 
     public static API = {
@@ -147,6 +149,12 @@ export class config  {
         ADS_ID_RELIFE_VIDEO:"",           //游戏看视频复活
         ADS_ID_RESTART:"",                //在玩一局
     }
+    public static KS_CONFIG = {
+        SHARE_RELIFE_TITLE:"",            //分享复活标题
+        ADS_ID_INFINITE_DEGREE_VIDEO:"",  //无限次数
+        ADS_ID_RELIFE_VIDEO:"",           //游戏看视频复活
+        ADS_ID_RESTART:"",                //在玩一局
+    }
 
     public static USER_TT_SIDEBAR_REWARD = {
         GET: 0,       //获取

+ 45 - 23
assets/script/http.ts

@@ -2,6 +2,7 @@ import { _decorator, Component, Node, sys, url } from 'cc';
 import { config } from './config';
 import { tools } from './tools';
 import { userDataManager } from './manager/userDataManager';
+import { SdkUtil } from './sdkUtil';
 const { ccclass, property } = _decorator;
 @ccclass('http')
 export class http {
@@ -85,33 +86,54 @@ export class http {
     }
 
     public static uploadFile(url, filePath, progress_call_back, call_back) {
+        let success_cb = ((res)=>{
+            // console.log(`uploadFile调用成功 ${res.data}`);
+            if (res.statusCode === 200) {
+                call_back(null,res.data)
+            } else {
+                call_back(res.statusCode,null)
+            }
+        })
+        let fail_cb = ((err)=>{
+            // console.log(`tt_uploadFile调用失败${err}`);
+            call_back(err,null)
+        })
+        let progress_cb =((res)=>{
+            // console.log('progress=',res.progress)
+            if(progress_call_back) { progress_call_back(res.progress) }
+        })
+        let upload_url = http.domain + url
+        let name = 'file'
         if(sys.platform == sys.Platform.BYTEDANCE_MINI_GAME) {
             let task = tt.uploadFile({
-                url: http.domain + url,
+                url: upload_url,
                 filePath: filePath,
-                name: "file",
-                success(res) {
-                    if (res.statusCode === 200) {
-                        // console.log(`uploadFile调用成功 ${res.data}`);
-                        call_back(null,res.data)
-                    } else {
-                        call_back(res.statusCode,null)
-                    }
-                },
-                fail(err) {
-                    console.log(`uploadFile调用失败`,err);
-                    call_back(err,null)
-                },
+                name: name,
+                success(res) { success_cb(res) },
+                fail(err) { fail_cb(err) },
             });
-              
-            task.onProgressUpdate((res) => {
-                // console.log('res.progress=',res.progress)
-                if(progress_call_back) {
-                    progress_call_back(res.progress)
-                }
-            }); 
-
-            return
+            task.onProgressUpdate((res) => { progress_cb(res) }); 
+        }
+        else if(sys.platform == sys.Platform.WECHAT_GAME) {
+            if(SdkUtil.KS_GAME) {
+                let task = ks.uploadFile({
+                    url: upload_url,
+                    filePath: filePath,
+                    name: name,
+                    success(res) { success_cb(res) },
+                    fail(err) { fail_cb(err) },
+                });
+                task.onProgressUpdate((res) => { progress_cb(res) });
+            } else {
+                let task = wx.uploadFile({
+                    url: upload_url,
+                    filePath: filePath,
+                    name: name,
+                    success(res) { success_cb(res) },
+                    fail(err) { fail_cb(err) },
+                });
+                task.onProgressUpdate((res) => { progress_cb(res) }); 
+            }
         }
 
         // var xml = new XMLHttpRequest()

+ 272 - 101
assets/script/sdkUtil.ts

@@ -1,7 +1,6 @@
 import { _decorator, error, SpriteFrame, sys } from "cc";
 import { config } from "./config";
 import { uiManager } from "./manager/uiManager";
-import { tools } from "./tools";
 //管理广告、分享、SDK相关内容的组件
 export class SdkUtil {
     public static platform: string = 'cocos'; //平台
@@ -18,7 +17,7 @@ export class SdkUtil {
     public static vibrateInterval: number = 100;//两次震动之间的间隔,AppActivity里面的震动间隔也是100
     public static vibratePreTime: number = 0;//上次震动时间
 
-
+    public static KS_GAME:boolean = false; //是否ks游戏
     public static videoAd:any =null;
     public static isLookAd:boolean = false; //是否在看广告
 
@@ -34,6 +33,11 @@ export class SdkUtil {
     //------------------------------  公共  ------------------------------//
 
     public static init() {
+        if(sys.platform==sys.Platform.WECHAT_GAME) {
+            let isKSGame = typeof KSGameGlobal != 'undefined'
+            // console.log('isKSGame=',isKSGame)                            
+            SdkUtil.KS_GAME = isKSGame
+        }
         this.ttGetSystemInfo(()=> {
             this.ttRegisterInfo()
         })
@@ -65,16 +69,41 @@ export class SdkUtil {
             tt.login({
                 force: true,
                 success(res) {
-                  console.log(`login 调用成功${res.code} ${res.anonymousCode}`);
-                  call({"code":res.code,"anonymousCode":res.anonymousCode})
+                    console.log(`tt_login 调用成功:${res.code} ${res.anonymousCode}`);
+                    call({"code":res.code,"anonymousCode":res.anonymousCode})
                 },
-                fail(res) {
-                  console.log(`login 调用失败`);
-                  call(null)
+                fail(err) {
+                    console.log(`tt_login 调用失败:${err}`);
+                    // call(null)
                 },
-              });
-              
-        }else{
+            });
+        } 
+        else if(sys.platform == sys.Platform.WECHAT_GAME) {
+            if(SdkUtil.KS_GAME) {
+                ks.login({
+                    success(res) {
+                        console.log(`ks_login 调用成功:${res.code}`);
+                        call({"code":res.code})
+                    },
+                    fali(err) { 
+                        console.log(`ks_login 调用失败:${err}`);
+                        // call(null)
+                    }
+                })
+            } else {
+                wx.login({
+                    success(res) {
+                        console.log(`wx_login 调用成功:${res.code}`);
+                        call({"code":res.code})
+                    },
+                    fali(err) { 
+                        console.log(`wx_login 调用失败:${err}`);
+                        // call(null)
+                    }
+                })
+            }
+        }
+        else{
             call(null)
         }
     }
@@ -86,14 +115,38 @@ export class SdkUtil {
                 // withCredentials: true,
                 // withRealNameAuthenticationInfo: true,
                 success(res) {
-                  console.log(`getUserInfo 调用成功`, res.userInfo);
-                  call(res.userInfo)
+                    console.log(`tt_getUserInfo 调用成功`, res.userInfo);
+                    call(res.userInfo)
                 },
-                fail(res) {
-                  console.log(`getUserInfo 调用失败`, res.errMsg);
+                fail(err) {
+                    console.log(`tt_getUserInfo 调用失败`, err);
                 },
-              });
-        }else{
+            });
+        }
+        else if(sys.platform == sys.Platform.WECHAT_GAME) {
+            if(SdkUtil.KS_GAME) {
+                ks.getUserInfo({
+                    success(res) {
+                        console.log(`ks_getUserInfo 调用成功`, res.userInfo);
+                        call(res.userInfo)
+                    },
+                    fail(err) {
+                        console.log(`ks_getUserInfo 调用失败`, err);
+                    },
+                })
+            } else {
+                wx.getUserInfo({
+                    success(res) {
+                        console.log(`wx_getUserInfo 调用成功`, res.userInfo);
+                        call(res.userInfo)
+                    },
+                    fail(err) {
+                        console.log(`wx_getUserInfo 调用失败`, err);
+                    },
+                })
+            }
+        }
+        else{
             call(null)
         }
     }
@@ -101,14 +154,14 @@ export class SdkUtil {
     // 震动
     public static vibrateShort(){
         if(sys.platform == sys.Platform.BYTEDANCE_MINI_GAME) {
-            tt.vibrateShort({
-                success(res) {
-                //   console.log(`${res}`);
-                },
-                fail(res) {
-                //   console.log(`vibrateShort调用失败`);
-                },
-              });
+            tt.vibrateShort({ success(res) {}, fail(err) {} });
+        }
+        else if(sys.platform == sys.Platform.WECHAT_GAME) {
+            if(SdkUtil.KS_GAME) {
+                ks.vibrateShort({ success(res) {}, fail(err) {} });
+            } else {
+                wx.vibrateShort({ success(res) {}, fail(err) {} });
+            }
         }
           
     }
@@ -117,24 +170,27 @@ export class SdkUtil {
     public static showLoading(title:string) {
         if(title.length<=0) { return }
         if(sys.platform == sys.Platform.BYTEDANCE_MINI_GAME) {
-            tt.showLoading({
-                title: title,
-                success(res) { 
-                    // console.log(`${res}`)
-                },
-                fail(err) { 
-                    // console.log(`showLoading调用失败`,err)
-                },
-            })
+            tt.showLoading({ title: title, success(res) {},fail(err) {} })
+        }
+        else if(sys.platform == sys.Platform.WECHAT_GAME) {
+            if(SdkUtil.KS_GAME) {
+                ks.showLoading({ title: title, success(res) {},fail(err) {} })
+            } else {
+                wx.showLoading({ title: title, success(res) {},fail(err) {} })
+            }
         }
     }
 
     public static hideLoading() {
         if(sys.platform == sys.Platform.BYTEDANCE_MINI_GAME) {
-            tt.hideLoading({
-                // success(res) { console.log(`${res}`); },
-                // fail(err) { console.log(`hideLoading调用失败`,err); },
-            });
+            tt.hideLoading({ success(res) { }, fail(err) { } });
+        }
+        else if(sys.platform == sys.Platform.WECHAT_GAME) {
+            if(SdkUtil.KS_GAME) {
+                ks.hideLoading({ success(res) { }, fail(err) { } });
+            } else {
+                wx.hideLoading({ success(res) { }, fail(err) { } });
+            }
         }
     }
 
@@ -144,19 +200,30 @@ export class SdkUtil {
             tt.showToast({
                 title: title,
                 duration: duration,
-                success(res) {
-                    console.log(`${res}`);
-                    if(success_cb){ success_cb() }
-                },
-                fail(res) {
-                    console.log(`showToast调用失败`);
-                    if(fail_cb) { fail_cb() }
-                },
+                success(res) { if(success_cb){ success_cb() } },
+                fail(err) { if(fail_cb) { fail_cb() } },
             });
         }
+        else if(sys.platform == sys.Platform.WECHAT_GAME) {
+            if(SdkUtil.KS_GAME) {
+                ks.showToast({
+                    title: title,
+                    duration: duration,
+                    success(res) { if(success_cb){ success_cb() } },
+                    fail(err) { if(fail_cb) { fail_cb() } },
+                });
+            } else {
+                wx.showToast({
+                    title: title,
+                    duration: duration,
+                    success(res) { if(success_cb){ success_cb() } },
+                    fail(err) { if(fail_cb) { fail_cb() } },
+                });
+            }
+        }
     }
 
-    // 展示modal
+    // 展示modal (确定:res.confirm  取消:res.cancel)
     public static showModal(title:string, content:string, suc_cb=null, fail_cb=null, confirmText:string='确定', showCancel:boolean=true, cancelText:string='取消') {
         if(sys.platform == sys.Platform.BYTEDANCE_MINI_GAME) {
             tt.showModal({
@@ -165,33 +232,60 @@ export class SdkUtil {
                 confirmText: confirmText,
                 showCancel: showCancel,
                 cancelText: cancelText,
-                success(res) {
-                    if(suc_cb) {
-                        suc_cb(res) // 确定:res.confirm  取消:res.cancel
-                    }
-                },
-                fail(err) {
-                    if(fail_cb){ fail_cb(err) }
-                },
+                success(res) { if(suc_cb) { suc_cb(res) } },
+                fail(err) { if(fail_cb){ fail_cb(err) } },
             });
         }
+        else if(sys.platform == sys.Platform.WECHAT_GAME) {
+            if(SdkUtil.KS_GAME) {
+                ks.showModal({
+                    title: title,
+                    content: content,
+                    confirmText: confirmText,
+                    showCancel: showCancel,
+                    cancelText: cancelText,
+                    success(res) { if(suc_cb) { suc_cb(res) } },
+                    fail(err) { if(fail_cb){ fail_cb(err) } },
+                });
+            } else {
+                wx.showModal({
+                    title: title,
+                    content: content,
+                    confirmText: confirmText,
+                    showCancel: showCancel,
+                    cancelText: cancelText,
+                    success(res) { if(suc_cb) { suc_cb(res) } },
+                    fail(err) { if(fail_cb){ fail_cb(err) } },
+                });
+            }
+
+        }
     }
     
-    // 展示actionSheet
+    // 展示actionSheet (点击的索引:`res.tapIndex`)
     public static showActionSheet(item_list:string[], suc_cb=null, fail_cb=null) {
         if(sys.platform == sys.Platform.BYTEDANCE_MINI_GAME) {
             tt.showActionSheet({
                 item_list,
-                success(res) {
-                    if(suc_cb) {
-                        suc_cb(res) // 点击的索引:`res.tapIndex`
-                    }
-                },
-                fail(err) {
-                    if(fail_cb) { fail_cb(err) } 
-                },
+                success(res) { if(suc_cb) { suc_cb(res) } },
+                fail(err) { if(fail_cb) { fail_cb(err) } },
             });
         }
+        else if(sys.platform == sys.Platform.WECHAT_GAME) {
+            if(SdkUtil.KS_GAME) {
+                ks.showActionSheet({
+                    item_list,
+                    success(res) { if(suc_cb) { suc_cb(res) } },
+                    fail(err) { if(fail_cb) { fail_cb(err) } },
+                });
+            } else {
+                wx.showActionSheet({
+                    item_list,
+                    success(res) { if(suc_cb) { suc_cb(res) } },
+                    fail(err) { if(fail_cb) { fail_cb(err) } },
+                });
+            }
+        }
     }
 
     // 选择系统相册
@@ -201,17 +295,36 @@ export class SdkUtil {
                 sourceType: ["album"],
                 count:1,
                 success:(res)=>{
-                    // console.log('chooseImage调用成功=',res)
-                    if(res.tempFilePaths.length>0) {
-                        call_back(res.tempFilePaths[0])
-                    }
-                },
-                fail(err) {
-                    console.log(`chooseImage调用失败=`,err);
+                    // console.log('chooseImage调用成功=${res}')
+                    if(res.tempFilePaths.length>0) { call_back(res.tempFilePaths[0])}
                 },
+                fail(err) { console.log(`tt_chooseImage调用失败=${err}`); },
             })
-        } else {
-            // call_back()
+        } 
+        else if(sys.platform == sys.Platform.WECHAT_GAME) {
+            if(SdkUtil.KS_GAME) {
+                ks.chooseMedia({
+                    mediaType: ["image"],
+                    sourceType: ["album"],
+                    count:1,
+                    success:(res)=>{
+                        // console.log('chooseImage调用成功=${res}')
+                        if(res.tempFilePaths.length>0) { call_back(res.tempFilePaths[0])}
+                    },
+                    fail(err) { console.log(`wx_chooseImage调用失败=${err}`); },
+                })
+            } else {
+                wx.chooseMedia({
+                    mediaType: ["image"],
+                    sourceType: ["album"],
+                    count:1,
+                    success:(res)=>{
+                        // console.log('chooseImage调用成功=${res}')
+                        if(res.tempFilePaths.length>0) { call_back(res.tempFilePaths[0])}
+                    },
+                    fail(err) { console.log(`wx_chooseImage调用失败=${err}`); },
+                })
+            }
         }
     }
 
@@ -226,27 +339,18 @@ export class SdkUtil {
     }
 
     // 分享游戏
-    public static shareGame(title: string, call_back) {
+    public static shareGame(title: string, desc:string, call_back) {
+        if(desc==undefined||desc==null) { desc = ''}
         if(sys.platform == sys.Platform.BYTEDANCE_MINI_GAME) {
-            if(title.length<=0) { title = config.TT_CONFIG.SHARE_RELIFE_TITLE }
-            let desc = tools.sys_config.share_des
-            if(desc==undefined||desc==null) { desc = ''}
-            tt.shareAppMessage({
-                title: title,
-                desc: desc,
-                success() { 
-                    console.log("分享成功") 
-                    // this.showToast('分享成功')
-                    call_back(true)
-                },
-                fail(e) { 
-                    console.log("分享失败",e) 
-                    this.showToast('分享失败')
-                    call_back(false)
-                },
-              });
+            SdkUtil.ttShare(title,desc, null, ()=>{
+                this.showToast('分享失败')
+            })
         } else if(sys.platform == sys.Platform.WECHAT_GAME) {
-            if(title.length<=0) { title = config.WX_CONFIG.SHARE_RELIFE_TITLE }
+            if(SdkUtil.KS_GAME) {
+                SdkUtil.ksShare(desc)
+            } else {
+                SdkUtil.wxShare(desc)
+            }
         }else{
             call_back(true)
         }
@@ -275,16 +379,23 @@ export class SdkUtil {
                 ad_id = config.TT_CONFIG.ADS_ID_RESTART
             }
         } else if (sys.platform == sys.Platform.WECHAT_GAME) {
-            if(ad_type==config.ADS_TYPE.GAME_INFINITE_DEGREE_VIDEO) {
-                ad_id = config.WX_CONFIG.ADS_ID_INFINITE_DEGREE_VIDEO
-            } else if(ad_type==config.ADS_TYPE.GAME_RELIFE_VIDEO) {
-                ad_id = config.WX_CONFIG.ADS_ID_RELIFE_VIDEO
-            } else if(ad_type==config.ADS_TYPE.GAME_RESTART) {
-                ad_id = config.WX_CONFIG.ADS_ID_RESTART
+            if(SdkUtil.KS_GAME) {
+                if(ad_type==config.ADS_TYPE.GAME_INFINITE_DEGREE_VIDEO) {
+                    ad_id = config.KS_CONFIG.ADS_ID_INFINITE_DEGREE_VIDEO
+                } else if(ad_type==config.ADS_TYPE.GAME_RELIFE_VIDEO) {
+                    ad_id = config.KS_CONFIG.ADS_ID_RELIFE_VIDEO
+                } else if(ad_type==config.ADS_TYPE.GAME_RESTART) {
+                    ad_id = config.KS_CONFIG.ADS_ID_RESTART
+                }
+            } else {
+                if(ad_type==config.ADS_TYPE.GAME_INFINITE_DEGREE_VIDEO) {
+                    ad_id = config.WX_CONFIG.ADS_ID_INFINITE_DEGREE_VIDEO
+                } else if(ad_type==config.ADS_TYPE.GAME_RELIFE_VIDEO) {
+                    ad_id = config.WX_CONFIG.ADS_ID_RELIFE_VIDEO
+                } else if(ad_type==config.ADS_TYPE.GAME_RESTART) {
+                    ad_id = config.WX_CONFIG.ADS_ID_RESTART
+                }
             }
-            // if(SdkUtil.KS_GAME) {
-            // } else {
-            // }
         }
         return ad_id
     }
@@ -294,7 +405,17 @@ export class SdkUtil {
         if(sys.platform==sys.Platform.BYTEDANCE_MINI_GAME) {
             uiManager.Instance().showLoading()
             SdkUtil.videoAd = tt.createRewardedVideoAd({adUnitId: _adUnitId});
-        } else {
+        } 
+        else if(sys.platform==sys.Platform.WECHAT_GAME) {
+            call_back({"isEnded":true})
+            // uiManager.Instance().showLoading()
+            // if(SdkUtil.KS_GAME) {
+            //     SdkUtil.videoAd = ks.createRewardedVideoAd({adUnitId: _adUnitId});
+            // } else {
+            //     SdkUtil.videoAd = wx.createRewardedVideoAd({adUnitId: _adUnitId});
+            // }
+        }
+        else {
             call_back({"isEnded":true})
             return
         }
@@ -327,6 +448,37 @@ export class SdkUtil {
         SdkUtil.videoAd.load()
     }
 
+    //------------------------------  微信相关  ------------------------------//
+
+    // 微信分享
+    public static wxShare(title: string, imageUrl: string='') {
+        // console.log('wx分享=',title, 'imageUrl=',imageUrl)
+        wx.showShareMenu({
+            withShareTicket: true,
+            // shareAppMessage(可以删除):显示分享给好友选项,shareTimeline(可以删除):显示分享至朋友圈选项
+		    // 可以只开启前者。如果要开启后者,则两者必须都开启才能生效。
+            // menus: ['shareAppMessage', 'shareTimeline'],
+            menus: ['shareAppMessage'],
+            complete: () => {}
+        });
+        // 主动分享
+        wx.shareAppMessage({
+            title: title,
+            imageUrl: imageUrl
+        });
+    }
+
+    //------------------------------  快手相关  ------------------------------//
+
+    // 快手分享
+    public static ksShare(title: string, imageUrl:string='', success_cb = null, fail_cb = null) {
+        // console.log('ks分享=',title, 'imageUrl=',imageUrl)
+        ks.shareAppMessage({
+            success:(res)=>{ if(success_cb){ success_cb(res) } },
+            fail:(err)=>{  if(fail_cb){ fail_cb(err) }}
+        });
+    }
+
     //------------------------------  抖音相关  ------------------------------//
 
     // 抖音获取系统信息
@@ -343,6 +495,25 @@ export class SdkUtil {
         }
     }
 
+    // 分享
+    public static ttShare(title:string, desc:string, sucess_cb=null, fail_cb=null) {
+        if(sys.platform == sys.Platform.BYTEDANCE_MINI_GAME) {
+            tt.shareAppMessage({
+                title: title,
+                desc: desc,
+                success() { 
+                    console.log("分享成功") 
+                    // this.showToast('分享成功')
+                    if(sucess_cb) { sucess_cb() }
+                },
+                fail(e) { 
+                    console.log("分享失败",e) 
+                    if(fail_cb) { fail_cb() }
+                },
+            });
+        }
+    }
+
     // 抖音添加快捷键(目前仅支持:抖音(Douyin) 和 抖音极速版(douyin_lite))
     public static ttAddShortcut(onSuccess:Function = null, onFail:Function = null) {
         if(sys.platform == sys.Platform.BYTEDANCE_MINI_GAME) {

+ 3 - 2
assets/script/ui/loading_view.ts

@@ -105,10 +105,11 @@ export class loading_view extends Component {
             GameManager.openId =  openid
             SdkUtil.getUserInfo((data:userInfo)=>{
                 let opt;
+                let platform = GameManager.getPlatformId()
                 if(data!=null){
-                    opt = {"openid":GameManager.openId,"platform":config.Platform.platform,"avatarUrl":data.avatarUrl,"nickName":data.nickName}
+                    opt = {"openid":GameManager.openId,"platform":platform,"avatarUrl":data.avatarUrl,"nickName":data.nickName}
                 }else{
-                    opt = {"openid":GameManager.openId,"platform":config.Platform.platform,"avatarUrl":"","nickName":"大靓仔"}
+                    opt = {"openid":GameManager.openId,"platform":platform,"avatarUrl":"","nickName":"大靓仔"}
                 }
                 http.post(config.API.login,opt,(err,d)=>{
                     if(!err){