作者 庄敏学

合并分支 'dev' 到 'test'

Dev



查看合并请求 !11
@@ -292,15 +292,19 @@ func (l *SystemCreateArticleLogic) getSections(req *types.SystemArticleCreateReq @@ -292,15 +292,19 @@ func (l *SystemCreateArticleLogic) getSections(req *types.SystemArticleCreateReq
292 sortBy := 1 292 sortBy := 1
293 sections := strings.Split(req.Content, "\n") 293 sections := strings.Split(req.Content, "\n")
294 lo.ForEach(sections, func(item string, index int) { 294 lo.ForEach(sections, func(item string, index int) {
295 - section := domain.ArticleSection{  
296 - CompanyId: article.CompanyId,  
297 - Version: article.Version,  
298 - ArticleId: article.Id,  
299 - Content: item,  
300 - SortBy: sortBy, 295 + //去除空
  296 + item = strings.TrimSpace(item)
  297 + if item != "" {
  298 + section := domain.ArticleSection{
  299 + CompanyId: article.CompanyId,
  300 + Version: article.Version,
  301 + ArticleId: article.Id,
  302 + Content: item,
  303 + SortBy: sortBy,
  304 + }
  305 + articleSections = append(articleSections, &section)
  306 + sortBy++
301 } 307 }
302 - articleSections = append(articleSections, &section)  
303 - sortBy++  
304 }) 308 })
305 return articleSections 309 return articleSections
306 } 310 }
@@ -80,7 +80,7 @@ func (l *SystemDeleteArticleLogic) SystemDeleteArticle(req *types.SystemArticleD @@ -80,7 +80,7 @@ func (l *SystemDeleteArticleLogic) SystemDeleteArticle(req *types.SystemArticleD
80 //消息通知 80 //消息通知
81 messageLogic := message.NewMiniSystemLogic(l.ctx, l.svcCtx) 81 messageLogic := message.NewMiniSystemLogic(l.ctx, l.svcCtx)
82 mTime := time.Unix(article.CreatedAt, 0).Format("2006-01-02 15:04") 82 mTime := time.Unix(article.CreatedAt, 0).Format("2006-01-02 15:04")
83 - err = messageLogic.ArticleDeleted(conn, article.CompanyId, article.AuthorId, mTime) 83 + err = messageLogic.ArticleDeleted(conn, article.CompanyId, article.AuthorId, mTime, article.Title)
84 if err != nil { 84 if err != nil {
85 return xerr.NewErrMsgErr("删除失败", err) 85 return xerr.NewErrMsgErr("删除失败", err)
86 } 86 }
@@ -58,8 +58,8 @@ func (l *MiniSystemLogic) ArticleDefined(conn transaction.Conn, companyId, at in @@ -58,8 +58,8 @@ func (l *MiniSystemLogic) ArticleDefined(conn transaction.Conn, companyId, at in
58 } 58 }
59 59
60 // ArticleDeleted 帖子删除 60 // ArticleDeleted 帖子删除
61 -func (l *MiniSystemLogic) ArticleDeleted(conn transaction.Conn, companyId, at int64, item string) (err error) {  
62 - return l.createMessage(conn, companyId, at, domain.MsgTypeNormal, "帖子已删除", fmt.Sprintf("你于%v发布的帖子已被删除,如有疑问,请联系运营管理员了解详情。", item)) 61 +func (l *MiniSystemLogic) ArticleDeleted(conn transaction.Conn, companyId, at int64, createdTime, title string) (err error) {
  62 + return l.createMessage(conn, companyId, at, domain.MsgTypeNormal, "帖子已删除", fmt.Sprintf("你于%v发布的帖子[%v]已被删除,如有疑问,请联系运营管理员了解详情。", createdTime, title))
63 } 63 }
64 64
65 //// ArticleAuth 文章权限变更 65 //// ArticleAuth 文章权限变更