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
4ce58dbf
authored
Jul 26, 2025
by
Calcium-Ion
Committed by
GitHub
Jul 26, 2025
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1437 from Raymondxox/fix
判断兑换码名称长度,改为按字符长度计算
parents
2356c3fe
776402c3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletions
+2
-1
controller/redemption.go
+2
-1
No files found.
controller/redemption.go
View file @
4ce58dbf
...
...
@@ -6,6 +6,7 @@ import (
"one-api/common"
"one-api/model"
"strconv"
"unicode/utf8"
"github.com/gin-gonic/gin"
)
...
...
@@ -63,7 +64,7 @@ func AddRedemption(c *gin.Context) {
common
.
ApiError
(
c
,
err
)
return
}
if
len
(
redemption
.
Name
)
==
0
||
len
(
redemption
.
Name
)
>
20
{
if
utf8
.
RuneCountInString
(
redemption
.
Name
)
==
0
||
utf8
.
RuneCountInString
(
redemption
.
Name
)
>
20
{
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
"success"
:
false
,
"message"
:
"兑换码名称长度必须在1-20之间"
,
...
...
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