fix:使用utf8计算长度
This commit is contained in:
parent
02e00f9d49
commit
919f0280bc
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user