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
Unverified
Commit
1e11dfcf
authored
Jul 06, 2026
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(user): better messages for redeem failures
parent
17465b85
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
4 deletions
+2
-4
controller/user.go
+2
-4
No files found.
controller/user.go
View file @
1e11dfcf
...
...
@@ -1311,11 +1311,9 @@ func TopUp(c *gin.Context) {
}
quota
,
err
:=
model
.
Redeem
(
req
.
Key
,
id
)
if
err
!=
nil
{
if
errors
.
Is
(
err
,
model
.
ErrRedeemFailed
)
{
// 不向用户暴露兑换失败的细分原因,避免攻击者根据错误类型判断兑换码状态。
common
.
ApiErrorI18n
(
c
,
i18n
.
MsgRedeemFailed
)
return
}
common
.
ApiError
(
c
,
err
)
logger
.
LogError
(
c
,
fmt
.
Sprintf
(
"failed to redeem key %s for user %d: %s"
,
req
.
Key
,
id
,
err
.
Error
()))
return
}
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
...
...
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