所有待办完成

This commit is contained in:
augushong
2019-10-10 21:26:16 +08:00
parent 44da234f53
commit b3c046e1c7
14 changed files with 525 additions and 26 deletions

View File

@@ -4,6 +4,7 @@ namespace app\admin\controller;
use app\BaseController;
use think\facade\Session;
use app\model\Admin;
use app\model\AdminPermission;
use think\exception\HttpResponseException;
use think\facade\View;
@@ -14,6 +15,7 @@ class Common extends BaseController{
public function initialize()
{
$admin_id = Session::get('admin_id');
if($this->request->controller() !== 'Login'){
@@ -29,6 +31,26 @@ class Common extends BaseController{
throw new HttpResponseException(redirect('admin/Login/index'));
}
}
if(!empty($this->adminInfo['group'])){
$current_access_info = [
'app'=>app('http')->getName(),
'controller'=>request()->controller(),
'action'=>request()->action()
];
$model_permission = AdminPermission::where($current_access_info)->find();
if(!empty($model_permission)){
if(!in_array($model_permission->id,$this->adminInfo->group->permissions)){
return $this->error('您没有访问权限');
}
}
}
}
View::assign('admin',$this->adminInfo);