正在显示
1 个修改的文件
包含
14 行增加
和
1 行删除
@@ -47,17 +47,30 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | @@ -47,17 +47,30 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | ||
47 | }) | 47 | }) |
48 | //查询用户数据,重新赋值更新用户名称 | 48 | //查询用户数据,重新赋值更新用户名称 |
49 | _, users, _ := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().WithFindOnly().WithKV("ids", authorIds)) | 49 | _, users, _ := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().WithFindOnly().WithKV("ids", authorIds)) |
50 | + //获取标签 | ||
51 | + _, tags, _ := l.svcCtx.ArticleTagRepository.Find(l.ctx, conn, req.CompanyId, domain.NewQueryOptions()) | ||
50 | lo.ForEach(articles, func(item *domain.Article, index int) { | 52 | lo.ForEach(articles, func(item *domain.Article, index int) { |
53 | + //图片 | ||
51 | images := make([]string, 0) | 54 | images := make([]string, 0) |
52 | lo.ForEach(item.Images, func(img domain.Image, n int) { | 55 | lo.ForEach(item.Images, func(img domain.Image, n int) { |
53 | images = append(images, img.Url) | 56 | images = append(images, img.Url) |
54 | }) | 57 | }) |
58 | + //发布人 | ||
55 | author := item.Author.Name | 59 | author := item.Author.Name |
56 | for _, user := range users { | 60 | for _, user := range users { |
57 | if user.Id == item.AuthorId { | 61 | if user.Id == item.AuthorId { |
58 | author = user.Name | 62 | author = user.Name |
59 | } | 63 | } |
60 | } | 64 | } |
65 | + //标签 | ||
66 | + articleTags := make([]string, 0) | ||
67 | + lo.ForEach(item.Tags, func(tagId int64, index int) { | ||
68 | + for _, t := range tags { | ||
69 | + if t.Id == tagId { | ||
70 | + articleTags = append(articleTags, t.Name) | ||
71 | + } | ||
72 | + } | ||
73 | + }) | ||
61 | resp.List = append(resp.List, types.SystemArticleSearch{ | 74 | resp.List = append(resp.List, types.SystemArticleSearch{ |
62 | Id: item.Id, | 75 | Id: item.Id, |
63 | Title: item.Title, | 76 | Title: item.Title, |
@@ -68,7 +81,7 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | @@ -68,7 +81,7 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | ||
68 | CountLove: item.CountLove, | 81 | CountLove: item.CountLove, |
69 | CountComment: item.CountComment, | 82 | CountComment: item.CountComment, |
70 | Show: int(item.Show), | 83 | Show: int(item.Show), |
71 | - Tags: nil, | 84 | + Tags: articleTags, |
72 | TargetUser: int(item.TargetUser), | 85 | TargetUser: int(item.TargetUser), |
73 | }) | 86 | }) |
74 | }) | 87 | }) |
-
请 注册 或 登录 后发表评论