From 9ebb4385cb4c57cb86f273bc672213ae9f3a4e2d Mon Sep 17 00:00:00 2001 From: root Date: Tue, 20 Jun 2023 08:55:16 +0000 Subject: [PATCH] =?UTF-8?q?=D1=87=D1=82=D0=BE-=D1=82=D0=BE=20=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D1=80=D0=BE=D0=B5=20=D0=B8=20=D0=B3=D1=80=D1=83=D1=81?= =?UTF-8?q?=D1=82=D0=BD=D0=BE=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/controllers/ProductController.php | 4 +- mirzaev/skillparts/system/models/Product.php | 17 +- mirzaev/skillparts/system/models/Supply.php | 530 +++++++++--------- .../system/models/traits/SearchByEdge.php | 2 +- .../skillparts/system/views/search/panel.php | 3 +- mirzaev/skillparts/system/web/index.php | 7 +- 6 files changed, 294 insertions(+), 269 deletions(-) diff --git a/mirzaev/skillparts/system/controllers/ProductController.php b/mirzaev/skillparts/system/controllers/ProductController.php index 0664a88..a87f177 100644 --- a/mirzaev/skillparts/system/controllers/ProductController.php +++ b/mirzaev/skillparts/system/controllers/ProductController.php @@ -698,8 +698,8 @@ class ProductController extends Controller $model->catn = $text; - if ($model->save()) { - // Товар обновлён + if ($model->update() > 0) { + // Обновлён товар $return['main'] = $this->renderPartial('index', compact('model')); $return['redirect'] = "/product/$model->prod/$model->catn"; diff --git a/mirzaev/skillparts/system/models/Product.php b/mirzaev/skillparts/system/models/Product.php index 67f3a13..7244054 100644 --- a/mirzaev/skillparts/system/models/Product.php +++ b/mirzaev/skillparts/system/models/Product.php @@ -414,9 +414,22 @@ class Product extends Document ->for('product') ->in('product_search') ->where(['stts' => $stts]) - ->filter(['catn' => $catn], 'START_SENSETIVE') + ->search(<<limit($limit) - ->orderBy(['catn' => 'ASC']) + ->orderBy('BM25(product) DESC') ->select($select) ->createCommand() ->execute() diff --git a/mirzaev/skillparts/system/models/Supply.php b/mirzaev/skillparts/system/models/Supply.php index b9c38ef..f76e95b 100644 --- a/mirzaev/skillparts/system/models/Supply.php +++ b/mirzaev/skillparts/system/models/Supply.php @@ -547,7 +547,7 @@ class Supply extends Product implements ProductInterface, OfferInterface $amount = $row['Количество'] ?? $row['количество'] ?? $row['Amount'] ?? $row['amount'] ?? $row['amnt'] ?? null; // Поиск производителя - $prod = (string) ($row['Производитель'] ?? $row['производитель'] ?? $row['Production'] ?? $row['production'] ?? $row['prod'] ?? null); + $prod = static::filter((string) ($row['Производитель'] ?? $row['производитель'] ?? $row['Production'] ?? $row['production'] ?? $row['prod'] ?? null)); // Поиск аналогов $analogs = explode(',', (string) ($row['Аналоги'] ?? $row['аналоги'] ?? $row['Analogs'] ?? $row['analogs'] ?? $row['ОЕМ'] ?? $row['eom'] ?? ''), 50); @@ -583,277 +583,23 @@ class Supply extends Product implements ProductInterface, OfferInterface $_row = []; // Запись артикула (каталожного номера) в буфер - $_row['catn'] = $_supply; + $_row['catn'] = trim($_supply); // Запись цены в буфер $_row['cost'] = (float) preg_replace('/[^\d\.]+/', '', preg_replace('/\,+/', ' ', (string) ($row['Стоимость'] ?? $row['стоимость'] ?? $row['Цена'] ?? $row['цена'] ?? $row['Cost'] ?? $row['cost'] ?? $row['Price'] ?? $row['price']))) ?? 0; + var_dump($prod); // Запись производителя в буфер - $_row['prod'] = match($prod = ucwords(strtolower(preg_replace('/[^A-zА-я\s]/', ' ', $prod, 300)))) { - 'Akebono' => 'AKEBONO', - 'Bosch' => 'BOSCH', - 'Brembo' => 'BREMBO', - 'Ctr' => 'CTR', - 'Delphi' => 'DELPHI', - 'Gates' => 'GATES', - 'Hella' => 'HELLA', - 'Kyb' => 'KYB', - 'Mando' => 'MANDO', - 'Mk Kachiyama', 'Mk-kachiyama', 'Mk-Kachiyama' => 'MK KACHIYAMA', - 'Narva' => 'NARVA', - 'Ngk' => 'NGK', - 'Nk' => 'NK', - 'Osram' => 'OSRAM', - 'Philips' => 'PHILIPS', - 'Rancho' => 'RANCHO', - 'Sangsin' => 'SANGSIN', - 'Swag' => 'SWAG', - 'Trw' => 'TRW', - 'Filtron' => 'FILTRON', - 'Ajusa' => 'AJUSA', - 'Denso' => 'DENSO', - 'Dolz' => 'DOLZ', - 'Era' => 'ERA', - 'Febest' => 'FEBEST', - 'Freccia' => 'FRECCIA', - 'Gmb' => 'GMB', - 'Gsp' => 'GSP', - 'Honda' => 'HONDA', - 'Hyundai/kia', 'Hyundai/Kia', 'Hyundai-kia', 'Hyundai-Kia' => 'HYUNDAI/KIA', - 'Knecht/mahle', 'Knecht/Mahle', 'Knecht-mahle', 'Knecht-Mahle' => 'KNECHT/MAHLE', - 'Lynx' => 'LYNX', - 'Mann' => 'MANN', - 'Mitsubishi' => 'MITSUBISHI', - 'Nipparts' => 'NIPPARTS', - 'Nissan' => 'NISSAN', - 'Sasic' => 'SASIC', - 'Snr' => 'SNR', - 'Subaru' => 'SUBARU', - 'Toyota' => 'TOYOTA', - 'Trw_moto', 'Trw_Moto', 'Trw-moto', 'Trw-Moto' => 'TRW_MOTO', - 'Vag' => 'VAG', - 'Wynns' => 'WYNNS', - 'Ert' => 'ERT', - 'Dongil' => 'DONGIL', - 'Febi' => 'FEBI', - 'Ford' => 'FORD', - 'Injin' => 'INJIN', - 'Land Rover' => 'LAND ROVER', - 'Lpr' => 'LPR', - 'Luzar' => 'LUZAR', - 'MercedesBenz', 'Mercedesbenz', 'Mercedes Benz' => 'MERCEDES BENZ', - 'Suzuki' => 'SUZUKI', - 'Teikin' => 'TEIKIN', - 'Blue print' => 'BLUE PRINT', - 'Daihatsu' => 'DAIHATSU', - 'Goodwill' => 'GOODWILL', - 'Ina' => 'INA', - 'Iveco' => 'IVECO', - 'Jp Group' => 'JP GROUP', - 'Mfilter' => 'MFILTER', - 'Moog' => 'MOOG', - 'Nibk' => 'NIBK', - 'Asakashi', 'Js Asakashi' => 'JS Asakashi', - 'Lemforder' => 'LEMFORDER', - 'Man' => 'MAN', - 'Volvo' => 'VOLVO', - 'Ctp', 'Costex Tractor Parts', => 'CTP', - 'Czd' => 'CZD', - 'Lavr' => 'LAVR', - 'Wai' => 'WAI', - 'Asam' => 'ASAM', - 'Bmw' => 'BMW', - 'Brisk' => 'BRISK', - 'Fenox' => 'FENOX', - 'Gm', 'General Motors' => 'GENERAL MOTORS', - 'Idemitsu' => 'IDEMITSU', - 'Krauf' => 'KRAUF', - 'Liqui Moly', 'Lm' => 'LIQUI MOLY', - 'Mazda' => 'MAZDA', - 'Musashi' => 'MUSASHI', - 'Seiken' => 'SEIKEN', - 'Totachi' => 'TOTACHI', - 'Trialli' => 'TRIALLI', - 'Dong Feng', 'Dongfeng', 'Dongfeng Motors', 'Dfm' => 'DONGFENG', - 'Miles' => 'MILES', - 'Sidem' => 'SIDEM', - 'Stellox' => 'STELLOX', - 'Tokico' => 'TOKICO', - 'Phc Valeo', 'Valeo Phc' => 'Valeo PHC', - 'Точка Опоры' => 'ТОЧКА ОПОРЫ', - 'Jikiu' => 'JIKIU', - 'Lada' => 'LADA', - 'Mitasu' => 'MITASU', - 'Neolux' => 'NEOLUX', - 'Pilenga' => 'PILENGA', - 'Renault' => 'RENAULT', - 'Startvolt' => 'STARTVOLT', - 'Zic' => 'ZIC', - 'Автодело' => 'АВТОДЕЛО', - 'Berkut' => 'BERKUT', - 'Fiat' => 'FIAT', - 'Profix' => 'PROFIX', - 'Sampa' => 'SAMPA', - 'Topfils' => 'TOPFILS', - 'Uaz', 'Уаз' => 'UAZ', - 'Тольятти-тза', 'Тольятти-Тза', 'Тольятти Тза', 'Тольяттитза' => 'Тольятти-ТЗА', - 'Aywiparts' => 'AYWIPARTS', - 'Сatterpillar', 'Cat', 'Catterpillar Inc' => 'CAT', - 'Difa', 'Дифа' => 'DIFA', - 'Nisshimbo' => 'NISSHINBO', - 'Ruei' => 'RUEI', - 'Vic' => 'VIC', - 'Auto-gur', 'Auto-Gur', 'Auto Gur' => 'AUTO-GUR', - 'Daejin' => 'DAEJIN', - 'Gbrake' => 'G-brake', - 'Img' => 'IMG', - 'Kortex' => 'KORTEX', - 'Koyo' => 'KOYO', - 'Peugeot/citroen', 'Peugeot/Citroen', 'Peugeot-citroen', 'Peugeot-Citroen' => 'PEUGEOT-CITROEN', - 'Tangde' => 'TANGDE', - 'Double-force', 'Double-Force', 'Doubleforce', 'Double Force' => 'DOUBLE FORCE', - 'Just-drive', 'Just-Drive', 'Just Drive' => 'JUST DRIVE', - 'Quattro-freni', 'Quattro-Freni', 'Quattro Freni' => 'QUATTRO FRENI', - 'Roers Parts', 'Roers-parts', 'Roers-Parts' => 'ROTERS-PARTS', - 'Tixona' => 'TIXONA', - 'Zekkert' => 'ZEKKERT', - 'Horex' => 'HOREX', - 'Zevs', 'Зевс' => 'ZEVS', - 'Aiko' => 'AIKO', - 'Castrol' => 'CASTROL', - 'Deko' => 'DEKO', - 'Hyundai Xteer' => 'HYUNDAI XTEER', - 'Dyg' => 'DYG', - 'Nty' => 'NTY', - 'Skf' => 'SKF', - 'Alfi Parts' => 'ALFI PARTS', - 'Fiestroco' => 'FIESTROCO', - 'Golden Snail' => 'GOLDEN SNAIL', - 'Ti-guar', 'Ti-Guar' => 'Ti-Guar', - 'Cautex' => 'CAUTEX', - 'Bm-motorsport', 'Bm-Motorsport' => 'BM-Motorsport', - 'Маз', 'Maz' => 'MAZ', - 'Брт' => 'БРТ', - 'Гпз' => 'ГПЗ', - 'Rm Terex' => 'Terex', - 'Agm' => 'Agama', - 'Tsn' => 'TSN', - 'Igp', 'Isuzu Genuine Parts' => 'Isuzu', - 'Etp', 'Europe Tractor Parts' => 'ETP', - 'Cum' => 'Cummins', - 'Xcmg' => 'XCMG', - 'Sdlg' => 'SDLG', - 'Xcmg-sdlg', 'Xcmg-Sdlg' => 'XCMG-SDLG', - 'Vilitan' => 'ViliTan', - 'Kato' => 'KATO', - 'Bw' => 'Baldwin', - 'Itr' => 'ITR', - 'Ofm' => 'OFM', - 'Kz' => 'Kezhang Mechanic', - 'Dongfeng Cummins Engine Company', 'Dongfeng Cummins' => 'DCEC', - 'Bomag' => 'BOMAG', - 'Shehwa' => 'SHEHWA', - 'Kmp Brand', 'Kmp' => 'KMP', - 'Jd' => 'John Deere', - 'World Gasket', 'Wg', 'World-gasket', 'World-Gasket' => 'WG', - 'Original Equipment Manufacturer', 'Oem' => 'OEM', - 'Case' => 'CASE', - 'Jf Filtration', 'Jf' => 'JF Filtration', - 'Hp' => 'HP', - 'Ярославский Завод Дизельной Аппаратуры', 'Язда' => 'ЯЗДА', - 'Prc' => 'PRC', - 'Sf', 'Sf Filter' => 'SF Filter', - 'Ga' => 'GA', - 'Kentek' => 'KENTEK', - 'Cgr Ghinassi', 'Gb Group' => 'Ghinassi', - 'Doosan' => 'DOOSAN', - 'Dressta' => 'DRESSTA', - 'Ammann' => 'AMMANN', - 'Blumaq' => 'BLUMAQ', - 'Deutz' => 'DEUTZ', - 'Daewoo' => 'DAEWOO', - 'Furukawa' => 'FURUKAWA', - 'Niipon' => 'NIIPON', - 'Cargo' => 'CARGO', - 'Wps' => 'WPS', - 'Zaufer' => 'ZAUFER', - 'Handok' => 'HANDOK', - 'Fg Wilson', 'F.G.Wilson', 'F.g.wilson' => 'F.G.WILSON', - 'Racor' => 'RACOR', - 'Jcb' => 'JCB', - 'Auger' => 'AUGER', - 'Ekka' => 'EKKA', - 'Berco' => 'BERCO', - 'Bosch Rexroth' => 'BOSCH REXROTH', - 'Byg' => 'BYG', - 'Cgr' => 'CGR', - 'Dayco' => 'DAYCO', - 'Dcf' => 'DCF', - 'Dunlop' => 'DUNLOP', - 'Febi' => 'FeBi', - 'Fleetguard' => 'FLEETGUARD', - 'Foton' => 'FOTON', - 'Getlf' => 'GETLF', - 'Hidromek' => 'HIDROMEK', - 'Mann&Hummel', 'Mann&hummel' => 'MANN&HUMMEL', - 'Niitsu' => 'NIITSU', - 'Nok' => 'NOK', - 'Nsk' => 'NSK', - 'Ntn' => 'NTN', - 'Orme' => 'ORME', - 'Parker-racor', 'Parker-Racor' => 'PARKER-RACOR', - 'Sanz' => 'SANZ', - 'Sem' => 'SEM', - 'Separ' => 'SEPAR', - 'Shaanxi' => 'SHAANXI', - 'Shell' => 'SHELL', - 'Skf' => 'SKF', - 'Ssp' => 'SSP', - 'Sst' => 'SST', - 'Stal' => 'STAL', - 'Steyr' => 'STEYR', - 'Toyota' => 'TOYOTA', - 'Tt' => 'Tesla Technics', - 'Vag' => 'VAG', - 'Wix', 'Wix Filters' => 'WIX', - 'Yuchai' => 'Yuchai', - 'Zexel' => 'ZEXEL', - 'Dongil' => 'DONGIL', - 'Sanlux' => 'SANLUX', - 'Amt' => 'AMT', - 'Dt' => 'DT', - 'Pramo' => 'PRAMO', - 'Haffen' => 'HAFFEN', - 'Mfilter' => 'MFILTER', - 'Hengst' => 'HENGST', - 'Sofima' => 'SOFIMA', - 'Dolz' => 'DOLZ', - 'Element' => 'ELEMENT', - 'Sardes' => 'SARDES', - 'Seintex' => 'SEINTEX', - 'Patron' => 'PATRON', - 'Lpr' => 'LPR', - 'Kaichin' => 'KAICHIN', - 'Union' => 'UNION', - 'Rb-exide', 'Rb-Exide' => 'RB-EXIDE', - 'Kurin' => 'KURIN', - 'Topfils' => 'TOPFILS', - 'Knor' => 'KNOR', - 'Megapower' => 'MEGAPOWER', - 'Red Filter', 'Redfilter' => 'REDFilter', - 'Skania' => 'SKANIA', - 'Sct' => 'SCT', - 'Kolbenschmidt' => 'KOLBENSCHMIDT', - 'Big Filter' => 'BIG Filter', - 'Alco Filter' => 'ALCO Filter', - default => $prod - }; + $_row['prod'] = static::filter($prod); + + var_dump($_row['prod']); // Запись аналогов в буфер $_row['oemn'] = array_walk($analogs, 'trim'); // Инициализация буфера поставки $supply = new static($_row); + var_dump($supply->prod); $supply->scenario = $supply::SCENARIO_WRITE; @@ -1476,4 +1222,266 @@ class Supply extends Product implements ProductInterface, OfferInterface return false; } + + public static function filter(string $prod): string { + return match(mb_convert_case(mb_convert_case(preg_replace('/(*UTF8)[^A-zА-я\s]/', ' ', $prod, 300), MB_CASE_LOWER, 'UTF-8'), MB_CASE_TITLE, 'UTF-8')) { + 'Akebono' => 'AKEBONO', + 'Bosch' => 'BOSCH', + 'Brembo' => 'BREMBO', + 'Ctr' => 'CTR', + 'Delphi' => 'DELPHI', + 'Gates' => 'GATES', + 'Hella' => 'HELLA', + 'Kyb' => 'KYB', + 'Mando' => 'MANDO', + 'Mk Kachiyama', 'Mk-kachiyama', 'Mk-Kachiyama' => 'MK KACHIYAMA', + 'Narva' => 'NARVA', + 'Ngk' => 'NGK', + 'Nk' => 'NK', + 'Osram' => 'OSRAM', + 'Philips' => 'PHILIPS', + 'Rancho' => 'RANCHO', + 'Sangsin' => 'SANGSIN', + 'Swag' => 'SWAG', + 'Trw' => 'TRW', + 'Filtron' => 'FILTRON', + 'Ajusa' => 'AJUSA', + 'Denso' => 'DENSO', + 'Dolz' => 'DOLZ', + 'Era' => 'ERA', + 'Febest' => 'FEBEST', + 'Freccia' => 'FRECCIA', + 'Gmb' => 'GMB', + 'Gsp' => 'GSP', + 'Honda' => 'HONDA', + 'Hyundai/kia', 'Hyundai/Kia', 'Hyundai-kia', 'Hyundai-Kia' => 'HYUNDAI/KIA', + 'Knecht/mahle', 'Knecht/Mahle', 'Knecht-mahle', 'Knecht-Mahle' => 'KNECHT/MAHLE', + 'Lynx' => 'LYNX', + 'Mann' => 'MANN', + 'Mitsubishi' => 'MITSUBISHI', + 'Nipparts' => 'NIPPARTS', + 'Nissan' => 'NISSAN', + 'Sasic' => 'SASIC', + 'Snr' => 'SNR', + 'Subaru' => 'SUBARU', + 'Toyota' => 'TOYOTA', + 'Trw_moto', 'Trw_Moto', 'Trw-moto', 'Trw-Moto' => 'TRW_MOTO', + 'Vag' => 'VAG', + 'Wynns' => 'WYNNS', + 'Ert' => 'ERT', + 'Dongil' => 'DONGIL', + 'Febi' => 'FEBI', + 'Ford' => 'FORD', + 'Injin' => 'INJIN', + 'Land Rover' => 'LAND ROVER', + 'Lpr' => 'LPR', + 'Luzar' => 'LUZAR', + 'MercedesBenz', 'Mercedesbenz', 'Mercedes Benz' => 'MERCEDES BENZ', + 'Suzuki' => 'SUZUKI', + 'Teikin' => 'TEIKIN', + 'Blue print' => 'BLUE PRINT', + 'Daihatsu' => 'DAIHATSU', + 'Goodwill' => 'GOODWILL', + 'Ina' => 'INA', + 'Iveco' => 'IVECO', + 'Jp Group' => 'JP GROUP', + 'Mfilter' => 'MFILTER', + 'Moog' => 'MOOG', + 'Nibk' => 'NIBK', + 'Asakashi', 'Js Asakashi' => 'JS Asakashi', + 'Lemforder' => 'LEMFORDER', + 'Man' => 'MAN', + 'Volvo' => 'VOLVO', + 'Ctp', 'Costex Tractor Parts', => 'CTP', + 'Czd' => 'CZD', + 'Lavr' => 'LAVR', + 'Wai' => 'WAI', + 'Asam' => 'ASAM', + 'Bmw' => 'BMW', + 'Brisk' => 'BRISK', + 'Fenox' => 'FENOX', + 'Gm', 'General Motors' => 'GENERAL MOTORS', + 'Idemitsu' => 'IDEMITSU', + 'Krauf' => 'KRAUF', + 'Liqui Moly', 'Lm' => 'LIQUI MOLY', + 'Mazda' => 'MAZDA', + 'Musashi' => 'MUSASHI', + 'Seiken' => 'SEIKEN', + 'Totachi' => 'TOTACHI', + 'Trialli' => 'TRIALLI', + 'Dong Feng', 'Dongfeng', 'Dongfeng Motors', 'Dfm' => 'DONGFENG', + 'Miles' => 'MILES', + 'Sidem' => 'SIDEM', + 'Stellox' => 'STELLOX', + 'Tokico' => 'TOKICO', + 'Phc Valeo', 'Valeo Phc' => 'Valeo PHC', + 'Точка Опоры' => 'ТОЧКА ОПОРЫ', + 'Jikiu' => 'JIKIU', + 'Lada' => 'LADA', + 'Mitasu' => 'MITASU', + 'Neolux' => 'NEOLUX', + 'Pilenga' => 'PILENGA', + 'Renault' => 'RENAULT', + 'Startvolt' => 'STARTVOLT', + 'Zic' => 'ZIC', + 'Автодело' => 'АВТОДЕЛО', + 'Berkut' => 'BERKUT', + 'Fiat' => 'FIAT', + 'Profix' => 'PROFIX', + 'Sampa' => 'SAMPA', + 'Topfils' => 'TOPFILS', + 'Uaz', 'Уаз' => 'UAZ', + 'Тольятти-тза', 'Тольятти-Тза', 'Тольятти Тза', 'Тольяттитза' => 'Тольятти-ТЗА', + 'Aywiparts' => 'AYWIPARTS', + 'Caterpillar', 'Cat', 'Caterpillar Inc' => 'CAT', + 'Дифа', 'Difa' => 'DIFA', + 'Nisshimbo' => 'NISSHINBO', + 'Ruei' => 'RUEI', + 'Vic' => 'VIC', + 'Auto-gur', 'Auto-Gur', 'Auto Gur' => 'AUTO-GUR', + 'Daejin' => 'DAEJIN', + 'Gbrake' => 'G-brake', + 'Img' => 'IMG', + 'Kortex' => 'KORTEX', + 'Koyo' => 'KOYO', + 'Peugeot/citroen', 'Peugeot/Citroen', 'Peugeot-citroen', 'Peugeot-Citroen' => 'PEUGEOT-CITROEN', + 'Tangde' => 'TANGDE', + 'Double-force', 'Double-Force', 'Doubleforce', 'Double Force' => 'DOUBLE FORCE', + 'Just-drive', 'Just-Drive', 'Just Drive' => 'JUST DRIVE', + 'Quattro-freni', 'Quattro-Freni', 'Quattro Freni' => 'QUATTRO FRENI', + 'Roers Parts', 'Roers-parts', 'Roers-Parts' => 'ROTERS-PARTS', + 'Tixona' => 'TIXONA', + 'Zekkert' => 'ZEKKERT', + 'Horex' => 'HOREX', + 'Zevs', 'Зевс' => 'ZEVS', + 'Aiko' => 'AIKO', + 'Castrol' => 'CASTROL', + 'Deko' => 'DEKO', + 'Hyundai Xteer' => 'HYUNDAI XTEER', + 'Dyg' => 'DYG', + 'Nty' => 'NTY', + 'Skf' => 'SKF', + 'Alfi Parts' => 'ALFI PARTS', + 'Fiestroco' => 'FIESTROCO', + 'Golden Snail' => 'GOLDEN SNAIL', + 'Ti-guar', 'Ti-Guar' => 'Ti-Guar', + 'Cautex' => 'CAUTEX', + 'Bm-motorsport', 'Bm-Motorsport' => 'BM-Motorsport', + 'Маз', 'Maz' => 'MAZ', + 'Брт' => 'БРТ', + 'Гпз' => 'ГПЗ', + 'Rm Terex' => 'Terex', + 'Agm' => 'Agama', + 'Tsn' => 'TSN', + 'Igp', 'Isuzu Genuine Parts' => 'Isuzu', + 'Etp', 'Europe Tractor Parts' => 'ETP', + 'Cum' => 'Cummins', + 'Xcmg' => 'XCMG', + 'Sdlg' => 'SDLG', + 'Xcmg-sdlg', 'Xcmg-Sdlg' => 'XCMG-SDLG', + 'Vilitan' => 'ViliTan', + 'Kato' => 'KATO', + 'Bw' => 'Baldwin', + 'Itr' => 'ITR', + 'Ofm' => 'OFM', + 'Kz' => 'Kezhang Mechanic', + 'Dongfeng Cummins Engine Company', 'Dongfeng Cummins' => 'DCEC', + 'Bomag' => 'BOMAG', + 'Shehwa' => 'SHEHWA', + 'Kmp Brand', 'Kmp' => 'KMP', + 'Jd' => 'John Deere', + 'World Gasket', 'Wg', 'World-gasket', 'World-Gasket' => 'WG', + 'Original Equipment Manufacturer', 'Oem' => 'OEM', + 'Case' => 'CASE', + 'Jf Filtration', 'Jf' => 'JF Filtration', + 'Hp' => 'HP', + 'Ярославский Завод Дизельной Аппаратуры', 'Язда' => 'ЯЗДА', + 'Prc' => 'PRC', + 'Sf', 'Sf Filter' => 'SF Filter', + 'Ga' => 'GA', + 'Kentek' => 'KENTEK', + 'Cgr Ghinassi', 'Gb Group' => 'Ghinassi', + 'Doosan' => 'DOOSAN', + 'Dressta' => 'DRESSTA', + 'Ammann' => 'AMMANN', + 'Blumaq' => 'BLUMAQ', + 'Deutz' => 'DEUTZ', + 'Daewoo' => 'DAEWOO', + 'Furukawa' => 'FURUKAWA', + 'Niipon' => 'NIIPON', + 'Cargo' => 'CARGO', + 'Wps' => 'WPS', + 'Zaufer' => 'ZAUFER', + 'Handok' => 'HANDOK', + 'Fg Wilson', 'F.G.Wilson', 'F.g.wilson' => 'F.G.WILSON', + 'Racor' => 'RACOR', + 'Jcb' => 'JCB', + 'Auger' => 'AUGER', + 'Ekka' => 'EKKA', + 'Berco' => 'BERCO', + 'Bosch Rexroth' => 'BOSCH REXROTH', + 'Byg' => 'BYG', + 'Cgr' => 'CGR', + 'Dayco' => 'DAYCO', + 'Dcf' => 'DCF', + 'Dunlop' => 'DUNLOP', + 'Febi' => 'FeBi', + 'Fleetguard' => 'FLEETGUARD', + 'Foton' => 'FOTON', + 'Getlf' => 'GETLF', + 'Hidromek' => 'HIDROMEK', + 'Mann&Hummel', 'Mann&hummel' => 'MANN&HUMMEL', + 'Niitsu' => 'NIITSU', + 'Nok' => 'NOK', + 'Nsk' => 'NSK', + 'Ntn' => 'NTN', + 'Orme' => 'ORME', + 'Parker-racor', 'Parker-Racor' => 'PARKER-RACOR', + 'Sanz' => 'SANZ', + 'Sem' => 'SEM', + 'Separ' => 'SEPAR', + 'Shaanxi' => 'SHAANXI', + 'Shell' => 'SHELL', + 'Skf' => 'SKF', + 'Ssp' => 'SSP', + 'Sst' => 'SST', + 'Stal' => 'STAL', + 'Steyr' => 'STEYR', + 'Toyota' => 'TOYOTA', + 'Tt' => 'Tesla Technics', + 'Vag' => 'VAG', + 'Wix', 'Wix Filters' => 'WIX', + 'Yuchai' => 'Yuchai', + 'Zexel' => 'ZEXEL', + 'Dongil' => 'DONGIL', + 'Sanlux' => 'SANLUX', + 'Amt' => 'AMT', + 'Dt' => 'DT', + 'Pramo' => 'PRAMO', + 'Haffen' => 'HAFFEN', + 'Mfilter' => 'MFILTER', + 'Hengst' => 'HENGST', + 'Sofima' => 'SOFIMA', + 'Dolz' => 'DOLZ', + 'Element' => 'ELEMENT', + 'Sardes' => 'SARDES', + 'Seintex' => 'SEINTEX', + 'Patron' => 'PATRON', + 'Lpr' => 'LPR', + 'Kaichin' => 'KAICHIN', + 'Union' => 'UNION', + 'Rb-exide', 'Rb-Exide' => 'RB-EXIDE', + 'Kurin' => 'KURIN', + 'Topfils' => 'TOPFILS', + 'Knor' => 'KNOR', + 'Megapower' => 'MEGAPOWER', + 'Red Filter', 'Redfilter' => 'REDFilter', + 'Skania' => 'SKANIA', + 'Sct' => 'SCT', + 'Kolbenschmidt' => 'KOLBENSCHMIDT', + 'Big Filter' => 'BIG Filter', + 'Alco Filter' => 'ALCO Filter', + default => $prod + }; + } } diff --git a/mirzaev/skillparts/system/models/traits/SearchByEdge.php b/mirzaev/skillparts/system/models/traits/SearchByEdge.php index fd7601e..d4340fb 100644 --- a/mirzaev/skillparts/system/models/traits/SearchByEdge.php +++ b/mirzaev/skillparts/system/models/traits/SearchByEdge.php @@ -20,7 +20,7 @@ trait SearchByEdge string $direction = 'ANY', int|null $limit = 10, int|null $offset = 0, - array $sort = ['ASC'], + array|string|null $sort = null, string|array $subquery_where = [], string|array $subquery_select = null, array $foreach = [], diff --git a/mirzaev/skillparts/system/views/search/panel.php b/mirzaev/skillparts/system/views/search/panel.php index abb824c..0d13fce 100644 --- a/mirzaev/skillparts/system/views/search/panel.php +++ b/mirzaev/skillparts/system/views/search/panel.php @@ -20,7 +20,8 @@ if (isset($history) && $history) { from: 'account', to: 'search', sort: ['DESC'], - where: ['search.type' => 'general'] + subquery_where: ['account._id' => yii::$app->user->identity->getId()], + where: 'search.type == "general" && account_edge_search[0] != null' )) { // История поиска существует diff --git a/mirzaev/skillparts/system/web/index.php b/mirzaev/skillparts/system/web/index.php index 486df8e..761fe0c 100644 --- a/mirzaev/skillparts/system/web/index.php +++ b/mirzaev/skillparts/system/web/index.php @@ -1,8 +1,11 @@