From 13efe2a56205c53e44cf08e894aebfc7dbd2f279 Mon Sep 17 00:00:00 2001 From: Anyon Date: Tue, 29 Sep 2020 11:19:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=8F=9C=E5=8D=95=E7=BC=96?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E5=85=81=E8=AE=B8=E4=B8=8A=E7=BA=A7=E5=BE=80?= =?UTF-8?q?=E4=B8=8B=E7=BA=A7=E7=A7=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Menu.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/admin/controller/Menu.php b/app/admin/controller/Menu.php index 27f52eb54..3c042bf66 100644 --- a/app/admin/controller/Menu.php +++ b/app/admin/controller/Menu.php @@ -98,11 +98,11 @@ class Menu extends Controller protected function _form_filter(array &$vo) { if ($this->request->isGet()) { - // 清理权限节点 + /* 清理权限节点 */ AdminService::instance()->clearCache(); - // 选择自己的上级菜单 + /* 选择自己的上级菜单 */ $vo['pid'] = $vo['pid'] ?? input('pid', '0'); - // 读取系统功能节点 + /* 读取系统功能节点 */ $this->auths = []; $this->nodes = MenuService::instance()->getList(); foreach (NodeService::instance()->getMethods() as $node => $item) { @@ -110,13 +110,13 @@ class Menu extends Controller $this->auths[] = ['node' => $node, 'title' => $item['title']]; } } - // 列出可选上级菜单 + /* 列出可选上级菜单 */ $menus = $this->app->db->name($this->table)->order('sort desc,id asc')->column('id,pid,icon,url,node,title,params', 'id'); $this->menus = DataExtend::arr2table(array_merge($menus, [['id' => '0', 'pid' => '-1', 'url' => '#', 'title' => '顶部菜单']])); - if (isset($vo['id'])) foreach ($this->menus as $key => $menu) if ($menu['id'] === $vo['id']) $vo = $menu; - foreach ($this->menus as $key => $menu) { - if ($menu['spt'] >= 3 || $menu['url'] !== '#') unset($this->menus[$key]); - if (isset($vo['spt']) && $vo['spt'] <= $menu['spt']) unset($this->menus[$key]); + if (isset($vo['id'])) foreach ($this->menus as $menu) if ($menu['id'] === $vo['id']) $vo = $menu; + foreach ($this->menus as $key => $menu) if ($menu['spt'] >= 3 || $menu['url'] !== '#') unset($this->menus[$key]); + if (isset($vo['spt']) && isset($vo['spc']) && in_array($vo['spt'], [1, 2]) && $vo['spc'] > 0) { + foreach ($this->menus as $key => $menu) if ($vo['spt'] <= $menu['spt']) unset($this->menus[$key]); } } }