fix: 修复高并发下,高额度用户使用低额度令牌没有预扣费的问题

This commit is contained in:
CaIon committed 2024-01-10 14:23:23 +08:00
1 parent bf92840fc3
commit ac78d4ba98
2 files changed
+20 -4

No files matched your search

+5
View File
@@ -115,6 +115,11 @@ func TokenAuth() func(c *gin.Context) {
c.Set("id", token.UserId)
c.Set("token_id", token.Id)
c.Set("token_name", token.Name)
if !token.UnlimitedQuota {
c.Set("token_quota", token.RemainQuota)
} else {
c.Set("token_quota", -1)
}
if token.ModelLimitsEnabled {
c.Set("token_model_limit_enabled", true)
c.Set("token_model_limit", token.GetModelLimitsMap())