Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c19767b9
authored
Jul 05, 2024
by
CalciumIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 统计无限令牌的已用额度 (close #308)
parent
e78289d1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
5 deletions
+3
-5
model/token.go
+3
-5
No files found.
model/token.go
View file @
c19767b9
...
...
@@ -250,11 +250,9 @@ func PreConsumeTokenQuota(tokenId int, quota int) (userQuota int, err error) {
if
userQuota
<
quota
{
return
0
,
errors
.
New
(
fmt
.
Sprintf
(
"用户额度不足,剩余额度为 %d"
,
userQuota
))
}
if
!
token
.
UnlimitedQuota
{
err
=
DecreaseTokenQuota
(
tokenId
,
quota
)
if
err
!=
nil
{
return
0
,
err
}
err
=
DecreaseTokenQuota
(
tokenId
,
quota
)
if
err
!=
nil
{
return
0
,
err
}
err
=
DecreaseUserQuota
(
token
.
UserId
,
quota
)
return
userQuota
-
quota
,
err
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment