|
|
@@ -76,6 +76,18 @@ function getPrivData(userId, key, defaultValue = "") {
|
|
|
return lk.getVal(key, defaultValue);
|
|
|
}
|
|
|
|
|
|
+function getPrivDataAsObject(userId, key, defaultValue) {
|
|
|
+ let str = getPrivData(userId, key, defaultValue);
|
|
|
+ let userInfo;
|
|
|
+ try {
|
|
|
+ if (!lk.isEmpty(str)) {
|
|
|
+ userInfo = JSON.parse(str);
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ lk.logErr(error);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
function handleRspCookie() {
|
|
|
for (let k in $response) {
|
|
|
lk.log(k);
|
|
|
@@ -148,18 +160,20 @@ async function checkExploreOne(accountData) {
|
|
|
let password = accountData.password;
|
|
|
lk.log(`开始登录搜索检查:${phone}----${password}`);
|
|
|
|
|
|
- let userInfo = getPrivData(phone, 'UserData');
|
|
|
+ let userInfo = getPrivDataAsObject(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;
|
|
|
+ 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 {
|
|
|
- lk.log(`已在探索中...`);
|
|
|
}
|
|
|
} else {
|
|
|
let tryCount = 10;
|
|
|
@@ -169,18 +183,15 @@ async function checkExploreOne(accountData) {
|
|
|
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;
|
|
|
- }
|
|
|
- } else {
|
|
|
- let orderData = data.paradrop_order_data;
|
|
|
- if (orderData && orderData.start_time && orderData.end_time) {
|
|
|
- let stimeStr = lk.formatDate(new Date(orderData.start_time), "yyyy-MM-dd hh:mm:ss");
|
|
|
- let etimeStr = lk.formatDate(new Date(orderData.end_time), "yyyy-MM-dd hh:mm:ss");
|
|
|
- lk.log(`此时间${stimeStr}-${etimeStr}探索中`);
|
|
|
+ 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;
|
|
|
@@ -191,13 +202,26 @@ async function checkExploreOne(accountData) {
|
|
|
return isSucc;
|
|
|
}
|
|
|
|
|
|
-async function checkNeedExplore(phone, password, token) {
|
|
|
+function checkNeedExplore(phone, password, token) {
|
|
|
let data = await getParadropData(phone, password, token);
|
|
|
+ return !checkIsExploring(data);
|
|
|
+}
|
|
|
+
|
|
|
+function checkIsExploring(data) {
|
|
|
let orderData = data.paradrop_order_data;
|
|
|
if (orderData && orderData.start_time && orderData.end_time) {
|
|
|
- return false;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
+function logExploringMsg(paraData) {
|
|
|
+ let orderData = paraData.paradrop_order_data;
|
|
|
+ if (orderData && orderData.start_time && orderData.end_time) {
|
|
|
+ let stimeStr = lk.formatDate(new Date(orderData.start_time), "yyyy-MM-dd hh:mm:ss");
|
|
|
+ let etimeStr = lk.formatDate(new Date(orderData.end_time), "yyyy-MM-dd hh:mm:ss");
|
|
|
+ lk.log(`此时间${stimeStr}-${etimeStr}探索中`);
|
|
|
}
|
|
|
- return true;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -687,7 +711,6 @@ async function getParadropData(phone, password, token) {
|
|
|
lk.log(`获取空投数据发生错误`);
|
|
|
lk.execFail();
|
|
|
} else {
|
|
|
- lk.log(data);
|
|
|
let info = JSON.parse(data);
|
|
|
if (info && info.code == 1 && info.data) {
|
|
|
lk.log(`获取空投数据成功`);
|