From df647e7b422d83b78a62af69513704d1842ba924 Mon Sep 17 00:00:00 2001 From: Raymond <240029725@qq.com> Date: Fri, 25 Jul 2025 22:40:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A4=E6=96=AD=E5=85=91=E6=8D=A2=E7=A0=81?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E9=95=BF=E5=BA=A6=EF=BC=8C=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E6=8C=89=E5=AD=97=E7=AC=A6=E9=95=BF=E5=BA=A6=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/redemption.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/controller/redemption.go b/controller/redemption.go index 83ec19ad..1e305e3d 100644 --- a/controller/redemption.go +++ b/controller/redemption.go @@ -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之间",