Commit 7e1c6263 by 杨树贤

品牌接口

parent 907bca22
......@@ -2,6 +2,7 @@
namespace App\Http\Services;
use Fuse\Fuse;
use Illuminate\Support\Facades\Redis;
class BrandService
......@@ -14,7 +15,17 @@ class BrandService
return json_decode($value, true);
}, $standardBrandCache);
ksort($standardBrandCache);
$standardBrandCache = array_values($standardBrandCache);
$standardBrandCache = array_map(function ($item) {
return \Arr::only($item, ['brand_name_en', 'standard_brand_id', 'brand_short_name_en', 'brand_logo']);
}, $standardBrandCache);
if (!empty($map['brand_name'])) {
$fuse = new Fuse($standardBrandCache, [
'keys' => ['brand_name_en'],
'minMatchCharLength' => 3,
'threshold' => 0
]);
return $fuse->search($map['brand_name']);
}
return $standardBrandCache;
}
......
......@@ -21,6 +21,7 @@ Route::middleware(['api'])->namespace('Api')->group(function () {
Route::POST('auth/forget_password', 'AuthApiController@forgetPassword');
Route::POST('auth/set_forget_password', 'AuthApiController@setForgetPassword');
Route::get('country/list', 'CountryApiController@list');
Route::get('brand/list', 'BrandApiController@list');
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment