$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);
+ }
}
}
// Помечаем отправленные\r
$this->markIssuesAsNotified($issuesToSave);\r
} else {\r
- $result->telegramSent = true;\r
- $result->emailSent = true;\r
$this->logInfo('Нет проблемных заказов, уведомления не требуются');\r
}\r
\r
->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
->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