...
|
...
|
@@ -117,19 +117,7 @@ func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleU |
|
|
//文章内容
|
|
|
articleSections := l.getSections(req, article)
|
|
|
//设置内容概要
|
|
|
if len(req.Section) > 0 {
|
|
|
// 截取内容 50个字
|
|
|
runeNumber := 0 //字数
|
|
|
stringIndex := 0 //字符串长度
|
|
|
for i := range req.Section[0].Content {
|
|
|
if runeNumber > 50 {
|
|
|
break
|
|
|
}
|
|
|
runeNumber += 1
|
|
|
stringIndex = i
|
|
|
}
|
|
|
article.Summary = req.Section[0].Content[0:stringIndex]
|
|
|
}
|
|
|
article.SetSummary(articleSections)
|
|
|
|
|
|
err = transaction.UseTrans(l.ctx, l.conn.DB(), func(ctx context.Context, c transaction.Conn) error {
|
|
|
_, err = l.svcCtx.ArticleRepository.Update(l.ctx, c, article)
|
...
|
...
|
|