]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Правки по ревью
authorVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Tue, 27 Jan 2026 09:48:09 +0000 (12:48 +0300)
committerVladimir Fomichev <vladimir.fomichev@erp-flowers.ru>
Tue, 27 Jan 2026 09:48:09 +0000 (12:48 +0300)
erp24/commands/MarketplaceController.php
erp24/services/OrderControlReportService.php

index 0962267ac038085184375a17cbee8b6d28257a34..e3ce4618a023627442a01e573f96d447e812d58a 100644 (file)
@@ -445,38 +445,40 @@ class MarketplaceController extends Controller
                 $result->totalIssues > 0 ? BaseConsole::FG_RED : BaseConsole::FG_GREEN);
             $this->stdout("Сохранено состояний: {$result->statesSaved}\n", BaseConsole::FG_CYAN);
 
-            // Статус отправки
-            $this->stdout("\nОтправка уведомлений:\n", BaseConsole::FG_YELLOW);
+            // Статус отправки (только если есть проблемы)
+            if ($result->hasIssues()) {
+                $this->stdout("\nОтправка уведомлений:\n", BaseConsole::FG_YELLOW);
 
-            if ($asyncMode) {
-                // Асинхронный режим — задачи поставлены в очередь
-                if ($result->telegramSent) {
-                    $this->stdout("  Telegram: ✅ поставлено в очередь\n", BaseConsole::FG_GREEN);
-                } else {
-                    $errorMsg = $result->telegramError ?? 'не удалось поставить в очередь';
-                    $this->stdout("  Telegram: ❌ ошибка - {$errorMsg}\n", BaseConsole::FG_RED);
-                }
+                if ($asyncMode) {
+                    // Асинхронный режим — задачи поставлены в очередь
+                    if ($result->telegramSent) {
+                        $this->stdout("  Telegram: ✅ поставлено в очередь\n", BaseConsole::FG_GREEN);
+                    } else {
+                        $errorMsg = $result->telegramError ?? 'не удалось поставить в очередь';
+                        $this->stdout("  Telegram: ❌ ошибка - {$errorMsg}\n", BaseConsole::FG_RED);
+                    }
 
-                if ($result->emailSent) {
-                    $this->stdout("  Email: ✅ поставлено в очередь\n", BaseConsole::FG_GREEN);
-                } else {
-                    $errorMsg = $result->emailError ?? 'не удалось поставить в очередь';
-                    $this->stdout("  Email: ❌ ошибка - {$errorMsg}\n", BaseConsole::FG_RED);
-                }
-            } else {
-                // Синхронный режим — отправлено сразу
-                if ($result->telegramSent) {
-                    $this->stdout("  Telegram: ✅ отправлено\n", BaseConsole::FG_GREEN);
+                    if ($result->emailSent) {
+                        $this->stdout("  Email: ✅ поставлено в очередь\n", BaseConsole::FG_GREEN);
+                    } else {
+                        $errorMsg = $result->emailError ?? 'не удалось поставить в очередь';
+                        $this->stdout("  Email: ❌ ошибка - {$errorMsg}\n", BaseConsole::FG_RED);
+                    }
                 } else {
-                    $errorMsg = $result->telegramError ?? 'неизвестная ошибка';
-                    $this->stdout("  Telegram: ❌ ошибка - {$errorMsg}\n", BaseConsole::FG_RED);
-                }
+                    // Синхронный режим — отправлено сразу
+                    if ($result->telegramSent) {
+                        $this->stdout("  Telegram: ✅ отправлено\n", BaseConsole::FG_GREEN);
+                    } else {
+                        $errorMsg = $result->telegramError ?? 'неизвестная ошибка';
+                        $this->stdout("  Telegram: ❌ ошибка - {$errorMsg}\n", BaseConsole::FG_RED);
+                    }
 
-                if ($result->emailSent) {
-                    $this->stdout("  Email: ✅ отправлено\n", BaseConsole::FG_GREEN);
-                } else {
-                    $errorMsg = $result->emailError ?? 'неизвестная ошибка';
-                    $this->stdout("  Email: ❌ ошибка - {$errorMsg}\n", BaseConsole::FG_RED);
+                    if ($result->emailSent) {
+                        $this->stdout("  Email: ✅ отправлено\n", BaseConsole::FG_GREEN);
+                    } else {
+                        $errorMsg = $result->emailError ?? 'неизвестная ошибка';
+                        $this->stdout("  Email: ❌ ошибка - {$errorMsg}\n", BaseConsole::FG_RED);
+                    }
                 }
             }
 
index 967b8e780ef0dfd9649fd61b015d2fbcc25a31e4..ba5953581e09c0d98f48c29e6cc1b075ca7341e9 100644 (file)
@@ -243,8 +243,6 @@ class OrderControlReportService
                 // Помечаем отправленные\r
                 $this->markIssuesAsNotified($issuesToSave);\r
             } else {\r
-                $result->telegramSent = true;\r
-                $result->emailSent = true;\r
                 $this->logInfo('Нет проблемных заказов, уведомления не требуются');\r
             }\r
 \r
@@ -324,7 +322,9 @@ class OrderControlReportService
             ->leftJoin(['mosub' => 'marketplace_order_status_types'], 'mosub.id = mo.substatus_id')\r
             ->where(['mo.fake' => 0])\r
             ->andWhere(['not', ['mo.status_processing_1c' => null]])\r
-            ->andWhere(['in', new Expression('mo.status_processing_1c::integer'), $rmkCourierIds])\r
+            ->andWhere(new Expression(\r
+                'CAST(mo.status_processing_1c AS integer) IN (' . implode(',', array_map('intval', $rmkCourierIds)) . ')'\r
+            ))\r
             ->andWhere(['>=', 'mo.updated_at', $startDateStr])\r
             ->andWhere(['<=', 'mo.updated_at', $endDateStr])\r
             ->andWhere([\r
@@ -639,7 +639,9 @@ class OrderControlReportService
             ->andWhere(['<=', 'mo.updated_at', $endDateStr])\r
             ->andWhere(['most.code' => MarketplaceOrderStatusTypes::CANSELLED_CODE])\r
             ->andWhere(['not', ['mo.status_processing_1c' => null]])\r
-            ->andWhere(['in', new Expression('mo.status_processing_1c::integer'), $rmkCancelIds])\r
+            ->andWhere(new Expression(\r
+                'CAST(mo.status_processing_1c AS integer) IN (' . implode(',', array_map('intval', $rmkCancelIds)) . ')'\r
+            ))\r
             ->andWhere(new Expression('COALESCE(mo.cancelled_order_sent, 0) = 0'))\r
             ->orderBy(['cs.name' => SORT_ASC, 'mo.creation_date' => SORT_DESC])\r
             ->all();\r