|
@@ -301,7 +301,7 @@ async function checkLogin(username, password, extData){
|
|
|
magicJS.http.post(options).then(resp => {
|
|
magicJS.http.post(options).then(resp => {
|
|
|
const rspData = resp.body;
|
|
const rspData = resp.body;
|
|
|
try {
|
|
try {
|
|
|
- magicJS.logger.info(`登录响应头部:${JSON.stringify(resp.headers)}`);
|
|
|
|
|
|
|
+ // magicJS.logger.info(`登录响应头部:${JSON.stringify(resp.headers)}`);
|
|
|
magicJS.logger.info(`登录响应数据:${JSON.stringify(rspData)}`);
|
|
magicJS.logger.info(`登录响应数据:${JSON.stringify(rspData)}`);
|
|
|
resolve(rspData);
|
|
resolve(rspData);
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
@@ -472,23 +472,10 @@ async function lotteryDraw(url, lt){
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-async function wapLogin(username, password){
|
|
|
|
|
|
|
+async function checkWapLogin(username, password, extData){
|
|
|
return new Promise(async (resolve, reject) => {
|
|
return new Promise(async (resolve, reject) => {
|
|
|
- let url = await getLoginUrl();
|
|
|
|
|
- let extData = null;
|
|
|
|
|
- if(url){
|
|
|
|
|
- extData = await getLoginData(url);
|
|
|
|
|
- }
|
|
|
|
|
- if(!extData){
|
|
|
|
|
- resolve();
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- magicJS.logger.info(`登录1`);
|
|
|
|
|
username = rsaEncode(extData.j_rsakey, username);
|
|
username = rsaEncode(extData.j_rsakey, username);
|
|
|
- magicJS.logger.info(`登录2`);
|
|
|
|
|
password = rsaEncode(extData.j_rsakey, password);
|
|
password = rsaEncode(extData.j_rsakey, password);
|
|
|
- magicJS.logger.info(`username:${username}`);
|
|
|
|
|
- magicJS.logger.info(`password:${password}`);
|
|
|
|
|
let reqData = {
|
|
let reqData = {
|
|
|
appKey: "cloud",
|
|
appKey: "cloud",
|
|
|
accountType: '02',
|
|
accountType: '02',
|
|
@@ -527,7 +514,7 @@ async function wapLogin(username, password){
|
|
|
magicJS.http.get(options).then(resp => {
|
|
magicJS.http.get(options).then(resp => {
|
|
|
try {
|
|
try {
|
|
|
const rspData = resp.body;
|
|
const rspData = resp.body;
|
|
|
- magicJS.logger.info(`接口数据:${typeof(rspData)}`);
|
|
|
|
|
|
|
+ magicJS.logger.info(`登录响应数据:${JSON.stringify(rspData)}`);
|
|
|
resolve(rspData);
|
|
resolve(rspData);
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
|
resolve();
|
|
resolve();
|
|
@@ -540,6 +527,28 @@ async function wapLogin(username, password){
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function wapLogin(username, password){
|
|
|
|
|
+ return new Promise(async (resolve, reject) => {
|
|
|
|
|
+ let url = await getLoginUrl();
|
|
|
|
|
+ let extData = null;
|
|
|
|
|
+ if(url){
|
|
|
|
|
+ extData = await getLoginData(url);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!extData){
|
|
|
|
|
+ resolve(null);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ let loginData = await checkWapLogin(username, password, extData);
|
|
|
|
|
+ if(loginData && loginData.result == 0){
|
|
|
|
|
+ // toUrl=做任务 抽好礼
|
|
|
|
|
+ await tryJumpToUrl(loginData.toUrl);
|
|
|
|
|
+ resolve(extData);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ resolve(null);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
Main();
|
|
Main();
|
|
|
|
|
|
|
|
|
|
|