diff --git a/library/think/Model.php b/library/think/Model.php index 12948b6e..1310cf0f 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -343,14 +343,15 @@ abstract class Model implements \JsonSerializable, \ArrayAccess $method = 'set' . Loader::parseName($name, 1) . 'Attr'; if (method_exists($this, $method)) { $value = $this->$method($value, array_merge($this->data, $data)); - } - if ($this->isRelationAttr($name)) { - $isRelationData = true; } elseif (isset($this->type[$name])) { // 类型转换 $value = $this->writeTransform($value, $this->type[$name]); } + if ($this->isRelationAttr($name)) { + $isRelationData = true; + } + } // 设置数据对象属性