添加中间件
This commit is contained in:
1 parent
e70b4b120b
commit
6e1f870e21
5 files changed
+57
-18
No files matched your search
@@ -11,22 +11,12 @@ use think\auth\Auth;
|
||||
class Base extends Controller
|
||||
{
|
||||
|
||||
// 当前类初始化
|
||||
protected function initialize()
|
||||
// 调用Auth中间件进行用户权限验证
|
||||
protected $middleware = ['YanZheng'];
|
||||
|
||||
public function _empty()
|
||||
{
|
||||
$this->quanxianyanzheng();
|
||||
$this->redirect('error/index/index');
|
||||
}
|
||||
|
||||
protected function quanxianyanzheng()
|
||||
{
|
||||
// 实例化权限验证Auth类
|
||||
$auth = new Auth();
|
||||
|
||||
// 检测权限
|
||||
// if($auth->check('show_button',1)){// 第一个参数是规则名称,第二个参数是用户UID
|
||||
// //有显示操作按钮的权限
|
||||
// }else{
|
||||
// //没有显示操作按钮的权限
|
||||
// }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user