From a6d8ee5e5957b2423e2b5f96aad5154f8a7e786d Mon Sep 17 00:00:00 2001 From: Arsen Mirzaev Tatyano-Muradovich Date: Tue, 27 Jul 2021 19:59:56 +1000 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=20=D0=BD?= =?UTF-8?q?=D0=B0=D0=B4=20=D1=81=D0=B0=D0=B9=D1=82=D0=BE=D0=BC=2017?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/config/params.php.example | 3 + .../system/controllers/SearchController.php | 30 ++++- .../views/account/panel/authenticated.php | 2 +- .../skillparts/system/views/layouts/main.php | 4 +- .../skillparts/system/views/orders/index.php | 11 +- .../skillparts/system/views/search/index.php | 117 +++++++++++------- mirzaev/skillparts/system/web/css/main.css | 1 + .../system/web/css/pages/orders.css | 10 ++ 8 files changed, 124 insertions(+), 54 deletions(-) diff --git a/mirzaev/skillparts/system/config/params.php.example b/mirzaev/skillparts/system/config/params.php.example index ee5ef0e..15fead7 100644 --- a/mirzaev/skillparts/system/config/params.php.example +++ b/mirzaev/skillparts/system/config/params.php.example @@ -21,4 +21,7 @@ return [ 'password' => '', 'key' => '' ], + 'dadata' => [ + 'key' => '' + ] ]; diff --git a/mirzaev/skillparts/system/controllers/SearchController.php b/mirzaev/skillparts/system/controllers/SearchController.php index 0fbf2a3..a632161 100644 --- a/mirzaev/skillparts/system/controllers/SearchController.php +++ b/mirzaev/skillparts/system/controllers/SearchController.php @@ -175,9 +175,20 @@ class SearchController extends Controller $row['overload'] = true; } - foreach ($connections as &$connection) { + foreach ($connections as $key => &$connection) { // Перебор поставок + if (($cost = $cost['ЦенаЗаЕдиницу'] ?? $connection['supply_edge_product'][0]['onec']['Цены']['Цена']['ЦенаЗаЕдиницу']) < 1 + || ($amount = $connection['supply']['amnt'] ?? $connection['supply_edge_product'][0]['onec']['Количество']) < 1 + ) { + // Цена меньше единицы (подразумевается как ошибка) или количество меньше единицы + + // Скрыть из выдачи + unset($connections[$key]); + + continue; + } + // Инициализация аккаунта $connection['account'] = Account::searchBySupplyId($connection['supply_edge_product'][0]['_from']); @@ -244,7 +255,7 @@ class SearchController extends Controller } // Инициализация цены (цена поставки + цена доставки + наша наценка) - $connection['cost'] = ($cost['ЦенаЗаЕдиницу'] ?? $connection['supply_edge_product'][0]['onec']['Цены']['Цена']['ЦенаЗаЕдиницу']) + ($connection['delivery']['price']['all'] ?? $connection['delivery']['price']['one'] ?? 0) + ($settings['increase'] ?? 0); + $connection['cost'] = $cost + ($connection['delivery']['price']['all'] ?? $connection['delivery']['price']['one'] ?? 0) + ($settings['increase'] ?? 0); // Инициализация версии для рассчета доставки по воздуху $buffer_delivery_avia = $connection; @@ -252,6 +263,19 @@ class SearchController extends Controller try { // Инициализация данных геолокации + if (($cost = $cost['ЦенаЗаЕдиницу'] ?? $buffer_delivery_avia['supply_edge_product'][0]['onec']['Цены']['Цена']['ЦенаЗаЕдиницу']) < 1 + || ($amount = $connection['supply']['amnt'] ?? $connection['supply_edge_product'][0]['onec']['Количество']) < 1 + ) { + // Цена меньше единицы (подразумевается как ошибка) или количество меньше единицы + // Этот код не будет выполняться, так как цена одна на обе позиции и аналогичная проверка выше уже есть + // Однако я это оставлю для возможных доработок в будущем + + // Скрыть из выдачи + unset($connections[$key]); + + continue; + } + try { $from = (int) $buffer_delivery_avia['account']['opts']['delivery_from_terminal'] ?? Settings::search()->delivery_from_default ?? 36; } catch (Exception $e) { @@ -313,7 +337,7 @@ class SearchController extends Controller // Если рассчиталась доставка самолётом // Инициализация цены (цена поставки + цена доставки + наша наценка) - $buffer_delivery_avia['cost'] = ($cost['ЦенаЗаЕдиницу'] ?? $buffer_delivery_avia['supply_edge_product'][0]['onec']['Цены']['Цена']['ЦенаЗаЕдиницу']) + ($buffer_delivery_avia['delivery']['price']['all'] ?? $buffer_delivery_avia['delivery']['price']['one'] ?? 0) + ($settings['increase'] ?? 0); + $buffer_delivery_avia['cost'] = $cost + ($buffer_delivery_avia['delivery']['price']['all'] ?? $buffer_delivery_avia['delivery']['price']['one'] ?? 0) + ($settings['increase'] ?? 0); // Запись в буфер $buffer_connections[] = $buffer_delivery_avia; diff --git a/mirzaev/skillparts/system/views/account/panel/authenticated.php b/mirzaev/skillparts/system/views/account/panel/authenticated.php index 4787288..ac1a0d9 100644 --- a/mirzaev/skillparts/system/views/account/panel/authenticated.php +++ b/mirzaev/skillparts/system/views/account/panel/authenticated.php @@ -12,7 +12,7 @@ use yii;
user->identity->mail ?> - + diff --git a/mirzaev/skillparts/system/views/layouts/main.php b/mirzaev/skillparts/system/views/layouts/main.php index 2f09fb9..5b4a588 100644 --- a/mirzaev/skillparts/system/views/layouts/main.php +++ b/mirzaev/skillparts/system/views/layouts/main.php @@ -70,7 +70,7 @@ AppAsset::register($this);