diff --git a/app/controller/IndexController.php b/app/controller/IndexController.php index a892a42..4e56544 100644 --- a/app/controller/IndexController.php +++ b/app/controller/IndexController.php @@ -12,12 +12,7 @@ class IndexController public function index(Request $request) { - Log::channel('plugin.admin.default')->info('test'); - static $readme; - if (!$readme) { - $readme = file_get_contents(base_path('README.md')); - } - return $readme; + return response()->file(public_path() . '/index.html'); } public function view(Request $request) diff --git a/app/middleware/JwtAuthMiddleware.php b/app/middleware/JwtAuthMiddleware.php index 0f0d0a0..8120b65 100644 --- a/app/middleware/JwtAuthMiddleware.php +++ b/app/middleware/JwtAuthMiddleware.php @@ -50,7 +50,8 @@ class JwtAuthMiddleware implements MiddlewareInterface } // 检查 token 是否为空 if (empty($token)) { - return ApiResponse::error(401, ['error' => '缺少令牌'], '未授权'); + // return ApiResponse::error(401, ['error' => '缺少令牌'], '未授权'); + return response('',401,['error' => '缺少令牌']); } // var_dump($token); @@ -66,7 +67,8 @@ class JwtAuthMiddleware implements MiddlewareInterface } catch (\Exception $e) { var_dump($e); // 解码失败,返回无效令牌错误 - return ApiResponse::error(401, ['error' => '无效的令牌'], '无效的令牌'); + // return ApiResponse::error(401, ['error' => '无效的令牌'], '无效的令牌'); + return response('',401,['error' => '无效的令牌']); } // 将解码后的用户信息存储到请求对象的 user 属性中