正在显示
3 个修改的文件
包含
11 行增加
和
6 行删除
| @@ -430,10 +430,12 @@ func (l *MiniCreateArticleLogic) validateTextLimit(req *types.MiniArticleCreateR | @@ -430,10 +430,12 @@ func (l *MiniCreateArticleLogic) validateTextLimit(req *types.MiniArticleCreateR | ||
| 430 | for i := range req.Section { | 430 | for i := range req.Section { |
| 431 | num := utf8.RuneCountInString(req.Section[i]) | 431 | num := utf8.RuneCountInString(req.Section[i]) |
| 432 | wordNum += num | 432 | wordNum += num |
| 433 | + if num > 1000 { | ||
| 434 | + return xerr.NewErrMsg("内容最多只能输入1000字") | ||
| 435 | + } | ||
| 433 | } | 436 | } |
| 434 | if wordNum > 1000 { | 437 | if wordNum > 1000 { |
| 435 | - return xerr.NewErrMsg("内容最多只能输入1000字") | 438 | + //return xerr.NewErrMsg("内容最多只能输入1000字") |
| 436 | } | 439 | } |
| 437 | - | ||
| 438 | return nil | 440 | return nil |
| 439 | } | 441 | } |
| @@ -188,9 +188,9 @@ func (l *SystemCreateArticleLogic) validate(req *types.SystemArticleCreateReques | @@ -188,9 +188,9 @@ func (l *SystemCreateArticleLogic) validate(req *types.SystemArticleCreateReques | ||
| 188 | return errors.New("标题最多只能输入64字") | 188 | return errors.New("标题最多只能输入64字") |
| 189 | } | 189 | } |
| 190 | //文章内容 | 190 | //文章内容 |
| 191 | - if utf8.RuneCountInString(req.Content) > 1000 { | ||
| 192 | - return errors.New("内容最多只能输入1000字") | ||
| 193 | - } | 191 | + //if utf8.RuneCountInString(req.Content) > 1000 { |
| 192 | + // return errors.New("内容最多只能输入1000字") | ||
| 193 | + //} | ||
| 194 | //图片 | 194 | //图片 |
| 195 | if len(req.Images) > 9 { | 195 | if len(req.Images) > 9 { |
| 196 | return errors.New("图片数量最多9张") | 196 | return errors.New("图片数量最多9张") |
| @@ -200,10 +200,13 @@ func (l *SystemUpdateArticleLogic) validateTextLimit(req *types.SystemArticleUpd | @@ -200,10 +200,13 @@ func (l *SystemUpdateArticleLogic) validateTextLimit(req *types.SystemArticleUpd | ||
| 200 | wordNum := 0 | 200 | wordNum := 0 |
| 201 | for i := range req.Section { | 201 | for i := range req.Section { |
| 202 | num := utf8.RuneCountInString(req.Section[i].Content) | 202 | num := utf8.RuneCountInString(req.Section[i].Content) |
| 203 | + if num > 1000 { | ||
| 204 | + return xerr.NewErrMsg("内容最多只能输入1000字") | ||
| 205 | + } | ||
| 203 | wordNum += num | 206 | wordNum += num |
| 204 | } | 207 | } |
| 205 | if wordNum > 1000 { | 208 | if wordNum > 1000 { |
| 206 | - return xerr.NewErrMsg("内容最多只能输入1000字") | 209 | + //return xerr.NewErrMsg("内容最多只能输入1000字") |
| 207 | } | 210 | } |
| 208 | return nil | 211 | return nil |
| 209 | } | 212 | } |
-
请 注册 或 登录 后发表评论