From 9deab6835985429b721f5d2933fca7ebaf268182 Mon Sep 17 00:00:00 2001 From: molong Date: Sat, 26 Aug 2017 18:10:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A8=A1=E5=9E=8B=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=AD=97=E6=AE=B5=E6=97=A0=E6=B3=95=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/model/BaseModel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/common/model/BaseModel.php b/application/common/model/BaseModel.php index 91f01934..996d942a 100644 --- a/application/common/model/BaseModel.php +++ b/application/common/model/BaseModel.php @@ -116,7 +116,7 @@ class BaseModel { * @return $this */ public function setAttr($name, $value, $data = []) { - if (is_null($value) && $this->autoWriteTimestamp && in_array($name, [$this->createTime, $this->updateTime])) { + if ((is_null($value) || !$value) && $this->autoWriteTimestamp && in_array($name, [$this->createTime, $this->updateTime])) { // 自动写入的时间戳字段 $value = $this->autoWriteTimestamp($name); } else {