Update script.go
This commit is contained in:
parent
4826af4ca4
commit
23edec3492
@ -34,6 +34,15 @@ const (
|
||||
func UpdateVideoScriptCore(ctx *gin.Context, req *cast.UpdateVideoScriptReq) (*cast.UpdateVideoScriptResp, error) {
|
||||
var infoResp *accountFiee.UserInfoResponse
|
||||
var err error
|
||||
// 检查并截取 title 和 content 长度(支持中文)
|
||||
titleRunes := []rune(req.Title)
|
||||
if len(titleRunes) > 600 {
|
||||
req.Title = string(titleRunes[:600])
|
||||
}
|
||||
contentRunes := []rune(req.Content)
|
||||
if len(contentRunes) > 600 {
|
||||
req.Content = string(contentRunes[:600])
|
||||
}
|
||||
if err = SecurityText(req.Title); err != nil {
|
||||
return nil, errors.New(fmt.Sprintf("标题未通过黄反,原因:%s", err.Error()))
|
||||
}
|
||||
@ -224,6 +233,17 @@ func ImportBatch(ctx *gin.Context) {
|
||||
req.Data = append(req.Data, &temp)
|
||||
continue
|
||||
}
|
||||
|
||||
// 检查并截取 title 和 content 长度(支持中文)
|
||||
titleRunes := []rune(temp.Title)
|
||||
if len(titleRunes) > 600 {
|
||||
temp.Title = string(titleRunes[:600])
|
||||
}
|
||||
contentRunes := []rune(temp.Content)
|
||||
if len(contentRunes) > 600 {
|
||||
temp.Content = string(contentRunes[:600])
|
||||
}
|
||||
|
||||
if utf8.RuneCountInString(temp.Title) > 50 {
|
||||
temp.Remark = "脚本标题过长,限制50字以内"
|
||||
req.Data = append(req.Data, &temp)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user