diff --git a/library/think/db/Builder.php b/library/think/db/Builder.php index 91485f86..cfc38ffa 100644 --- a/library/think/db/Builder.php +++ b/library/think/db/Builder.php @@ -263,6 +263,7 @@ abstract class Builder } } } + $whereStr .= empty($whereStr) ? substr(implode(' ', $str), strlen($key) + 1) : implode(' ', $str); } return $whereStr; diff --git a/library/think/db/Query.php b/library/think/db/Query.php index 225500fb..e463320e 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -727,7 +727,7 @@ class Query protected function parseWhereExp($operator, $field, $op, $condition, $param = []) { if ($field instanceof \Closure) { - call_user_func_array($field, [ & $this]); + $this->options['where'][$operator][] = $field; return; }