Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
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
cce8796c
authored
May 06, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
gix
parent
62ff3ad4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
app/Model/BrandModel.php
app/Model/BrandModel.php
View file @
cce8796c
...
@@ -40,23 +40,21 @@ class BrandModel extends Model
...
@@ -40,23 +40,21 @@ class BrandModel extends Model
$data
=
$redis
->
hgetall
(
'Self_Brand'
);
$data
=
$redis
->
hgetall
(
'Self_Brand'
);
foreach
(
$data
as
$key
=>
$item
)
{
foreach
(
$data
as
$key
=>
$item
)
{
$item
=
json_decode
(
$item
,
true
);
$item
=
json_decode
(
$item
,
true
);
if
(
!
$item
[
'brand_id'
])
continue
;
if
(
!
$item
[
'brand_id'
])
{
continue
;
}
$brandList
[]
=
[
$brandList
[]
=
[
'brand_id'
=>
$item
[
'brand_id'
],
'brand_id'
=>
$item
[
'brand_id'
],
'brand_name'
=>
$item
[
'brand_name'
],
'brand_name'
=>
$item
[
'brand_name'
],
];
];
}
}
}
else
{
}
else
{
$data
=
$redis
->
get
(
'brand_select'
);
$data
=
DB
::
connection
(
'spu'
)
->
table
(
'brand'
)
->
where
(
'status'
,
1
)
->
orderBy
(
'brand_id'
,
if
(
empty
(
$data
))
{
'asc'
)
->
pluck
(
'brand_name'
,
'brand_id'
);
$data
=
DB
::
connection
(
'spu'
)
->
table
(
'brand'
)
->
where
(
'status'
,
1
)
->
orderBy
(
'brand_id'
,
'asc'
)
->
pluck
(
'brand_name'
,
'brand_id'
);
$redis
->
set
(
'brand_select'
,
json_encode
(
$data
));
$redis
->
expire
(
'brand_select'
,
3600
);
}
else
{
$data
=
json_decode
(
$data
,
true
);
}
foreach
(
$data
as
$brandId
=>
$brandName
)
{
foreach
(
$data
as
$brandId
=>
$brandName
)
{
if
(
!
$brandId
)
continue
;
if
(
!
$brandId
)
{
continue
;
}
$brandList
[]
=
[
$brandList
[]
=
[
'brand_id'
=>
$brandId
,
'brand_id'
=>
$brandId
,
'brand_name'
=>
trim
(
$brandName
),
'brand_name'
=>
trim
(
$brandName
),
...
...
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