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
68b6e897
authored
Dec 05, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
分类修改
parent
a74a4919
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
20 deletions
.env
app/Model/SelfClassifyModel.php
.env
View file @
68b6e897
...
@@ -22,11 +22,11 @@ DB_Self_PORT=3306
...
@@ -22,11 +22,11 @@ DB_Self_PORT=3306
DB_Self_PREFIX=lie_
DB_Self_PREFIX=lie_
//采购系统数据库
//采购系统数据库
DB_P
ur_HOST=192.168.1
.232
DB_P
UR_HOST=192.168.2
.232
DB_P
ur
_DATABASE=liexin_wms
DB_P
UR
_DATABASE=liexin_wms
DB_P
ur_USERNAME=root
DB_P
UR_USERNAME=liexin_wms
DB_P
ur_PASSWORD=123456
DB_P
UR_PASSWORD=liexin_wms#zsyM
DB_P
ur
_PORT=3306
DB_P
UR
_PORT=3306
DB_Pur_PREFIX=lie_
DB_Pur_PREFIX=lie_
...
...
app/Model/SelfClassifyModel.php
View file @
68b6e897
...
@@ -52,22 +52,31 @@ class SelfClassifyModel extends Model
...
@@ -52,22 +52,31 @@ class SelfClassifyModel extends Model
public
function
getClassList
()
public
function
getClassList
()
{
{
$classificationsExpireMinute
=
5
;
$classificationsExpireMinute
=
5
;
//先去缓存里面取
$Redis
=
new
RedisModel
;
$classList
=
$Redis
->
hgetall
(
'Self_SelfClassInfo'
);
$classList
=
array_map
(
function
(
$value
)
{
return
json_decode
(
$value
,
true
);
},
$classList
);
return
Cache
::
remember
(
'classList'
,
$classificationsExpireMinute
,
function
()
{
if
(
!
$classList
)
{
$field
=
[
return
Cache
::
remember
(
'classList'
,
$classificationsExpireMinute
,
function
()
{
'class_id'
,
$field
=
[
'class_name'
,
'class_id'
,
'status'
,
'class_name'
,
'class_icon'
,
'status'
,
];
'class_icon'
,
];
return
$this
->
select
(
$field
)
->
with
([
'sub_class'
=>
function
(
$query
)
use
(
$field
)
{
array_push
(
$field
,
'parent_id'
);
$query
->
select
(
$field
);
},
])
->
where
(
'status'
,
1
)
->
where
(
'parent_id'
,
0
)
->
orderBy
(
'sort'
,
'desc'
)
->
get
()
->
toArray
();
});
}
return
$this
->
select
(
$field
)
->
with
([
'sub_class'
=>
function
(
$query
)
use
(
$field
)
{
array_push
(
$field
,
'parent_id'
);
$query
->
select
(
$field
);
},
])
->
where
(
'status'
,
1
)
->
where
(
'parent_id'
,
0
)
->
orderBy
(
'sort'
,
'desc'
)
->
get
()
->
toArray
();
});
}
}
}
}
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