From 177a2456e8c9d3f3123787ddb2ac19a2098eff8e Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 6 Aug 2016 13:08:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BQuery=E7=B1=BB=E7=9A=84setInc?= =?UTF-8?q?=E5=92=8CsetDec=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Query.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/library/think/db/Query.php b/library/think/db/Query.php index ba5be118..816d8d48 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -565,7 +565,13 @@ class Query // 延迟写入 $guid = md5($this->getTable() . '_' . $field . '_' . serialize($condition)); $step = $this->lazyWrite('inc', $guid, $step, $lazyTime); - return false === $step ? true : $this->setField($field, $step); + if (false === $step) { + // 清空查询条件 + $this->options = []; + return true; + } else { + return $this->setField($field, $step); + } } return $this->setField($field, ['exp', $field . '+' . $step]); } @@ -590,7 +596,13 @@ class Query // 延迟写入 $guid = md5($this->getTable() . '_' . $field . '_' . serialize($condition)); $step = $this->lazyWrite('dec', $guid, $step, $lazyTime); - return false === $step ? true : $this->setField($field, $step); + if (false === $step) { + // 清空查询条件 + $this->options = []; + return true; + } else { + return $this->setField($field, $step); + } } return $this->setField($field, ['exp', $field . '-' . $step]); }