You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
525 B
22 lines
525 B
<?php
|
|
|
|
namespace app\admin\middleware;
|
|
use app\utility\Jwt;
|
|
|
|
class Check
|
|
{
|
|
|
|
public function handle($request, \Closure $next)
|
|
{
|
|
$token = $request->header('Authorization');
|
|
// print_r($token);
|
|
// die();
|
|
//jwt进行校验token
|
|
$res = (new Jwt())->chekToken($token);
|
|
if ($res['code'] != 1 ){
|
|
return json(['code' => 401, 'message' => $res['msg'],'data' => $res]);
|
|
}
|
|
$request->user_id = $res['data']->user_id;
|
|
return $next($request);
|
|
}
|
|
}
|