904118851 8 ヶ月 前
コミット
e8e7f99beb
1 ファイル変更4 行追加3 行削除
  1. 4 3
      PULL_DATA_FACTORY/PULL_DATA.js

+ 4 - 3
PULL_DATA_FACTORY/PULL_DATA.js

@@ -36,7 +36,8 @@ async function processTask(timeRange){
             throw "没有数据了"
         }
         if(timeRange!=null){
-            cur_day_data[timeRange.today][timeRange.start] = {count:response.result.count}
+            const today = new Date().toISOString().split('T')[0];
+            cur_day_data[today][timeRange.start] = {count:response.result.count}
             const updateResult = await manager.updateRecord(today,cur_day_data[timeRange.today]);
         }
 
@@ -179,7 +180,7 @@ CMD.init = async function(){
         _24HourRanges = CMD.generate24HourRanges()
         // 定义任务回调函数
         const taskCallback = async (context) => {
-            const { timeRange, executionTime } = context;
+            var { timeRange, executionTime } = context;
             
             console.log('执行任务:', {
                 时间区间: timeRange.name,
@@ -187,7 +188,6 @@ CMD.init = async function(){
                 执行时间: executionTime
             });
             const today = new Date().toISOString().split('T')[0];
-            timeRange.today = today
             for (const key in cur_day_data) {
                 if (Object.prototype.hasOwnProperty.call(cur_day_data, key)) {
                     if(key==today){
@@ -262,6 +262,7 @@ CMD.init = async function(){
             timeFormat: new Date(timestamp).toLocaleString() // 可读的时间格式
         });
     }
+    console.log("ranges:",ranges)
     return ranges;
 }