From 0239ec3e25a0f8e7f43f96eb41dd26c4ecc956c2 Mon Sep 17 00:00:00 2001 From: evoxwht <442384644@qq.com> Date: Wed, 28 Jun 2023 10:21:52 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=84=E4=BB=B6=E5=88=86=E7=B1=BB=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/v1/file/SystemAttachmentCategory.php | 5 +++-- .../attachment/SystemAttachmentCategoryServices.php | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/crmeb/app/adminapi/controller/v1/file/SystemAttachmentCategory.php b/crmeb/app/adminapi/controller/v1/file/SystemAttachmentCategory.php index 9095b6694..34c9e9164 100644 --- a/crmeb/app/adminapi/controller/v1/file/SystemAttachmentCategory.php +++ b/crmeb/app/adminapi/controller/v1/file/SystemAttachmentCategory.php @@ -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)); } diff --git a/crmeb/app/services/system/attachment/SystemAttachmentCategoryServices.php b/crmeb/app/services/system/attachment/SystemAttachmentCategoryServices.php index 9d69b39f9..a1ece2c55 100644 --- a/crmeb/app/services/system/attachment/SystemAttachmentCategoryServices.php +++ b/crmeb/app/services/system/attachment/SystemAttachmentCategoryServices.php @@ -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');