shawenguan 1 år sedan
förälder
incheckning
57dcc36294
2 ändrade filer med 11 tillägg och 1 borttagningar
  1. 1 1
      Scripts/wubian/wubianRevokeEntrust.js
  2. 10 0
      Scripts/wubian/wubianSynthesis.js

+ 1 - 1
Scripts/wubian/wubianRevokeEntrust.js

@@ -109,7 +109,7 @@ async function tryRevokeEntrust() {
     let entrustOrderTotal = 0;
     let optOrderNum = 0;
     let nowTime = Date.now();
-    let cmpTime = nowTime - 5 * 24 * 60 * 1000;
+    let cmpTime = (nowTime - 5 * 24 * 60 * 1000) / 1000;
     while (page < 100) {
         let retOrder = await getOrderList(0, page, 13);
         if (retOrder && retOrder.code == 200) {

+ 10 - 0
Scripts/wubian/wubianSynthesis.js

@@ -348,6 +348,8 @@ async function trySynthesize() {
                 setSynthesisAmount(willCount - nSuccCount);
             }
         } else {
+            let nSuccCount = 0;
+            let nFailCount = 0;
             for (let n = 0; n < nRuns; n++) {
                 let startTime = Date.now();
                 for (let i = 0; i < nExcuteCount; i++) {
@@ -361,8 +363,10 @@ async function trySynthesize() {
                     }
                     let errMsg = '';
                     if (retData && retData.code == 200) {
+                        nSuccCount += 1;
                         errMsg = `序号[${+1}]使用材料[${getCombinationGoodsLstText(oneCombination)}]兑换成功`;
                     } else {
+                        nFailCount += 1;
                         errMsg = `序号[${i + 1}]使用材料[${getCombinationGoodsLstText(oneCombination)}]${retData?.msg || '兑换失败'}`;
                     }
                     tipsText += `${errMsg}\n`;
@@ -372,6 +376,12 @@ async function trySynthesize() {
                     await magicJS.utils.sleep(ctrlMillSec - costTime);
                 }
             }
+            if (nSuccCount >= willCount) {
+                tipsText += `由于兑换次数已达到配置的次数,该活动自动禁用\n`;
+                setActivityDisabled(activityId, true);
+            } else {
+                setSynthesisAmount(willCount - nSuccCount);
+            }
         }
     }
     magicJS.notification.appendNotifyInfo(tipsText);