From 3c28fda91f22905a2126cfe63350ebd38a922572 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=81=E7=81=AB=E8=A1=8C=E8=80=85?= Date: Mon, 13 Sep 2021 19:20:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8A=A5=E9=94=99=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Common/Utils.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Common/Utils.php b/src/Common/Utils.php index 167dced..4437989 100644 --- a/src/Common/Utils.php +++ b/src/Common/Utils.php @@ -129,12 +129,14 @@ class Utils } } - if ($msg != '' && stristr($msg, 'SQLSTATE')) { - app('log')->info('database-error:' . $msg . ' api:' . $request->getUri()->getPath()); - if (app()->config('debug')) { - $msg = '数据库异常' . $msg; - } else { - $msg = '数据库异常'; + $isDebug = app()->config('debug'); + if ($msg != '') { + if (stristr($msg, 'SQLSTATE')) { + app('log')->info('database-error:' . $msg . ' api:' . $request->getUri()->getPath()); + !$isDebug && $msg = '数据库异常'; + } else if (stristr($msg, 'called') && stristr($msg, 'line')) { + app('log')->info('internal-error:' . $msg . ' api:' . $request->getUri()->getPath()); + !$isDebug && $msg = '内部错误'; } } -- Gitee