sismember(BusinessCacheKey::FRONT_TOKEN_LIST['key'], $token)) { // throw new BusinessException("token已过期", BusinessCode::LOGIN_INVALID); // } // try { // $data = \Firebase\JWT\JWT::decode($token, new \Firebase\JWT\Key(env('jwt_token_key'), 'HS256')); // FrontSessionUtil::setUser($data->data); // } catch (ExpiredException $e) { // throw new BusinessException('请重新授权登陆', BusinessCode::LOGIN_INVALID); // } catch (SignatureInvalidException|\Throwable $e) { // throw new BusinessException('签名验证失败', BusinessCode::LOGIN_INVALID); // } return $next($request); } public function end(\think\Response $response): \think\Response { $response->header([ 'Access-Control-Allow-Origin' => '*', 'Access-Control-Allow-Methods' => 'GET, POST, PUT, DELETE, OPTIONS', 'Access-Control-Allow-Headers' => 'X-Requested-With, Content-Type, Accept, Origin, token,Status Code,frontToken' ]); return $response; } }