From af635db08f6be71de716c5ed2044e1feefc747ea Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 10 Mar 2017 22:11:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index 9cb718ce..5137d97f 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -870,13 +870,12 @@ abstract class Model implements \JsonSerializable, \ArrayAccess } } - if (!empty($data)) { - if ($this->autoWriteTimestamp && $this->updateTime && !isset($data[$this->updateTime])) { - // 自动写入更新时间 - $data[$this->updateTime] = $this->autoWriteTimestamp($this->updateTime); - } - } else { + if (empty($data) || (count($data) == 1 && is_string($pk) && isset($data[$pk]))) { + // 没有更新 return 0; + } elseif ($this->autoWriteTimestamp && $this->updateTime && !isset($data[$this->updateTime])) { + // 自动写入更新时间 + $data[$this->updateTime] = $this->autoWriteTimestamp($this->updateTime); } if (empty($where) && !empty($this->updateWhere)) {