From efdbe17e505d83527fda0432c65130fcd93523eb Mon Sep 17 00:00:00 2001 From: "453530270@qq.com" Date: Mon, 7 Oct 2024 18:59:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ExceptionHandle.php | 1 + app/api/config.php | 3 +++ app/api/middleware.php | 2 +- app/api/service/UserService.php | 2 +- app/common.php | 1 + composer.json | 3 ++- config/app.php | 1 + cores/exception/BaseException.php | 2 +- 8 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/ExceptionHandle.php b/app/ExceptionHandle.php index 5a358e0..5886b8d 100644 --- a/app/ExceptionHandle.php +++ b/app/ExceptionHandle.php @@ -9,6 +9,7 @@ use think\exception\HttpResponseException; use think\exception\ValidateException; use think\Response; use Throwable; +use cores\exception\BaseException; /** * 应用异常处理类 diff --git a/app/api/config.php b/app/api/config.php index e69de29..8146b62 100644 --- a/app/api/config.php +++ b/app/api/config.php @@ -0,0 +1,3 @@ + [ Env::get('easyadmin.admin', 'douyin') => 'admin', + 'api' => 'api', ], // 后台别名 'admin_alias_name' => Env::get('easyadmin.admin', 'douyin'), diff --git a/cores/exception/BaseException.php b/cores/exception/BaseException.php index 27a0404..a818721 100644 --- a/cores/exception/BaseException.php +++ b/cores/exception/BaseException.php @@ -29,7 +29,7 @@ class BaseException extends Exception public function __construct($params = []) { parent::__construct(); - $this->status = $params['status'] ?? config('status.error'); + $this->status = $params['status'] ?? 1000; $this->message = $params['message'] ?? '很抱歉,服务器内部错误'; $this->data = $params['data'] ?? []; }