что-то старое и грустное

This commit is contained in:
root 2023-06-20 08:55:16 +00:00
parent bfb0fbe4de
commit 9ebb4385cb
6 changed files with 294 additions and 269 deletions

View File

@ -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";

View File

@ -414,9 +414,22 @@ class Product extends Document
->for('product')
->in('product_search')
->where(['stts' => $stts])
->filter(['catn' => $catn], 'START_SENSETIVE')
->search(<<<AQL
SEARCH ANALYZER(
LEVENSHTEIN_MATCH(
product.catn,
"$catn",
3,
true
)
OR STARTS_WITH(
product.catn,
"$catn"
),
"::text_en_no_stem")
AQL)
->limit($limit)
->orderBy(['catn' => 'ASC'])
->orderBy('BM25(product) DESC')
->select($select)
->createCommand()
->execute()

View File

@ -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
};
}
}

View File

@ -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 = [],

View File

@ -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'
)) {
// История поиска существует

View File

@ -1,8 +1,11 @@
<?php
// comment out the following two lines when deployed to production
defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod');
// defined('YII_DEBUG') or define('YII_DEBUG', false);
// defined('YII_ENV') or define('YII_ENV', 'prod');
// defined('YII_PATH_PUBLIC') or define('YII_PATH_PUBLIC', __DIR__);
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
defined('YII_PATH_PUBLIC') or define('YII_PATH_PUBLIC', __DIR__);
require __DIR__ . '/../../../../vendor/autoload.php';