|
|
@@ -232,59 +232,67 @@ export class LoginData {
|
|
|
this.checkLogin();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
+ /**
|
|
|
* 检测登录
|
|
|
* @returns
|
|
|
*/
|
|
|
- private async checkLogin() {
|
|
|
- //checkLogin
|
|
|
- let tmp_key = '';
|
|
|
- if (gData.wechatData.code != null) {
|
|
|
- tmp_key = this.sessionKey;
|
|
|
- }
|
|
|
- else {
|
|
|
- tmp_key = mk.encrypt.randomString();
|
|
|
- }
|
|
|
+ private async checkLogin() {
|
|
|
+ //checkLogin
|
|
|
+ let tmp_key = '';
|
|
|
+ if (gData.wechatData.code != null) {
|
|
|
+ tmp_key = this.sessionKey;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ tmp_key = mk.encrypt.randomString();
|
|
|
+ }
|
|
|
|
|
|
- let data = {
|
|
|
- "tmp_key": tmp_key,
|
|
|
- "uin": this.uin,
|
|
|
- "login_ticket": this.loginTicket,
|
|
|
- "appId": gData.appData.appId
|
|
|
- }
|
|
|
- let response = await mk.http.sendRequest('checklogin', 'POST', JSON.stringify(data));
|
|
|
- if (response.errcode != 0) {
|
|
|
- if (response.errcode == 403) {
|
|
|
- console.log('block 403');
|
|
|
- gData.warnTipData.setSolution(4);
|
|
|
- }
|
|
|
- return;
|
|
|
- }
|
|
|
- let decryptData;
|
|
|
- if (gData.wechatData.code != null) {
|
|
|
- decryptData = mk.encrypt.decrypt(response.encrypt, this.sessionKey, gData.appData.appId);
|
|
|
- }
|
|
|
- else {
|
|
|
- decryptData = mk.encrypt.decrypt(response.encrypt, tmp_key, gData.appData.appId);
|
|
|
+ let data = {
|
|
|
+ "tmp_key": tmp_key,
|
|
|
+ "uin": this.uin,
|
|
|
+ "login_ticket": this.loginTicket,
|
|
|
+ "appId": gData.appData.appId
|
|
|
+ }
|
|
|
+ let response = await mk.http.sendRequest('checklogin', 'POST', JSON.stringify(data));
|
|
|
+ if (response.errcode != 0) {
|
|
|
+ if (response.errcode == 403) {
|
|
|
+ console.log('block 403');
|
|
|
+ gData.warnTipData.setSolution(4);
|
|
|
}
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let decryptData;
|
|
|
+ if (gData.wechatData.code != null) {
|
|
|
+ decryptData = mk.encrypt.decrypt(response.encrypt, this.sessionKey, gData.appData.appId);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ decryptData = mk.encrypt.decrypt(response.encrypt, tmp_key, gData.appData.appId);
|
|
|
+ }
|
|
|
|
|
|
- let parseData = JSON.parse(decryptData);
|
|
|
- this.sessionKey = parseData.session_key;
|
|
|
- mk.console.logSingle("[FC]checkLogin decrypt", parseData);
|
|
|
- mk.storage.setStorage(StorageKey.sessionKey, this.sessionKey);
|
|
|
- if (gData.wechatData.code != null) {
|
|
|
- if (this.isNew) {
|
|
|
- gData.wechatData.code = null;
|
|
|
- this.reload();
|
|
|
- }
|
|
|
- else {
|
|
|
- this.getUserInfo();
|
|
|
- }
|
|
|
+ let parseData = JSON.parse(decryptData);
|
|
|
+ this.sessionKey = parseData.session_key;
|
|
|
+ mk.console.logSingle("[FC]checkLogin decrypt", parseData);
|
|
|
+ console.log("this.sessionKey ", this.sessionKey);
|
|
|
+ mk.storage.setStorage(StorageKey.sessionKey, this.sessionKey);
|
|
|
+ if (gData.wechatData.code != null) {
|
|
|
+ if (this.isNew) {
|
|
|
+ console.log('KKKK 1 ', this.uin)
|
|
|
+ this.getUserInfo();
|
|
|
}
|
|
|
else {
|
|
|
- this.getUserInfo();
|
|
|
+ console.log('KKKK 2 ', this.uin)
|
|
|
+ this.isNew = false;
|
|
|
+ gData.wechatData.code = null;
|
|
|
+
|
|
|
+ cc.audioEngine.stopAll();
|
|
|
+ //调用Android的更好
|
|
|
+ cc.game.restart();
|
|
|
}
|
|
|
}
|
|
|
+ else {
|
|
|
+ console.log('KKKK 3 ', this.uin)
|
|
|
+ this.getUserInfo();
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
private async getUserInfo() {
|
|
|
this.getAccountInfo();
|