diff --git a/library/think/Model.php b/library/think/Model.php index 7c31dc5e..605d48d3 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -178,7 +178,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess $connection = []; } // 设置当前模型 确保查询返回模型对象 - $query = Db::connect($connection)->model($model, $this->query); + $query = Db::connect($connection)->getQuery($model, $this->query); // 设置当前数据表和模型名 if (!empty($this->table)) { diff --git a/library/think/db/Connection.php b/library/think/db/Connection.php index 7392cc1d..e5c60aae 100644 --- a/library/think/db/Connection.php +++ b/library/think/db/Connection.php @@ -137,7 +137,7 @@ abstract class Connection * @param string $queryClass 查询对象类名 * @return Query */ - public function model($model = 'db', $queryClass = '') + public function getQuery($model = 'db', $queryClass = '') { if (!isset($this->query[$model])) { $class = $queryClass ?: $this->config['query']; @@ -155,7 +155,7 @@ abstract class Connection */ public function __call($method, $args) { - return call_user_func_array([$this->model(), $method], $args); + return call_user_func_array([$this->getQuery(), $method], $args); } /**