shawenguan 2 лет назад
Родитель
Сommit
99aa4ab696
1 измененных файлов с 39 добавлено и 34 удалено
  1. 39 34
      Scripts/thwj/thwjHelper.js

+ 39 - 34
Scripts/thwj/thwjHelper.js

@@ -145,36 +145,38 @@ async function checkLogin(accountData) {
 
     let userInfo = getPrivData(phone, 'UserData');
     let isSucc = false;
-    // await loadIndex();
-    if (userInfo.phone && userInfo.password && userInfo.token) {
-        let isNeddExplore = await checkNeedExplore(userInfo.phone, userInfo.password, userInfo.token);
-        if (isNeddExplore) {
-            let exploreData = await doExplore(userInfo.phone, userInfo.password, userInfo.token);
-            if (exploreData) {
-                isSucc = true;
-            }
-        }
-    } else {
-        let tryCount = 10;
-        for (let i = 0; i < tryCount; i++) {
-            let codeStr = await checkGetVerifyCodeImgNum();
-            if (codeStr) {
-                lk.log(`尝试第${i + 1}次...`);
-                userInfo = await doLogin(phone, password, codeStr);
-                if (userInfo) {
-                    let isNeddExplore = await checkNeedExplore(userInfo.phone, userInfo.password, userInfo.token);
-                    if (isNeddExplore) {
-                        let exploreData = await doExplore(userInfo.phone, userInfo.password, userInfo.token);
-                        if (exploreData) {
-                            isSucc = true;
-                        }
-                    }
-                    break;
-                } else {
-                }
-            }
-        }
-    }
+    await loadIndex();
+    // if (userInfo.phone && userInfo.password && userInfo.token) {
+    //     let isNeddExplore = await checkNeedExplore(userInfo.phone, userInfo.password, userInfo.token);
+    //     if (isNeddExplore) {
+    //         let exploreData = await doExplore(userInfo.phone, userInfo.password, userInfo.token);
+    //         if (exploreData) {
+    //             isSucc = true;
+    //         }
+    //     } else {
+    //         lk.log(`已在探索中...`);
+    //     }
+    // } else {
+    //     let tryCount = 10;
+    //     for (let i = 0; i < tryCount; i++) {
+    //         let codeStr = await checkGetVerifyCodeImgNum();
+    //         if (codeStr) {
+    //             lk.log(`尝试第${i + 1}次...`);
+    //             userInfo = await doLogin(phone, password, codeStr);
+    //             if (userInfo) {
+    //                 let isNeddExplore = await checkNeedExplore(userInfo.phone, userInfo.password, userInfo.token);
+    //                 if (isNeddExplore) {
+    //                     let exploreData = await doExplore(userInfo.phone, userInfo.password, userInfo.token);
+    //                     if (exploreData) {
+    //                         isSucc = true;
+    //                     }
+    //                 }
+    //                 break;
+    //             } else {
+    //             }
+    //         }
+    //     }
+    // }
     return isSucc;
 }
 
@@ -211,12 +213,13 @@ function loadIndex() {
                         if (_response.status == 200) {
                             ret = true;
                             // lk.log(JSON.stringify(_response.headers));
-                            let cookie = _response.headers['Set-Cookie']; 4
+                            let cookie = _response.headers['Set-Cookie'];
                             if (cookie) {
                                 let key = `${thwjStoreKeyPrefix}CommonCookieKey`;
-                                lk.setVal(key, cookie);
-                                CommonCookie = cookie;
-                                CommonHeaders['Cookie'] = CommonCookie;
+                                lk.log(cookie);
+                                // lk.setVal(key, cookie);
+                                // CommonCookie = cookie;
+                                // CommonHeaders['Cookie'] = CommonCookie;
                             }
                         }
                     }
@@ -538,6 +541,7 @@ async function doLogin(phone, password, verifyCode) {
                         if (info.code == 1 && info.data) {
                             let userInfo = info.data.user_info;
                             setPrivData(userInfo.phone, 'UserData', userInfo);
+                            lk.log(`账号[${phone}]登录成功`);
                             lk.appendNotifyInfo(`🎉账号[${phone}]登录成功`);
                             ret = userInfo;
                         } else {
@@ -638,6 +642,7 @@ async function getParadropData(phone, password, token) {
                         let info = JSON.parse(data);
                         if (info.code == 1 && info.data) {
                             ret = info.data;
+                            lk.log(`获取空投数据`);
                         } else {
                             lk.log(`获取空投数据失败,响应:${data}`);
                         }