From 653437d80f85f5021c2e30e512cd5ba96852af22 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 30 Sep 2016 12:42:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E8=81=9A=E5=90=88=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/model/Merge.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/library/think/model/Merge.php b/library/think/model/Merge.php index a6c6f2f5..f30679d9 100644 --- a/library/think/model/Merge.php +++ b/library/think/model/Merge.php @@ -213,6 +213,8 @@ class Merge extends Model $result = 1; } } + // 清空change + $this->change = []; // 新增回调 $this->trigger('after_update', $this); } else { @@ -239,6 +241,9 @@ class Merge extends Model if ($insertId) { if (is_string($pk)) { $this->data[$pk] = $insertId; + if ($this->fk == $pk) { + $this->change[] = $pk; + } } $this->data[$this->fk] = $insertId; } @@ -257,6 +262,10 @@ class Merge extends Model $query->table($table)->strict(false)->insert($data); } } + // 标记为更新 + $this->isUpdate = true; + // 清空change + $this->change = []; // 新增回调 $this->trigger('after_insert', $this); }