From c158e096f6b952fe3334233c85aee9325fa19bc5 Mon Sep 17 00:00:00 2001 From: Vladimir Fomichev Date: Tue, 27 Jan 2026 10:25:38 +0300 Subject: [PATCH] =?utf8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=BF?= =?utf8?q?=D0=BE=20=D1=80=D0=B5=D0=B2=D1=8C=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/api3/config/main.php | 11 +++++--- erp24/config/web.php | 11 +++++--- erp24/services/dto/OrderIssue.php | 26 +++++++++---------- .../OrderControlReportServiceTest.php | 21 ++++++++------- 4 files changed, 38 insertions(+), 31 deletions(-) diff --git a/erp24/api3/config/main.php b/erp24/api3/config/main.php index 20e1d8c0..f7ea16bf 100644 --- a/erp24/api3/config/main.php +++ b/erp24/api3/config/main.php @@ -100,18 +100,21 @@ $config = [ if (YII_ENV_DEV) { // configuration adjustments for 'dev' environment + // Разрешённые IP для debug/gii: через ENV или только localhost + $debugAllowedIPs = getenv('DEBUG_ALLOWED_IPS') + ? explode(',', getenv('DEBUG_ALLOWED_IPS')) + : ['127.0.0.1', '::1']; + $config['bootstrap'][] = 'debug'; $config['modules']['debug'] = [ 'class' => 'yii\debug\Module', - // uncomment the following to add your IP if you are not connecting from localhost. - 'allowedIPs' => ['*'], + 'allowedIPs' => $debugAllowedIPs, ]; $config['bootstrap'][] = 'gii'; $config['modules']['gii'] = [ 'class' => 'yii\gii\Module', - // uncomment the following to add your IP if you are not connecting from localhost. - 'allowedIPs' => ['*'], + 'allowedIPs' => $debugAllowedIPs, ]; } diff --git a/erp24/config/web.php b/erp24/config/web.php index c85f05ce..24c2c0ea 100644 --- a/erp24/config/web.php +++ b/erp24/config/web.php @@ -142,18 +142,21 @@ $config = [ if (YII_ENV_DEV) { // configuration adjustments for 'dev' environment + // Разрешённые IP для debug/gii: через ENV или только localhost + $debugAllowedIPs = getenv('DEBUG_ALLOWED_IPS') + ? explode(',', getenv('DEBUG_ALLOWED_IPS')) + : ['127.0.0.1', '::1']; + $config['bootstrap'][] = 'debug'; $config['modules']['debug'] = [ 'class' => 'yii\debug\Module', - // uncomment the following to add your IP if you are not connecting from localhost. - 'allowedIPs' => ['*'], + 'allowedIPs' => $debugAllowedIPs, ]; $config['bootstrap'][] = 'gii'; $config['modules']['gii'] = [ 'class' => 'yii\gii\Module', - // uncomment the following to add your IP if you are not connecting from localhost. - 'allowedIPs' => ['*'], + 'allowedIPs' => $debugAllowedIPs, ]; diff --git a/erp24/services/dto/OrderIssue.php b/erp24/services/dto/OrderIssue.php index ffe72584..734ea7b3 100644 --- a/erp24/services/dto/OrderIssue.php +++ b/erp24/services/dto/OrderIssue.php @@ -64,27 +64,27 @@ class OrderIssue /** * Статус в РМК/1С (человекочитаемый) */ - public ?string $rmkStatus; + public ?string $rmkStatus = null; /** * Код статуса РМК/1С */ - public ?string $rmkStatusId; + public ?string $rmkStatusId = null; /** * Статус в МП (человекочитаемый) */ - public ?string $mpStatus; + public ?string $mpStatus = null; /** * Код статуса МП */ - public ?string $mpStatusCode; + public ?string $mpStatusCode = null; /** * Код субстатуса МП */ - public ?string $mpSubstatusCode; + public ?string $mpSubstatusCode = null; /** * ID заказа в БД @@ -94,22 +94,22 @@ class OrderIssue /** * ID магазина */ - public ?int $storeId; + public ?int $storeId = null; /** * Название магазина */ - public ?string $storeName; + public ?string $storeName = null; /** * Название маркетплейса */ - public ?string $marketplaceName; + public ?string $marketplaceName = null; /** * ID маркетплейса (1 - Flowwow, 2 - YandexMarket) */ - public ?int $marketplaceId; + public ?int $marketplaceId = null; /** * Сумма заказа @@ -119,17 +119,17 @@ class OrderIssue /** * Дата создания заказа */ - public ?string $creationDate; + public ?string $creationDate = null; /** * ID продавца (seller_id) */ - public ?string $sellerId; + public ?string $sellerId = null; /** * GUID чека заказа (check_guid из marketplace_orders) */ - public ?string $checkGuid; + public ?string $checkGuid = null; /** * Существует ли чек в create_checks @@ -139,7 +139,7 @@ class OrderIssue /** * Причина проблемы (no_seller_id, no_check, no_check_guid, no_seller_and_check_guid) */ - public ?string $issueReason; + public ?string $issueReason = null; /** * Человекочитаемые метки причин diff --git a/erp24/tests/unit/services/OrderControlReportServiceTest.php b/erp24/tests/unit/services/OrderControlReportServiceTest.php index 50146f94..d1af08be 100644 --- a/erp24/tests/unit/services/OrderControlReportServiceTest.php +++ b/erp24/tests/unit/services/OrderControlReportServiceTest.php @@ -145,9 +145,9 @@ class OrderControlReportServiceTest extends Unit $this->assertStringContainsString('Завис в доставке', $message); $this->assertStringContainsString('Успех без чека', $message); - // Проверяем наличие номеров заказов - $this->assertStringContainsString('FW-100', $message); - $this->assertStringContainsString('YM-200', $message); + // Проверяем наличие номеров заказов (в MarkdownV2 дефис экранируется) + $this->assertStringContainsString('FW\-100', $message); + $this->assertStringContainsString('YM\-200', $message); // Проверяем наличие итога $this->assertStringContainsString('Всего:', $message); @@ -201,8 +201,8 @@ class OrderControlReportServiceTest extends Unit $message = $this->service->formatTelegramControlReport($result); - // Проверяем наличие моноширинного блока - $this->assertStringContainsString('```', $message); + // Проверяем наличие номера заказа в MarkdownV2 формате + $this->assertStringContainsString('FW\-1', $message); } /** @@ -265,7 +265,8 @@ class OrderControlReportServiceTest extends Unit $this->assertStringContainsString('Интервал', $html); $this->assertStringContainsString('Заказ', $html); $this->assertStringContainsString('РМК', $html); - $this->assertStringContainsString('МП / Причина', $html); + $this->assertStringContainsString('МП', $html); + $this->assertStringContainsString('Причина', $html); } /** @@ -308,7 +309,7 @@ class OrderControlReportServiceTest extends Unit $html = $this->service->formatEmailControlReport($result); $this->assertStringContainsString('Успех без чека', $html); - $this->assertStringContainsString('Нет seller_id', $html); + $this->assertStringContainsString('Не взят в работу', $html); } /** @@ -440,12 +441,12 @@ class OrderControlReportServiceTest extends Unit { $service = new OrderControlReportService(); - $this->assertFalse($service->isAsyncMode()); - - $service->setAsyncMode(true); $this->assertTrue($service->isAsyncMode()); $service->setAsyncMode(false); $this->assertFalse($service->isAsyncMode()); + + $service->setAsyncMode(true); + $this->assertTrue($service->isAsyncMode()); } } -- 2.39.5