From c8e9e6361cb928f6f23cbcf687b66350fdecfb94 Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Wed, 4 Nov 2020 14:09:23 +0800 Subject: [PATCH] =?UTF-8?q?add:=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E8=87=AA=E5=A2=9E/=E5=87=8F=E5=B0=91=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/catcher/CatchQuery.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/extend/catcher/CatchQuery.php b/extend/catcher/CatchQuery.php index 80321e3..a4bc152 100644 --- a/extend/catcher/CatchQuery.php +++ b/extend/catcher/CatchQuery.php @@ -230,4 +230,32 @@ class CatchQuery extends Query return $this; } + + /** + * 字段增加 + * + * @time 2020年11月04日 + * @param $field + * @param int $amount + * @throws \think\db\exception\DbException + * @return int + */ + public function increment($field, $amount = 1) + { + return $this->inc($field, $amount)->update(); + } + + /** + * 字段减少 + * + * @time 2020年11月04日 + * @param $field + * @param int $amount + * @throws \think\db\exception\DbException + * @return int + */ + public function decrement($field, $amount = 1) + { + return $this->dec($field, $amount)->update(); + } }