diff --git a/application/admin/controller/auth/Rule.php b/application/admin/controller/auth/Rule.php index b006bef7..ed559005 100644 --- a/application/admin/controller/auth/Rule.php +++ b/application/admin/controller/auth/Rule.php @@ -29,6 +29,8 @@ class Rule extends Backend $ruledata = [0 => __('None')]; foreach ($this->rulelist as $k => $v) { + if (!$v['ismenu']) + continue; $ruledata[$v['id']] = $v['title']; } $this->view->assign('ruledata', $ruledata); @@ -62,6 +64,11 @@ class Rule extends Backend $params = $this->request->post("row/a"); if ($params) { + if (!$params['ismenu'] && !$params['pid']) + { + $this->msg = __('The non-menu rule must have parent'); + return; + } $this->model->create($params); AdminLog::record(__('Add'), $this->model->getLastInsID()); Cache::rm('__menu__'); @@ -87,6 +94,11 @@ class Rule extends Backend $params = $this->request->post("row/a"); if ($params) { + if (!$params['ismenu'] && !$params['pid']) + { + $this->msg = __('The non-menu rule must have parent'); + return; + } $row->save($params); AdminLog::record(__('Edit'), $ids); Cache::rm('__menu__'); diff --git a/application/admin/lang/zh-cn.php b/application/admin/lang/zh-cn.php index 3bfe0da0..1e9153b3 100644 --- a/application/admin/lang/zh-cn.php +++ b/application/admin/lang/zh-cn.php @@ -30,6 +30,8 @@ return [ 'Cancel' => '取消', 'Loading' => '加载中', 'More' => '更多', + 'Yes' => '是', + 'No' => '否', 'Normal' => '正常', 'Hidden' => '隐藏', 'Submit' => '提交', diff --git a/application/admin/lang/zh-cn/auth/rule.php b/application/admin/lang/zh-cn/auth/rule.php index d173e4d5..b1b7694c 100644 --- a/application/admin/lang/zh-cn/auth/rule.php +++ b/application/admin/lang/zh-cn/auth/rule.php @@ -2,9 +2,12 @@ return [ 'Toggle all' => '显示全部', - 'Condition' => '条件', + 'Condition' => '规则条件', 'Remark' => '备注', 'Icon' => '图标', 'Alert' => '警告', - 'If not necessary, use the command line to build rule' => '非必要情况下请使用命令行来生成', + 'Name' => '规则URL', + 'Ismenu' => '菜单', + 'The non-menu rule must have parent' => '非菜单规则节点必须有父级', + 'If not necessary, use the command line to build rule' => '非必要情况下请直接使用命令行php think menu来生成', ]; diff --git a/application/admin/view/auth/rule/add.html b/application/admin/view/auth/rule/add.html index 469289ae..960291d8 100644 --- a/application/admin/view/auth/rule/add.html +++ b/application/admin/view/auth/rule/add.html @@ -3,6 +3,12 @@ {:__('If not necessary, use the command line to build rule')}