From a30b5d7f01658d68675b0b2092d9c6f243913b58 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 20 Aug 2016 14:05:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AF=E5=88=A0=E9=99=A4=E7=9A=84=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=AD=97=E6=AE=B5=E9=BB=98=E8=AE=A4=E5=80=BC=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=E4=B8=BAnull=20=E5=85=BC=E5=AE=B9=E6=9B=B4=E5=A4=9A?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E9=97=B4=E5=AD=97=E6=AE=B5=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/traits/model/SoftDelete.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/traits/model/SoftDelete.php b/library/traits/model/SoftDelete.php index c2d56f1e..57ad7f76 100644 --- a/library/traits/model/SoftDelete.php +++ b/library/traits/model/SoftDelete.php @@ -104,7 +104,9 @@ trait SoftDelete { if (static::$deleteTime) { // 恢复删除 - $this->setAttr(static::$deleteTime, 0); + $name = static::$deleteTime; + $this->change[] = $name; + $this->data[$name] = ['exp', 'null']; return $this->isUpdate()->save(); } return false; @@ -118,7 +120,7 @@ trait SoftDelete protected static function base($query) { if (static::$deleteTime) { - $query->where(static::$deleteTime, 0); + $query->where(static::$deleteTime, 'exp', 'null'); } }