From 80eb0ecaa31feba6a2015d8e358ba60d6ba7d628 Mon Sep 17 00:00:00 2001 From: evoxwht <442384644@qq.com> Date: Thu, 27 Apr 2023 09:38:18 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/app/services/system/SystemRouteServices.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crmeb/app/services/system/SystemRouteServices.php b/crmeb/app/services/system/SystemRouteServices.php index 0060198de..56c76d472 100644 --- a/crmeb/app/services/system/SystemRouteServices.php +++ b/crmeb/app/services/system/SystemRouteServices.php @@ -266,11 +266,14 @@ class SystemRouteServices extends BaseServices foreach ($list as $key => $value) { foreach ($value as $item) { if (!$this->diffRoute($data, $item['rule'], $item['method']) && strstr($item['rule'], '') === false) { + $pathAndAction = explode('/', $item['route']); $save[] = [ 'name' => $item['option']['real_name'] ?? $item['name'], 'path' => $item['rule'], 'cate_id' => $key, 'app_name' => $app, + 'file_path' => 'app/' . $app . '/controller/' . str_replace('.', '/', $pathAndAction[0]) . '.php', + 'action' => $pathAndAction[1], 'type' => isset($item['option']['is_common']) && $item['option']['is_common'] ? 1 : 0, 'method' => $item['method'], 'add_time' => date('Y-m-d H:i:s'), @@ -305,6 +308,7 @@ class SystemRouteServices extends BaseServices app()->make(SystemMenusServices::class)->deleteMenu($item['path'], $item['method']); } } + $this->cacheDriver()->clear(); } /** From 9252f05791eac07b02fde0019ae5e5fdc7ef4937 Mon Sep 17 00:00:00 2001 From: evoxwht <442384644@qq.com> Date: Thu, 27 Apr 2023 10:43:31 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/app/dao/system/SystemMenusDao.php | 2 +- crmeb/app/services/system/SystemMenusServices.php | 7 +++++-- template/admin/src/pages/setting/systemMenus/index.vue | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/crmeb/app/dao/system/SystemMenusDao.php b/crmeb/app/dao/system/SystemMenusDao.php index 8c6af977a..f114c5b24 100644 --- a/crmeb/app/dao/system/SystemMenusDao.php +++ b/crmeb/app/dao/system/SystemMenusDao.php @@ -112,7 +112,7 @@ class SystemMenusDao extends BaseDao * @param string $key * @return array */ - public function column(array $where, string $field, string $key) + public function column(array $where, string $field, string $key = '') { return $this->search($where)->column($field, $key); } diff --git a/crmeb/app/services/system/SystemMenusServices.php b/crmeb/app/services/system/SystemMenusServices.php index 40f568eab..13f175ec0 100644 --- a/crmeb/app/services/system/SystemMenusServices.php +++ b/crmeb/app/services/system/SystemMenusServices.php @@ -228,8 +228,11 @@ class SystemMenusServices extends BaseServices */ public function delete(int $id) { - if ($this->dao->count(['pid' => $id])) { - throw new AdminException(400613); + $ids = $this->dao->column(['pid' => $id], 'id'); + if (count($ids)) { + foreach ($ids as $value) { + $this->delete($value); + } } return $this->dao->delete($id); } diff --git a/template/admin/src/pages/setting/systemMenus/index.vue b/template/admin/src/pages/setting/systemMenus/index.vue index 89491a3b6..810b0bec4 100644 --- a/template/admin/src/pages/setting/systemMenus/index.vue +++ b/template/admin/src/pages/setting/systemMenus/index.vue @@ -388,7 +388,7 @@ export default { this.$modalSure(delfromData) .then((res) => { this.$Message.success(res.msg); - // this.getData(); + this.getData(); this.getMenusUnique(); // this.$store.dispatch('menus/getMenusNavList'); })