From 752048dfb4c7a62476e5f97e3eeb97120f909643 Mon Sep 17 00:00:00 2001 From: CalciumIon <1808837298@qq.com> Date: Fri, 5 Jul 2024 20:25:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BB=9F=E8=AE=A1=E6=97=A0=E9=99=90?= =?UTF-8?q?=E4=BB=A4=E7=89=8C=E7=9A=84=E5=B7=B2=E7=94=A8=E9=A2=9D=E5=BA=A6?= =?UTF-8?q?=20(close=20#308)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/token.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/model/token.go b/model/token.go index d921b1d..3e371f0 100644 --- a/model/token.go +++ b/model/token.go @@ -272,15 +272,13 @@ func PostConsumeTokenQuota(tokenId int, userQuota int, quota int, preConsumedQuo return err } - if !token.UnlimitedQuota { - if quota > 0 { - err = DecreaseTokenQuota(tokenId, quota) - } else { - err = IncreaseTokenQuota(tokenId, -quota) - } - if err != nil { - return err - } + if quota > 0 { + err = DecreaseTokenQuota(tokenId, quota) + } else { + err = IncreaseTokenQuota(tokenId, -quota) + } + if err != nil { + return err } if sendEmail {