diff --git a/library/think/Model.php b/library/think/Model.php index 55e7da8e..493d055a 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -958,14 +958,14 @@ abstract class Model implements \JsonSerializable, \ArrayAccess // 自动更新 $this->autoCompleteData($this->update); - // 获取有更新的数据 - $data = $this->getChangedData(); - // 事件回调 if (false === $this->trigger('before_update', $this)) { return false; } + // 获取有更新的数据 + $data = $this->getChangedData(); + if (empty($data) || (count($data) == 1 && is_string($pk) && isset($data[$pk]))) { // 关联更新 if (isset($relation)) {