From e428c43ec5138c989cfdb38ac300a964ad77f9cb Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 5 Jul 2017 11:35:06 +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=84checkallowfield=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 | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index b90cd54e..1e76f3f9 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -1094,19 +1094,16 @@ abstract class Model implements \JsonSerializable, \ArrayAccess protected function checkAllowField($auto = []) { - if (!empty($this->field)) { - if (!empty($this->origin)) { - $this->field = array_keys($this->origin); - $field = $this->field; - } elseif (true === $this->field) { - $this->field = $this->getQuery()->getTableInfo('', 'fields'); - $field = $this->field; - } else { - $field = array_merge($this->field, $auto); - } + if (true === $this->field) { + $this->field = $this->getQuery()->getTableInfo('', 'fields'); + $field = $this->field; + } elseif (!empty($this->field)) { + $field = array_merge($this->field, $auto); } else { $field = []; + } + return $field; }