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 = [];