From f1da00a2a3ca6713aedce6d9a989929c5cd40bad Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 23 Mar 2017 16:20:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E6=A8=A1=E5=9E=8B=E7=B1=BB?= =?UTF-8?q?=E7=9A=84save=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index b47110c0..ae4f2993 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -917,10 +917,9 @@ abstract class Model implements \JsonSerializable, \ArrayAccess } } - // 清空change - $this->change = []; // 更新回调 $this->trigger('after_update', $this); + } else { // 自动写入 $this->autoCompleteData($this->insert); @@ -958,14 +957,16 @@ abstract class Model implements \JsonSerializable, \ArrayAccess // 标记为更新 $this->isUpdate = true; - // 清空change - $this->change = []; + // 新增回调 $this->trigger('after_insert', $this); } // 写入回调 $this->trigger('after_write', $this); + // 清空change + $this->change = []; + return $result; }