fix: delete a token with a negative quota will now update the account's quota correctly (close #51)

This commit is contained in:
JustSong 2023-05-11 20:05:49 +08:00
parent 80065de8a3
commit 241ade2fae

View File

@ -121,7 +121,7 @@ func DeleteTokenById(id int, userId int) (err error) {
if quota > 0 { if quota > 0 {
err = IncreaseUserQuota(userId, quota) err = IncreaseUserQuota(userId, quota)
} else { } else {
err = DecreaseUserQuota(userId, quota) err = DecreaseUserQuota(userId, -quota)
} }
} }
if err != nil { if err != nil {