From 6c294b58fc15a5354ba26226746ff3e4c9f8e2bf Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 19 May 2016 22:14:56 +0800 Subject: [PATCH] =?UTF-8?q?Model=E7=B1=BBdestroy=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E6=88=90=E5=8A=9F=E5=88=A0=E9=99=A4=E7=9A=84?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index 149c9e09..ca0cd63a 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -671,7 +671,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess * 删除记录 * @access public * @param mixed $data 主键列表 支持闭包查询条件 - * @return integer + * @return integer 成功删除的记录数 */ public static function destroy($data) { @@ -685,13 +685,14 @@ abstract class Model implements \JsonSerializable, \ArrayAccess $data = []; } $resultSet = $query->select($data); - $result = false; + $count = 0; if ($resultSet) { foreach ($resultSet as $data) { $result = $data->delete(); + $count += $result; } } - return $result; + return $count; } /**