改进模型类的checkallowfield方法

This commit is contained in:
thinkphp
2017-07-05 11:35:06 +08:00
parent 5c733a7743
commit e428c43ec5

View File

@@ -1094,19 +1094,16 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
protected function checkAllowField($auto = []) protected function checkAllowField($auto = [])
{ {
if (!empty($this->field)) { if (true === $this->field) {
if (!empty($this->origin)) { $this->field = $this->getQuery()->getTableInfo('', 'fields');
$this->field = array_keys($this->origin); $field = $this->field;
$field = $this->field; } elseif (!empty($this->field)) {
} elseif (true === $this->field) { $field = array_merge($this->field, $auto);
$this->field = $this->getQuery()->getTableInfo('', 'fields');
$field = $this->field;
} else {
$field = array_merge($this->field, $auto);
}
} else { } else {
$field = []; $field = [];
} }
return $field; return $field;
} }