From 241ade2faea9973da0ffe8841a8a024694a1a4a2 Mon Sep 17 00:00:00 2001 From: JustSong Date: Thu, 11 May 2023 20:05:49 +0800 Subject: [PATCH] fix: delete a token with a negative quota will now update the account's quota correctly (close #51) --- model/token.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/token.go b/model/token.go index 64e5c4e1..66fc911e 100644 --- a/model/token.go +++ b/model/token.go @@ -121,7 +121,7 @@ func DeleteTokenById(id int, userId int) (err error) { if quota > 0 { err = IncreaseUserQuota(userId, quota) } else { - err = DecreaseUserQuota(userId, quota) + err = DecreaseUserQuota(userId, -quota) } } if err != nil {