This commit is contained in:
thinkphp
2016-12-26 23:06:20 +08:00
parent 7bb3e5561c
commit 0fd7259679

View File

@@ -137,11 +137,11 @@ abstract class Connection
* @param string $queryClass 查询对象类名
* @return Query
*/
public function model($model, $queryClass = '')
public function model($model = 'db', $queryClass = '')
{
if (!isset($this->query[$model])) {
$class = $queryClass ?: $this->config['query'];
$this->query[$model] = new $class($this, $model);
$this->query[$model] = new $class($this, 'db' == $model ? '' : $model);
}
return $this->query[$model];
}
@@ -155,8 +155,7 @@ abstract class Connection
*/
public function __call($method, $args)
{
$query = $this->model('datebase');
return call_user_func_array([$query, $method], $args);
return call_user_func_array([$this->model(), $method], $args);
}
/**