未进行错误处理,未登录或者参数错误直接报500,做一些处理 app/Exception/Handler render方法
if ($exception instanceof AuthenticationException ) {
return response()->json([
'status' => 401,
'message' => '未授权',
'errors' => $exception->getMessage()
], 401);
}
if ($exception instanceof ValidationException) {
return $this->invalidJson($request, $exception);
}
这里我只处理了登录和参数问题