From 3e79ff0c2874e74f2d919352a72a3d4dce346c15 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 13 Sep 2016 22:02:26 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AF=E5=88=A0=E9=99=A4restore=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E6=94=AF=E6=8C=81=E4=BC=A0=E5=85=A5=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/traits/model/SoftDelete.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/library/traits/model/SoftDelete.php b/library/traits/model/SoftDelete.php index 0d0e3d18..cbfa275f 100644 --- a/library/traits/model/SoftDelete.php +++ b/library/traits/model/SoftDelete.php @@ -101,16 +101,15 @@ trait SoftDelete /** * 恢复被软删除的记录 * @access public + * @param array $where 更新条件 * @return integer */ - public function restore() + public function restore($where = []) { if (static::$deleteTime) { // 恢复删除 - $name = static::$deleteTime; - $this->change[] = $name; - $this->data[$name] = null; - return $this->isUpdate()->save(); + $name = static::$deleteTime; + return $this->isUpdate()->save([$name => null], $where); } return false; } @@ -118,6 +117,7 @@ trait SoftDelete /** * 查询默认不包含软删除数据 * @access protected + * @param \think\db\Query $query 查询对象 * @return void */ protected static function base($query)