From fe39b35206657daa0d61fb92cd51d2cac0376db6 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 7 Apr 2017 19:20:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=9F=A5=E8=AF=A2=E8=8C=83?= =?UTF-8?q?=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index ae6c27d7..86c874bc 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -1484,7 +1484,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess } $model = new static(); $params = func_get_args(); - $params[0] = $model->db(); + $params[0] = $model->getQuery(); if ($name instanceof \Closure) { call_user_func_array($name, $params); } elseif (is_string($name)) { @@ -1509,8 +1509,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess */ public static function useGlobalScope($use) { - $model = new static(); - static::$db = $model->db($use); + $model = new static(); return $model; } @@ -1886,7 +1885,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess public static function __callStatic($method, $args) { $model = new static(); - $query = $model->db(); + $query = $model->db(true, false); if (method_exists($model, 'scope' . $method)) { // 动态调用命名范围