shawenguan 1 an în urmă
părinte
comite
b04d952e82
1 a modificat fișierele cu 83 adăugiri și 16 ștergeri
  1. 83 16
      Scripts/168/diiiLotteryHelper.js

+ 83 - 16
Scripts/168/diiiLotteryHelper.js

@@ -49,6 +49,7 @@ async function Main() {
         checkHandleRequest();
     } else {
         updateRequestHeaders();
+        await doTryCheckin();
         // await doTestBet();
     }
     magicJS.notification.msg('');
@@ -139,16 +140,16 @@ function handleTokenAndCookie() {
 }
 
 function handleSignInPromoDetail() {
-    let rspData = getResponsePlainData();
-    if (!rspData) {
-        return;
-    }
-    if (rspData.statusCode != 200) {
-        return;
-    }
-    let result = rspData.result;
-    result.signinPromoToday = false;
-    gRetBody = rspData;
+    // let rspData = getResponsePlainData();
+    // if (!rspData) {
+    //     return;
+    // }
+    // if (rspData.statusCode != 200) {
+    //     return;
+    // }
+    // let result = rspData.result;
+    // result.signinPromoToday = false;
+    // gRetBody = rspData;
 }
 
 async function doNetworkTest() {
@@ -172,34 +173,47 @@ async function doTestBet() {
     if (planStr.length == 0) {
         return;
     }
-    let betRet = await doDragonBet(drawIssue, planStr, 1);
+    let betRet = await doDragonBet(drawIssue, 1, planStr, 1);
     if (!betRet) {
         let loginRet = await tryReLogin();
         if (!loginRet) {
             return;
         }
-        betRet = await doDragonBet(drawIssue, planStr, 1);
+        betRet = await doDragonBet(drawIssue, 1, planStr, 1);
     }
     return betRet;
 }
 
-async function doDragonBet(drawIssue, planStr, betAmount) {
+async function doDragonBet(drawIssue, ranking, planStr, betAmount) {
+    let rowTextArr = [
+        '',
+        '冠军',
+        '亚军',
+        '第三名',
+        '第四名',
+        '第五名',
+        '第六名',
+        '第七名',
+        '第八名',
+        '第九名',
+        '第十名',
+    ];
     let lotteryType = 'SGFT';
     let numArr = planStr.split(',');
     let bets = [];
     for (let i = 0; i < numArr.length; i++) {
-        let numStr = numArr[i].trim();
+        let numStr = String(parseInt(numArr[i].trim()));
         let element = {
             amount: betAmount,
             contentText: numStr,
             contents: numStr,
             drawNumber: String(drawIssue),
-            game: "B1",
+            game: `B${ranking}`,
             groupText: "1 ~ 10名",
             ignore: "false",
             lottery: lotteryType,
             odds: 9.91,
-            rowText: "冠军"
+            rowText: rowTextArr[ranking],
         };
         bets.push(element);
     }
@@ -211,6 +225,59 @@ async function doDragonBet(drawIssue, planStr, betAmount) {
     return result;
 }
 
+async function doTryCheckin() {
+    let result = await loadSigninPromoDetail();
+    if (!result) {
+        return;
+    }
+    if (result.statusCode != 200) {
+        return;
+    }
+    let detail = result.result;
+    let loginDayCount = detail.loginDayCount;
+    let currentDayCount = detail.currentDayCount;
+    if (detail.depositCompleted) {
+        magicJS.notification.appendNotifyInfo(`⚠️今日已存储(${currentDayCount}/${loginDayCount})`);
+    } else {
+        magicJS.notification.appendNotifyInfo(`❌今日未存储(${currentDayCount}/${loginDayCount})`);
+    }
+    if (detail.signinPromoToday) {
+        //已签到
+        magicJS.logger.info(`今日已签到(${currentDayCount}/${loginDayCount})`);
+        magicJS.notification.appendNotifyInfo(`⚠️今日已签到(${currentDayCount}/${loginDayCount})`);
+        return;
+    }
+    let activeId = detail.activeId;
+    let checkinRet = await signinPromoCheckin(activeId);
+    if (!checkinRet) {
+        magicJS.notification.appendNotifyInfo(`❌签到异常(${currentDayCount}/${loginDayCount}),请重试`);
+        return;
+    }
+    if (checkinRet.statusCode != 200) {
+        magicJS.notification.appendNotifyInfo(`❌签到失败(${currentDayCount}/${loginDayCount}),请重试`);
+        return;
+    }
+    let vFinalResult = checkinRet.result;
+    magicJS.logger.info(`今日签到成功(${currentDayCount}/${loginDayCount})`);
+    magicJS.notification.appendNotifyInfo(`🎉今日签到成功(${currentDayCount}/${loginDayCount})`);
+}
+
+async function loadSigninPromoDetail() {
+    const url = `https://${gCaiLeHost}/rest/member/loadSigninPromoDetail`;
+    const reqData = null;
+    let result = await clyRequest('get', url, reqData);
+    return result;
+}
+
+async function signinPromoCheckin(activeId) {
+    const url = `https://${gCaiLeHost}/rest/member/signinPromoCheckin`;
+    const reqData = {
+        activeId: activeId,
+    };
+    let result = await clyRequest('get', url, reqData);
+    return result;
+}
+
 
 async function tryReLogin() {
     let recognizeRet = await tryGenerateCaptchaAndRecognize(3);