From c38d2a6d0d7874eb3bc86dc89b2ec14b65a9ab62 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 21 Nov 2017 15:17:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E4=B8=AD=E9=97=B4=E8=A1=A8?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E7=9A=84=E5=AE=9E=E4=BE=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Query.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/think/db/Query.php b/library/think/db/Query.php index a39f2387..f7d299a2 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -2361,8 +2361,8 @@ class Query if (count($resultSet) > 0) { foreach ($resultSet as $key => $result) { /** @var Model $model */ - $model = new $modelName($result); - $model->isUpdate(true); + $model = new $modelName(); + $model->data($result)->isUpdate(true); // 关联查询 if (!empty($options['relation'])) { @@ -2518,8 +2518,8 @@ class Query if (!empty($this->model)) { // 返回模型对象 $model = $this->model; - $result = new $model($result); - $result->isUpdate(true, isset($options['where']['AND']) ? $options['where']['AND'] : null); + $result = new $model(); + $result->data($result)->isUpdate(true, isset($options['where']['AND']) ? $options['where']['AND'] : null); // 关联查询 if (!empty($options['relation'])) { $result->relationQuery($options['relation']);