shawenguan hai 1 ano
pai
achega
0217e20f8d
Modificáronse 1 ficheiros con 17 adicións e 7 borrados
  1. 17 7
      Scripts/unicom/unicomRechargeDisc.js

+ 17 - 7
Scripts/unicom/unicomRechargeDisc.js

@@ -164,12 +164,20 @@ async function tryGrab() {
 }
 
 async function doGrabByNormal() {
+    let theAcType = 'AM';
+    let nowDate = new Date();
+    if (nowDate.getHours() > 12) {
+        theAcType = 'PM';
+    }
     let tipsText = ``;
     let taskInfoList = getTaskInfoList();
     for (let i = 0; i < taskInfoList.length; i++) {
         const taskInfo = taskInfoList[i];
         const activityId = taskInfo.acId;
         const activityType = taskInfo.acType;
+        if (theAcType != activityType) {
+            continue;
+        }
         const taskList = taskInfo.taskList;
         let taskLstDict = {};
         for (let j = 0; j < taskList.length; j++) {
@@ -181,13 +189,15 @@ async function doGrabByNormal() {
         }
         let urlMap = await getTaskUrlMapData(activityId);
         magicJS.logger.info(`${activityId} ${JSON.stringify(urlMap)}`);
-        // if (urlMap) {
-        //     for (let id in urlMap) {
-        //         const task = taskLstDict[id];
-        //         const url = urlMap[id];
-        //         let result = await grabDiscCoupon(url);
-        //     }
-        // }
+        if (urlMap) {
+            for (let id in urlMap) {
+                const task = taskLstDict[id];
+                const url = urlMap[id];
+                magicJS.logger.info(`${id} ${url}`);
+                magicJS.logger.info(`${JSON.stringify(task)}`);
+                // let result = await grabDiscCoupon(url);
+            }
+        }
     }
     if (tipsText.length > 0) {
         magicJS.notification.appendNotifyInfo(`领取结果如下:\n${tipsText}`);