From bc463d44a2b1235de9d70a31c0f0f283f6be0330 Mon Sep 17 00:00:00 2001 From: xuanchen <122383162@qq.com> Date: Wed, 18 Jan 2023 13:27:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Traits/HasStatus.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/Traits/HasStatus.php b/app/Traits/HasStatus.php index 56c266a..64f3035 100644 --- a/app/Traits/HasStatus.php +++ b/app/Traits/HasStatus.php @@ -35,14 +35,17 @@ trait HasStatus 3 => '关闭', ]; - $statusData = constant(get_class($this)."::STATUS"); + if (defined(get_class($this)."::STATUS")) { + $statusData = constant(get_class($this)."::STATUS"); - if (isset($this->status_map) && ! empty($this->status_map)) { - $status_map = $this->status_map; - } elseif ($statusData) { - $status_map = $statusData; + if (isset($this->status_map) && ! empty($this->status_map)) { + $status_map = $this->status_map; + } elseif ($statusData) { + $status_map = $statusData; + } } + return $status_map; }