From bf807b7829475aeb778fa6b2806da4e42e10d8e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E4=B8=91=E8=B7=AF=E4=BA=BA?= <2278757482@qq.com> Date: Fri, 7 Jan 2022 16:15:17 +0800 Subject: [PATCH 1/4] optimize --- app/Library/SystemInfo.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Library/SystemInfo.php b/app/Library/SystemInfo.php index e6b3bf9..f52e94b 100644 --- a/app/Library/SystemInfo.php +++ b/app/Library/SystemInfo.php @@ -84,6 +84,7 @@ class SystemInfo $this->memory['total'] = round($memory['TotalVisibleMemorySize'] / 1024, 2); $this->memory['free'] = round($memory['FreePhysicalMemory'] / 1024, 2); + $this->memory['buffer_cache'] = 0; $this->memory['used'] = round($this->memory['total'] - $this->memory['free'], 2); $this->memory['usage_ratio'] = round(round($this->memory['used'] / $this->memory['total'], 4) * 100, 2); } else { -- Gitee From cece9e408e1806fabe5a40c839f40b876dc15e5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E4=B8=91=E8=B7=AF=E4=BA=BA?= <2278757482@qq.com> Date: Fri, 7 Jan 2022 18:00:51 +0800 Subject: [PATCH 2/4] optimize --- app/Modules/Admin/Http/Middleware/CheckAuth.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Modules/Admin/Http/Middleware/CheckAuth.php b/app/Modules/Admin/Http/Middleware/CheckAuth.php index 70e822d..26fd33d 100644 --- a/app/Modules/Admin/Http/Middleware/CheckAuth.php +++ b/app/Modules/Admin/Http/Middleware/CheckAuth.php @@ -32,9 +32,9 @@ class CheckAuth return $this->errorJson('认证失败,请重新登录!', -1); } } catch (TokenExpiredException $e) { - return $this->errorJson($e->getMessage()); + return $this->errorJson($e->getMessage(), -1); } catch (TokenInvalidException $e) { - return $this->errorJson($e->getMessage()); + return $this->errorJson($e->getMessage(), -1); } catch (JWTException $e) { return $this->errorJson($e->getMessage()); } -- Gitee From eadf379a7efb24e472262a49d873e80b5698b101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E4=B8=91=E8=B7=AF=E4=BA=BA?= <2278757482@qq.com> Date: Tue, 11 Jan 2022 09:22:15 +0800 Subject: [PATCH 3/4] optimize --- app/Exceptions/Exception.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Exceptions/Exception.php b/app/Exceptions/Exception.php index a8bf4b2..7bc7360 100644 --- a/app/Exceptions/Exception.php +++ b/app/Exceptions/Exception.php @@ -11,7 +11,7 @@ class Exception extends \Exception protected $msg; - public function __construct($message = "success", $code = 200, Throwable $previous = null) + public function __construct($message = "success", $code = 0, Throwable $previous = null) { parent::__construct($message, $code, $previous); -- Gitee From 8c22c35ad2ff811a47e9ab6d42cf2540919da63e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E4=B8=91=E8=B7=AF=E4=BA=BA?= <2278757482@qq.com> Date: Tue, 11 Jan 2022 14:04:25 +0800 Subject: [PATCH 4/4] =?UTF-8?q?QueryListener=20=E7=9A=84=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=B9=EF=BC=8C=E6=8C=89=E7=85=A7=20=20?= =?UTF-8?q?=E5=B9=B4|=E6=9C=88|=E6=97=A5=20=E7=9A=84=E5=B1=82=E7=BA=A7?= =?UTF-8?q?=E8=AE=B0=E5=BD=95mysql=E7=9A=84SQL=E8=AF=AD=E5=8F=A5=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Listeners/QueryListener.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Listeners/QueryListener.php b/app/Listeners/QueryListener.php index f604109..3863593 100644 --- a/app/Listeners/QueryListener.php +++ b/app/Listeners/QueryListener.php @@ -22,7 +22,14 @@ class QueryListener $dir_path = dirname(dirname(__DIR__)) . '/storage/logs/' . $this->log->getName(); if (!is_dir($dir_path)) mkdir($dir_path, 0755); - $log_path = storage_path('logs/' . $this->log->getName() . '/' . date('Y-m-d') . '.log'); + // 年月的日志目录 + $year_path = $dir_path . '/' . date('Y'); + if (!is_dir($year_path)) mkdir($year_path, 0755); + + $month_path = $year_path . '/' . date('m'); + if (!is_dir($month_path)) mkdir($month_path, 0755); + + $log_path = storage_path('logs/' . $this->log->getName() . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '.log'); if (!file_exists($log_path)) { fopen($log_path, "w"); } -- Gitee