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

+ 38 - 39
Scripts/thwj/thwjHelper.js

@@ -76,7 +76,7 @@ function getPrivData(userId, key, defaultValue = "") {
     return lk.getVal(key, defaultValue);
 }
 
-function getPrivDataAsObject(userId, key, defaultValue = "") {
+function getPrivObject(userId, key, defaultValue = "") {
     let str = getPrivData(userId, key, defaultValue);
     let userInfo;
     try {
@@ -153,7 +153,6 @@ async function checkTryExploreAll() {
         }
         break;
     }
-    return true;
 }
 
 async function checkExploreOne(accountData) {
@@ -161,45 +160,45 @@ async function checkExploreOne(accountData) {
     let password = accountData.password;
     lk.log(`开始登录搜索检查:${phone}----${password}`);
 
-    let userInfo = getPrivDataAsObject(phone, 'UserData');
+    let userInfo = getPrivObject(phone, 'UserData');
     let isSucc = false;
     // await loadIndex();
-    // if (userInfo && userInfo.phone && userInfo.password && userInfo.token) {
-    //     let paraData = await getParadropData(userInfo.phone, userInfo.password, userInfo.token);
-    //     if (paraData) {
-    //         if (!checkIsExploring(paraData)) {
-    //             let exploreData = await doExplore(userInfo.phone, userInfo.password, userInfo.token);
-    //             if (exploreData) {
-    //                 isSucc = true;
-    //             } else {
-    //                 logExploringMsg(paraData);
-    //             }
-    //         }
-    //     }
-    // } 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 paraData = await getParadropData(userInfo.phone, userInfo.password, userInfo.token);
-    //                 if (paraData) {
-    //                     if (!checkIsExploring(paraData)) {
-    //                         let exploreData = await doExplore(userInfo.phone, userInfo.password, userInfo.token);
-    //                         if (exploreData) {
-    //                             isSucc = true;
-    //                         }
-    //                     } else {
-    //                         logExploringMsg(paraData);
-    //                     }
-    //                 }
-    //                 break;
-    //             }
-    //         }
-    //     }
-    // }
+    if (userInfo && userInfo.phone && userInfo.password && userInfo.token) {
+        let paraData = await getParadropData(userInfo.phone, userInfo.password, userInfo.token);
+        if (paraData) {
+            if (!checkIsExploring(paraData)) {
+                let exploreData = await doExplore(userInfo.phone, userInfo.password, userInfo.token);
+                if (exploreData) {
+                    isSucc = true;
+                } else {
+                    logExploringMsg(paraData);
+                }
+            }
+        }
+    } 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 paraData = await getParadropData(userInfo.phone, userInfo.password, userInfo.token);
+                    if (paraData) {
+                        if (!checkIsExploring(paraData)) {
+                            let exploreData = await doExplore(userInfo.phone, userInfo.password, userInfo.token);
+                            if (exploreData) {
+                                isSucc = true;
+                            }
+                        } else {
+                            logExploringMsg(paraData);
+                        }
+                    }
+                    break;
+                }
+            }
+        }
+    }
     return isSucc;
 }