mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-06 03:58:00 +08:00
added 实现菜单的显示控制
This commit is contained in:
parent
a2bb140d01
commit
3b323e2869
@ -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('权限认证失败!', '');
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -15,7 +15,7 @@ return [
|
||||
'WEBSITE_DOMAIN' => 'http://www.7d-vision.com', //官方网址
|
||||
'COMPANY_NAME' => '北京七维视觉科技有限公司', //公司名称
|
||||
'SQL_PRIMARY_KEY' => 'id',
|
||||
'USER_ADMINISTRATOR' => 1,
|
||||
'USER_ADMINISTRATOR' => 4,
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | 应用设置
|
||||
|
Loading…
x
Reference in New Issue
Block a user