diff --git a/app/Exceptions/Exception.php b/app/Exceptions/Exception.php index a8bf4b2271d27549e41e9bf858dfab800ee14bfd..7bc73604d49a7bf9454ae5ed47f62b9e7a9022ae 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); diff --git a/app/Library/SystemInfo.php b/app/Library/SystemInfo.php index e6b3bf9f06092e31064972c1eb2e09b4580cfe28..f52e94b2c1f1345836111224ec6d7365abb07013 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 { diff --git a/app/Listeners/QueryListener.php b/app/Listeners/QueryListener.php index f604109c29eb644dc005ca81bdf5406685761575..3863593b1a5585ca152ab7bb6834a9519823b417 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"); } diff --git a/app/Modules/Admin/Http/Middleware/CheckAuth.php b/app/Modules/Admin/Http/Middleware/CheckAuth.php index 70e822d97356663c1cf795d3beed6c198e8082de..26fd33d784c39a67033e8c50f9b978dd91d70a7f 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()); }