Commit e78289d1 by CalciumIon

feat: 统计无限令牌的已用额度 (close #308)

parent ab5f17d0
...@@ -272,15 +272,13 @@ func PostConsumeTokenQuota(tokenId int, userQuota int, quota int, preConsumedQuo ...@@ -272,15 +272,13 @@ func PostConsumeTokenQuota(tokenId int, userQuota int, quota int, preConsumedQuo
return err return err
} }
if !token.UnlimitedQuota { if quota > 0 {
if quota > 0 { err = DecreaseTokenQuota(tokenId, quota)
err = DecreaseTokenQuota(tokenId, quota) } else {
} else { err = IncreaseTokenQuota(tokenId, -quota)
err = IncreaseTokenQuota(tokenId, -quota) }
} if err != nil {
if err != nil { return err
return err
}
} }
if sendEmail { if sendEmail {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment