Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
semour
/
semour_web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7e1c6263
authored
Nov 21, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
品牌接口
parent
907bca22
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
app/Http/Services/BrandService.php
routes/api.php
app/Http/Services/BrandService.php
View file @
7e1c6263
...
...
@@ -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
;
}
...
...
routes/api.php
View file @
7e1c6263
...
...
@@ -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'
);
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment