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);