added 实现菜单的显示控制

This commit is contained in:
zhaoxiang 2016-11-15 13:43:40 +08:00
parent a2bb140d01
commit 3b323e2869
3 changed files with 10 additions and 3 deletions

View File

@ -93,7 +93,7 @@ class Base extends Controller {
private function checkRule(){
$check = (new \Permission())->check($this->url, $this->uid);
if( !$check ){
if( !$check && !isAdministrator() ){
$this->error('权限认证失败!', '');
}
}

View File

@ -8,9 +8,16 @@ class Index extends Base {
$dataObj = Menu::all(function($query){
$query->order('sort', 'asc');
});
$authList = (new \Permission())->getAuthList($this->uid);
foreach ($dataObj as $value){
if( !$value->hide ){
$data[] = $value->toArray();
if( isAdministrator() ){
$data[] = $value->toArray();
}else{
if( (isset($authList[$value->url]) && $authList[$value->url]) || empty($value->url) ){
$data[] = $value->toArray();
}
}
}
}
$data = listToTree($data);

View File

@ -15,7 +15,7 @@ return [
'WEBSITE_DOMAIN' => 'http://www.7d-vision.com', //官方网址
'COMPANY_NAME' => '北京七维视觉科技有限公司', //公司名称
'SQL_PRIMARY_KEY' => 'id',
'USER_ADMINISTRATOR' => 1,
'USER_ADMINISTRATOR' => 4,
// +----------------------------------------------------------------------
// | 应用设置