123456789101112131415161718192021222324252627282930313233 |
- <?php
-
- namespace App\Http\Middleware;
-
- use Closure;
- use App\Common\Api;
-
- class SuperAuth
- {
- /**
- * Handle an incoming request.
- *
- * @param \Illuminate\Http\Request $request
- * @param \Closure $next
- * @return mixed
- */
- public function handle($request, Closure $next)
- {
- //登录鉴权 session内用户是否存在,存在则通过,不存在则回调到登录界面
- $userInfo = $request->session()->get('userInfo');
-
- if(empty($userInfo)){
- return redirect('manage');
- }
-
- if($userInfo['is_admin'] != 1){
- return redirect('https://s1-hn.aghcdn.com/activity/common/page/crowd/errEvir.html?error='.urlencode('无权访问'));
- }
-
- return $next($request);
- }
- }
|