]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Настройка в кроне
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Mon, 30 Jun 2025 17:24:35 +0000 (20:24 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Mon, 30 Jun 2025 17:24:35 +0000 (20:24 +0300)
erp24/commands/CronController.php
erp24/controllers/CategoryPlanController.php
erp24/web/js/category-plan/index.js

index dcf5688059500f6905e66e8c32adf1da48856d72..562b4b79f04f126a5be9230ad8bab4159c7cb72d 100644 (file)
@@ -1746,8 +1746,8 @@ class CronController extends Controller
         $cache    = Yii::$app->cache;
         $task     = $cache->get($cacheKey);
 
-
-        if (!is_array($task) || empty($task['taskName']) || $task['taskName'] !== 'apRecalculate') {
+        $this->stdout(json_encode($task, JSON_UNESCAPED_UNICODE));
+        if (!is_array($task) || empty($task['taskName']) || $task['taskName'] !== 'apRecalculateTask') {
             $this->stdout("No pending apRecalculateTask\n");
             return ExitCode::OK;
         }
@@ -1770,7 +1770,7 @@ class CronController extends Controller
             }
         }
 
-        if (abs(time() - $task['startTime']) > 86400) {
+        if (abs(time() - strtotime($task['startTime'])) > 86400) {
             $this->stdout("Task startTime is out of allowed window\n");
             $task['status'] = 'error';
             $task['error']  = 'Invalid startTime';
index 916cfbc14c513a09165600641e505af26f0121bf..2dbdb248fc214bf196f0239787eb49818c41c3ea 100644 (file)
@@ -1022,14 +1022,14 @@ class CategoryPlanController extends Controller {
             'year'      => $year,
             'month'     => $month,
             'storeId'   => $store,
-            'status'    => 'running',
+            'status'    => 'pending',
             'startTime' => date('Y-m-d H:i:s'),
             'progress'  => 0,
             'error'     => null
         ];
         Yii::$app->cache->set($taskName, $cacheValue, 3600);
 
-        return $this->asJson(['status' => 'started' ]);
+        return $this->asJson(['status' => 'started', 'data' => Yii::$app->cache->get('apRecalculateTask') ]);
     }
 
     public function actionCheckTask()
index 5aeb723bf18c9dde164b23658178902a09f123ee..9b71df241e8f2482c6947fcd52aad1837621ccef 100644 (file)
@@ -168,9 +168,10 @@ $(document).ready(() => {
                 month: $('#dynamicmodel-month').val(),
                 store_id: store_id
             },
-            success: function () {
+            success: function (data) {
                 startTaskPolling();
                 $('#rebuild').prop('disabled', true);
+                console.log(data.data);
             },
             error: function () {
                 alert('Ошибка запуска пересчёта!');