From a27f5299df8b1e6088e2fe68a4924be7e1273146 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 27 Jun 2017 08:17:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E6=A8=A1=E5=9E=8B=E7=9A=84sa?= =?UTF-8?q?ve=E6=96=B9=E6=B3=95=20=E9=81=BF=E5=85=8DallowField=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=BD=B1=E5=93=8D=E8=80=8C=E5=88=A0=E9=99=A4=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index 4e60b2ac..b272a148 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -975,9 +975,6 @@ abstract class Model implements \JsonSerializable, \ArrayAccess } $pk = $this->getPk(); if ($this->isUpdate) { - // 检测字段 - $this->checkAllowField($this->data, array_merge($this->auto, $this->update)); - // 自动更新 $this->autoCompleteData($this->update); @@ -988,6 +985,8 @@ abstract class Model implements \JsonSerializable, \ArrayAccess // 获取有更新的数据 $data = $this->getChangedData(); + // 检测字段 + $this->checkAllowField($data, array_merge($this->auto, $this->update)); if (empty($data) || (count($data) == 1 && is_string($pk) && isset($data[$pk]))) { // 关联更新