From 70110832016fa985b50348d4801db58bdb13d556 Mon Sep 17 00:00:00 2001 From: CalciumIon <1808837298@qq.com> Date: Fri, 5 Jul 2024 20:28:17 +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 | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/model/token.go b/model/token.go index 3e371f0..27907af 100644 --- a/model/token.go +++ b/model/token.go @@ -250,11 +250,9 @@ func PreConsumeTokenQuota(tokenId int, quota int) (userQuota int, err error) { if userQuota < quota { return 0, errors.New(fmt.Sprintf("用户额度不足,剩余额度为 %d", userQuota)) } - if !token.UnlimitedQuota { - err = DecreaseTokenQuota(tokenId, quota) - if err != nil { - return 0, err - } + err = DecreaseTokenQuota(tokenId, quota) + if err != nil { + return 0, err } err = DecreaseUserQuota(token.UserId, quota) return userQuota - quota, err