From 4d4ad1daa25ccb496cbd1eaf2e1f64464c1301c3 Mon Sep 17 00:00:00 2001 From: Vladimir Fomichev Date: Mon, 26 Jan 2026 12:22:28 +0300 Subject: [PATCH] =?utf8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=BD=D0=BE=D1=81=20?= =?utf8?q?=D1=81=D0=B5=D0=BA=D1=80=D0=B5=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/.env.example | 9 +++++++++ erp24/config/params.php | 13 ++++++++++++ erp24/services/MarketplaceService.php | 29 +++++++++++---------------- 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/erp24/.env.example b/erp24/.env.example index 50f922a3..804571fb 100644 --- a/erp24/.env.example +++ b/erp24/.env.example @@ -199,6 +199,15 @@ EMAIL_FLOW_PASSWORD= IMAP_EMAIL= IMAP_PASSWORD= +# === IMAP Flowwow (MarketplaceService) === +# Primary mailbox for Flowwow order emails +IMAP_FLOWWOW_HOST={imap.yandex.ru:993/imap/ssl} +IMAP_FLOWWOW_USERNAME=flow@bazacvetov24.ru +IMAP_FLOWWOW_PASSWORD=your_flowwow_password_here +# Alternate mailbox for Flowwow order emails +IMAP_FLOWWOW_ALT_USERNAME=Zakaz-bazacvetov24@yandex.ru +IMAP_FLOWWOW_ALT_PASSWORD=your_flowwow_alt_password_here + # === HTTP BASIC AUTH (legacy integrations) === # Credentials for legacy HTTP Basic Auth endpoints BASIC_AUTH_KASSEAR_USER= diff --git a/erp24/config/params.php b/erp24/config/params.php index 35024f8f..8775208b 100644 --- a/erp24/config/params.php +++ b/erp24/config/params.php @@ -16,6 +16,19 @@ return [ 'YANDEX_MARKET_API_KEY' => getenv('YANDEX_MARKET_API_KEY') ?: '', 'RABBIT_HOST' => getenv('RABBIT_HOST') ?: 'localhost', + // IMAP Flowwow (MarketplaceService) + 'IMAP_FLOWWOW' => [ + 'host' => getenv('IMAP_FLOWWOW_HOST') ?: '{imap.yandex.ru:993/imap/ssl}', + 'primary' => [ + 'username' => getenv('IMAP_FLOWWOW_USERNAME') ?: '', + 'password' => getenv('IMAP_FLOWWOW_PASSWORD') ?: '', + ], + 'alternate' => [ + 'username' => getenv('IMAP_FLOWWOW_ALT_USERNAME') ?: '', + 'password' => getenv('IMAP_FLOWWOW_ALT_PASSWORD') ?: '', + ], + ], + // Отчёт контроля статусов заказов маркетплейсов (ТЗ ERP-36J) // Расписание: 08:00 и 20:00 MSK // Типы проблем: "Завис в доставке", "Успех без чека", "Отмена без обработки" diff --git a/erp24/services/MarketplaceService.php b/erp24/services/MarketplaceService.php index 81365810..edbd900d 100644 --- a/erp24/services/MarketplaceService.php +++ b/erp24/services/MarketplaceService.php @@ -2085,15 +2085,14 @@ class MarketplaceService self::SUBJECT_DELIVERED, ]; - $hostname = '{imap.yandex.ru:993/imap/ssl}'; + $imapConfig = Yii::$app->params['IMAP_FLOWWOW']; + $hostname = $imapConfig['host']; if ($useAlternateMailbox) { - $username = 'Zakaz-bazacvetov24@yandex.ru'; - $password = 'jyxnwwwvgpwhzbdu'; - $searchCriteria .= ''; + $username = $imapConfig['alternate']['username']; + $password = $imapConfig['alternate']['password']; } else { - $username = 'flow@bazacvetov24.ru'; - $password = 'ctqamxqeshgxwsgn'; - $searchCriteria .= ''; + $username = $imapConfig['primary']['username']; + $password = $imapConfig['primary']['password']; } if ($progressCallback) { @@ -2119,11 +2118,11 @@ class MarketplaceService $countAllMessages = 0; $countProcessedMessages = 0; $excludeFolders = [ - '{imap.yandex.ru:993/imap/ssl}Drafts', - '{imap.yandex.ru:993/imap/ssl}Sent', - '{imap.yandex.ru:993/imap/ssl}Spam', - '{imap.yandex.ru:993/imap/ssl}Trash', - '{imap.yandex.ru:993/imap/ssl}Outbox', + $hostname . 'Drafts', + $hostname . 'Sent', + $hostname . 'Spam', + $hostname . 'Trash', + $hostname . 'Outbox', ]; foreach ($folders as $folder) { if (in_array($folder, $excludeFolders)) { @@ -2164,11 +2163,7 @@ class MarketplaceService if (isset($overview[0]->to)) { $to = mb_decode_mimeheader($overview[0]->to); } else { - if ($useAlternateMailbox) { - $to = 'Zakaz-bazacvetov24@yandex.ru'; - } else { - $to = 'flow@bazacvetov24.ru'; - } + $to = $username; } $date = date('Y-m-d H:i:s', strtotime(mb_decode_mimeheader($overview[0]->date))); -- 2.39.5