From b2ae279be7e5a42bd159d1c811fa4b9632bd5ea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Wed, 15 Feb 2017 10:46:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=90=8E=E9=9D=A2=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Index.php | 28 +++++++++++++++++++------- application/admin/controller/Login.php | 2 +- application/admin/controller/Menu.php | 4 ++-- application/extra/view/admin.main.html | 2 +- extend/controller/BasicAdmin.php | 2 +- 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/application/admin/controller/Index.php b/application/admin/controller/Index.php index 00de0e75a..059c81eda 100644 --- a/application/admin/controller/Index.php +++ b/application/admin/controller/Index.php @@ -6,26 +6,36 @@ use controller\BasicAdmin; use library\Tools; use think\Db; +/** + * 后台入口 + * + * @package app\admin\controller + * @author Anyon + * @date 2017/02/15 10:41 + */ class Index extends BasicAdmin { + /** + * 后台框架布局 + * @return \think\response\View + */ public function index() { - $this->assign('ptitle', '后台管理'); - $menuList = Db::name('SystemMenu')->field('title,id,pid,url,icon')->where('status', '1')->select(); - $result = Tools::arr2tree($menuList); - $this->assign('menus', $this->_filterMenu($result)); + $list = Db::name('SystemMenu')->field('title,id,pid,url,icon')->where('status', '1')->select(); + $menus = $this->_filter_menu(Tools::arr2tree($list)); + $this->assign('title', '后台管理'); + $this->assign('menus', $menus); return view(); } /** * 后台主菜单权限过滤 - * --- 权限只检测节点三级 * @param array $menus * @return array */ - private function _filterMenu($menus) { + private function _filter_menu($menus) { foreach ($menus as $key => &$menu) { if (!empty($menu['sub'])) { - $menu['sub'] = $this->_filterMenu($menu['sub']); + $menu['sub'] = $this->_filter_menu($menu['sub']); } if (!empty($menu['sub'])) { $menu['url'] = '#'; @@ -40,6 +50,10 @@ class Index extends BasicAdmin { return $menus; } + /** + * 主机信息显示 + * @return \think\response\View + */ public function main() { $version = Db::query('select version() as ver'); $version = array_pop($version); diff --git a/application/admin/controller/Login.php b/application/admin/controller/Login.php index c5fd48ad3..85e917fc3 100644 --- a/application/admin/controller/Login.php +++ b/application/admin/controller/Login.php @@ -29,7 +29,7 @@ class Login extends BasicAdmin { */ public function index() { if ($this->request->isGet()) { - $this->assign('ptitle', '用户登录'); + $this->assign('title', '用户登录'); return $this->fetch(); } else { $username = $this->request->post('username', '', 'trim'); diff --git a/application/admin/controller/Menu.php b/application/admin/controller/Menu.php index 32d96dc93..4503ae494 100644 --- a/application/admin/controller/Menu.php +++ b/application/admin/controller/Menu.php @@ -15,7 +15,7 @@ class Menu extends BasicAdmin { * 模块标题 * @var string */ - public $ptitle = '系统菜单'; + public $title = '系统菜单'; /** * 绑定操作模型 @@ -116,7 +116,7 @@ class Menu extends BasicAdmin { $db = Db::name("SystemNode")->field('node,is_menu,menu_desc')->where('is_menu', '1')->order('node ASC'); $nodes = parent::_list($db, false, false); $this->assign('nodes', $nodes['list']); - $this->assign("ptitle", "编辑菜单"); + $this->assign("title", "编辑菜单"); return $this->fetch(); } } diff --git a/application/extra/view/admin.main.html b/application/extra/view/admin.main.html index cbd51cd86..69691483e 100644 --- a/application/extra/view/admin.main.html +++ b/application/extra/view/admin.main.html @@ -5,7 +5,7 @@ - {block name="title"}{$ptitle|default=''}{/block} + {block name="title"}{$title|default=''}{/block} diff --git a/extend/controller/BasicAdmin.php b/extend/controller/BasicAdmin.php index a81df5c68..008720833 100644 --- a/extend/controller/BasicAdmin.php +++ b/extend/controller/BasicAdmin.php @@ -113,7 +113,7 @@ class BasicAdmin extends Controller { } $this->_callback('_form_filter', $vo); $this->assign('vo', $vo); - empty($this->ptitle) or $this->assign('ptitle', $this->ptitle); + empty($this->title) or $this->assign('title', $this->title); return is_null($tpl) ? $vo : $this->display($tpl); }