From bf47dde04cca85e21bc108f462398b3a97f611d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 27 Apr 2021 18:52:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Database/Command.php | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/Database/Command.php b/Database/Command.php index 3b59f078..a6a483ae 100644 --- a/Database/Command.php +++ b/Database/Command.php @@ -132,36 +132,13 @@ class Command extends Component if (microtime(true) - $time >= 0.03) { $this->warning('execute sql Worker.' . env('worker') . '.' . Coroutine::getCid() . '`' . $this->sql . '` use time ' . (microtime(true) - $time)); } + return $result; } catch (\Throwable $exception) { - $message = $this->sql . '. error: ' . $exception->getMessage(); - - $result = $this->addError($message, 'mysql'); - } finally { - return $this->setExecuteLog($time, $result); + return $this->addError($this->sql . '. error: ' . $exception->getMessage(), 'mysql'); } } - /** - * @param $time - * @param $result - * @return mixed - * @throws Exception - */ - #[Pure] private function setExecuteLog($time, $result): mixed - { - $export['sql'] = $this->sql; - $export['param'] = $this->params; - $export['startTime'] = $time; - $export['endTime'] = microtime(true); - $export['time'] = $export['endTime'] - $time; - - logger()->debug(Json::encode($export), 'mysql'); - - return $result; - } - - /** * @param $type * @return mixed