From a4b5d8908fce01c67c75084bdd469a72dd5ccc42 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 25 Nov 2017 10:54:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Query.php | 1 + library/think/model/relation/HasMany.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/library/think/db/Query.php b/library/think/db/Query.php index a39f2387..f2a8e455 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -1239,6 +1239,7 @@ class Query $logic = strtoupper($logic); if (isset($this->options['where'][$logic][$field])) { unset($this->options['where'][$logic][$field]); + unset($this->options['multi'][$logic][$field]); } return $this; } diff --git a/library/think/model/relation/HasMany.php b/library/think/model/relation/HasMany.php index e0754c72..a27ec2ea 100644 --- a/library/think/model/relation/HasMany.php +++ b/library/think/model/relation/HasMany.php @@ -185,7 +185,7 @@ class HasMany extends Relation if ($closure) { call_user_func_array($closure, [ & $model]); } - $list = $model->where($where)->with($subRelation)->select(); + $list = $model->removeWhereField($foreignKey)->where($where)->with($subRelation)->select(); // 组装模型数据 $data = [];