From 5a7b9d1b2185f62db03b2e76b3453732a8124fbd Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 28 Sep 2017 17:59:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9Bmodel=E7=B1=BB=E7=9A=84destro?= =?UTF-8?q?y=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index 4a4baba1..6725c4c5 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -1643,14 +1643,14 @@ abstract class Model implements \JsonSerializable, \ArrayAccess { $model = new static(); $query = $model->db(); - if (is_array($data) && key($data) !== 0) { + if (empty($data) && 0 !== $data) { + return 0; + } elseif (is_array($data) && key($data) !== 0) { $query->where($data); $data = null; } elseif ($data instanceof \Closure) { call_user_func_array($data, [ & $query]); $data = null; - } elseif (empty($data) && 0 !== $data) { - return 0; } $resultSet = $query->select($data); $count = 0;