From a83fbe37dec0364455f3c42abb97d57ef93506d8 Mon Sep 17 00:00:00 2001 From: JustSong Date: Sat, 21 Sep 2024 23:00:15 +0800 Subject: [PATCH] chore: remove useless err check --- model/token.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/model/token.go b/model/token.go index eb69bac5..9616d236 100644 --- a/model/token.go +++ b/model/token.go @@ -254,17 +254,14 @@ func PreConsumeTokenQuota(tokenId int, quota int64) (err error) { func PostConsumeTokenQuota(tokenId int, quota int64) (err error) { token, err := GetTokenById(tokenId) - if err == nil { - if quota > 0 { - err = DecreaseUserQuota(token.UserId, quota) - } else { - err = IncreaseUserQuota(token.UserId, -quota) - } - } - if err != nil { return err } + if quota > 0 { + err = DecreaseUserQuota(token.UserId, quota) + } else { + err = IncreaseUserQuota(token.UserId, -quota) + } if !token.UnlimitedQuota { if quota > 0 { err = DecreaseTokenQuota(tokenId, quota)