Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
LC_server_goods
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
9604c3f1
authored
Dec 05, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改品牌获取缓存
parent
0645735f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
app/Model/SelfBrandModel.php
app/Model/SelfBrandModel.php
View file @
9604c3f1
...
...
@@ -64,6 +64,24 @@ class SelfBrandModel extends Model
//先去缓存里面取
$Redis
=
new
RedisModel
;
$brandList
=
$Redis
->
hgetall
(
'Self_Brand'
);
$brandList
=
array_map
(
function
(
$value
)
{
return
json_decode
(
$value
,
true
);
},
$brandList
);
//如果要有地区筛选,则需要做数据处理
if
(
!
empty
(
$map
[
'brand_area'
])
&&
!
empty
(
$brandList
))
{
$brandListByArea
=
[];
$areaIds
=
explode
(
','
,
$map
[
'brand_area'
]);
foreach
(
$brandList
as
$key
=>
$brand
)
{
if
(
in_array
(
$brand
[
'brand_area'
],
$areaIds
))
{
$brandListByArea
[]
=
$brand
;
}
}
return
$brandListByArea
;
}
//没有就去数据库里面取
if
(
!
$brandList
)
{
return
Cache
::
remember
(
'brandList_'
.
json_encode
(
$map
),
$expireMinutes
,
function
()
use
(
$map
)
{
$field
=
[
...
...
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