From 919f0280bc7f8ad197bc53e62f217fd420d86d80 Mon Sep 17 00:00:00 2001 From: cjy Date: Wed, 4 Mar 2026 09:15:30 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BD=BF=E7=94=A8utf8=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E9=95=BF=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/service/cast/report.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/service/cast/report.go b/pkg/service/cast/report.go index 99ae78ad..e978401a 100644 --- a/pkg/service/cast/report.go +++ b/pkg/service/cast/report.go @@ -19,6 +19,7 @@ import ( "fonchain-fiee/pkg/utils/stime" "net/url" "os" + "unicode/utf8" "path/filepath" "strconv" "strings" @@ -416,8 +417,8 @@ func ImportCompetitiveReportBatch(ctx *gin.Context) { // 截断超长字段(按AI生成的字段长度要求) competitorReportData = truncateCompetitorReportData(competitorReportData) - // 验证标题长度(数据库字段为varchar(50)) - if len(temp.Title) > 50 { + // 验证标题长度(数据库字段为varchar(50),按字符数计算) + if utf8.RuneCountInString(temp.Title) > 50 { temp.Remark = "标题长度超出限制" req.Reports = append(req.Reports, temp) continue