diff --git a/application/common/controller/Base.php b/application/common/controller/Base.php index 885f908e..de56e575 100644 --- a/application/common/controller/Base.php +++ b/application/common/controller/Base.php @@ -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{ - // //没有显示操作按钮的权限 - // } - } } diff --git a/application/error/controller/Index.php b/application/error/controller/Index.php new file mode 100644 index 00000000..5dcb93d8 --- /dev/null +++ b/application/error/controller/Index.php @@ -0,0 +1,22 @@ +check('show_button',1)){// 第一个参数是规则名称,第二个参数是用户UID + // //有显示操作按钮的权限 + // }else{ + // //没有显示操作按钮的权限 + // } + + + $request->hello = 'ThinkPHP'; + $a = $request->action(); + + return $next($request); + } +} diff --git a/application/index/controller/Index.php b/application/index/controller/Index.php index 2dd6e368..93a05834 100644 --- a/application/index/controller/Index.php +++ b/application/index/controller/Index.php @@ -10,8 +10,6 @@ use think\auth\Auth; class Index extends Base { - //关闭自动时间 - protected $autoWriteTimestamp = false; // 初始化 protected function initialize() @@ -29,6 +27,7 @@ class Index extends Base $sysbasemod->title = '学生成绩统计系统'; $sysbasemod->save(); } + dump('index初始化'); } diff --git a/database/migrations/20181010075304_auth_group.php b/database/migrations/20181010075304_auth_group.php index 6328fcef..39112696 100644 --- a/database/migrations/20181010075304_auth_group.php +++ b/database/migrations/20181010075304_auth_group.php @@ -29,7 +29,7 @@ class AuthGroup extends Migrator public function change() { // 定义数据表名称 - $table = $this->table('auth_rule_group'); + $table = $this->table('auth_group'); // 添加当前表字段 $table