mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-31 15:00:52 +00:00
附件分类优化
This commit is contained in:
parent
fc4bd5b578
commit
0239ec3e25
@ -48,9 +48,10 @@ class SystemAttachmentCategory extends AuthController
|
||||
{
|
||||
$where = $this->request->getMore([
|
||||
['name', ''],
|
||||
['pid', 0]
|
||||
['pid', 0],
|
||||
['all', 0]
|
||||
]);
|
||||
if ($where['name'] != '') $where['pid'] = '';
|
||||
if ($where['name'] != '' || $where['all'] == 1) $where['pid'] = '';
|
||||
return app('json')->success($this->service->getAll($where));
|
||||
}
|
||||
|
||||
|
||||
@ -49,11 +49,13 @@ class SystemAttachmentCategoryServices extends BaseServices
|
||||
public function getAll(array $where)
|
||||
{
|
||||
$list = $this->dao->getList($where);
|
||||
foreach ($list as &$item) {
|
||||
$item['title'] = $item['name'];
|
||||
if ($where['name'] == '' && $this->dao->count(['pid' => $item['id']])) {
|
||||
$item['loading'] = false;
|
||||
if ($where['all'] == 1) {
|
||||
$list = $this->tidyMenuTier($list);
|
||||
} else {
|
||||
foreach ($list as &$item) {
|
||||
$item['title'] = $item['name'];
|
||||
$item['children'] = [];
|
||||
if ($where['name'] == '' && $this->dao->count(['pid' => $item['id']])) $item['loading'] = false;
|
||||
}
|
||||
}
|
||||
return compact('list');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user