]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
fix(TO8-48): send one summary Telegram message instead of per-order
authorAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Wed, 4 Mar 2026 08:28:00 +0000 (11:28 +0300)
committerAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Wed, 4 Mar 2026 08:28:00 +0000 (11:28 +0300)
erp24/services/MarketplaceService.php

index 87e94a2b2ef746cdee4eb9197aab9287763dc000..6ce5f509c3ace49ab9576341712923812c032dd3 100644 (file)
@@ -3501,16 +3501,28 @@ class MarketplaceService
             ->all();
 
         $count = 0;
+        $orderIds = [];
         foreach ($orders as $order) {
             $order->readyto_1c = 1;
             if ($order->save()) {
                 $count++;
-                Yii::warning("Заказ ID {$order->id} автоматически помечен как готовый к отправке в 1C (таймаут {$minutes} мин).");
+                $orderIds[] = $order->marketplace_order_id;
             } else {
                 Yii::error('Ошибка установки readyto_1c = 1 у заказа ID ' . $order->id . ': ' . json_encode($order->getErrors(), JSON_UNESCAPED_UNICODE));
             }
         }
 
+        if ($count > 0) {
+            $message = "Автоотправка в 1С (таймаут {$minutes} мин): {$count} заказов — " . implode(', ', $orderIds);
+            Yii::warning($message);
+            $isDev = TelegramService::isDevEnv();
+            TelegramService::sendErrorToTelegramMessage(
+                TelegramService::escapeMarkdown($message),
+                false,
+                $isDev
+            );
+        }
+
         return $count;
     }