改进Model类的autoCompleteData方法

This commit is contained in:
thinkphp
2016-07-19 14:50:22 +08:00
parent 382e6a1f29
commit 6eca693dcd

View File

@@ -756,7 +756,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
$value = null; $value = null;
} }
if (!in_array($field, $this->change)) { if (!in_array($field, $this->change)) {
$this->setAttr($field, isset($this->data[$field]) ? $this->data[$field] : $value); $this->setAttr($field, !is_null($value) ? $value : (isset($this->data[$field]) ? $this->data[$field] : $value));
} }
} }
} }