mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-11-02 16:00:40 +00:00
improve: 优化下单
This commit is contained in:
parent
34091d36e2
commit
998b363d9c
@ -14,6 +14,7 @@ namespace app\api;
|
||||
|
||||
use crmeb\exceptions\AdminException;
|
||||
use crmeb\exceptions\ApiException;
|
||||
use crmeb\exceptions\ApiStatusException;
|
||||
use crmeb\exceptions\AuthException;
|
||||
use think\db\exception\DbException;
|
||||
use think\exception\Handle;
|
||||
@ -86,11 +87,13 @@ class ApiExceptionHandle extends Handle
|
||||
] : [];
|
||||
$message = Env::get('app_debug', false) ? $e->getMessage() : '很抱歉,系统开小差了';
|
||||
// 添加自定义异常处理机制
|
||||
if ($e instanceof ApiStatusException) {
|
||||
return app('json')->status($e->getApiStatus(), $message, $e->getApiData());
|
||||
}
|
||||
if ($e instanceof AuthException || $e instanceof AdminException || $e instanceof ApiException || $e instanceof ValidateException) {
|
||||
return app('json')->make($e->getCode() ?: 400, $message, $massageData);
|
||||
} else {
|
||||
return app('json')->fail($message, $massageData);
|
||||
}
|
||||
return app('json')->fail($message, $massageData);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user