From 16ce1907465e86477389cf0657f2fed65c33b8d1 Mon Sep 17 00:00:00 2001 From: zhaoxiang <756958008@qq.com> Date: Mon, 12 Jun 2017 17:21:26 +0800 Subject: [PATCH] =?UTF-8?q?modified=20=E4=BC=98=E5=8C=96=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/IndexController.class.php | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/Application/Admin/Controller/IndexController.class.php b/Application/Admin/Controller/IndexController.class.php index c468dc8..bc2b3a4 100644 --- a/Application/Admin/Controller/IndexController.class.php +++ b/Application/Admin/Controller/IndexController.class.php @@ -1,4 +1,5 @@ allMenu; - foreach ($menuAll as $key => $menu) { - if($menu['hide'] != 0){ - unset($menuAll[$key]); - } - } foreach ($menuAll as $menu) { - if($isAdmin){ - $menu['url'] = U($menu['url']); - $list[] = $menu; - }else{ - $authObj = new Auth(); - $authList = $authObj->getAuthList($this->uid); - if (in_array(strtolower($menu['url']), $authList) || $menu['url'] == '') { + if ($menu['hide'] == 0) { + if ($isAdmin) { $menu['url'] = U($menu['url']); $list[] = $menu; + } else { + $authObj = new Auth(); + $authList = $authObj->getAuthList($this->uid); + if (in_array(strtolower($menu['url']), $authList) || $menu['url'] == '') { + $menu['url'] = U($menu['url']); + $list[] = $menu; + } } } } + $list = listToTree($list); + foreach ($list as $key => $item) { + if(empty($item['_child']) && $item['url'] != U('Index/welcome')){ + unset($list[$key]); + } + } + $list = formatTree($list); $this->assign('list', $list); $this->display(); }