...
|
...
|
@@ -47,17 +47,30 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS |
|
|
})
|
|
|
//查询用户数据,重新赋值更新用户名称
|
|
|
_, users, _ := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().WithFindOnly().WithKV("ids", authorIds))
|
|
|
//获取标签
|
|
|
_, tags, _ := l.svcCtx.ArticleTagRepository.Find(l.ctx, conn, req.CompanyId, domain.NewQueryOptions())
|
|
|
lo.ForEach(articles, func(item *domain.Article, index int) {
|
|
|
//图片
|
|
|
images := make([]string, 0)
|
|
|
lo.ForEach(item.Images, func(img domain.Image, n int) {
|
|
|
images = append(images, img.Url)
|
|
|
})
|
|
|
//发布人
|
|
|
author := item.Author.Name
|
|
|
for _, user := range users {
|
|
|
if user.Id == item.AuthorId {
|
|
|
author = user.Name
|
|
|
}
|
|
|
}
|
|
|
//标签
|
|
|
articleTags := make([]string, 0)
|
|
|
lo.ForEach(item.Tags, func(tagId int64, index int) {
|
|
|
for _, t := range tags {
|
|
|
if t.Id == tagId {
|
|
|
articleTags = append(articleTags, t.Name)
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
resp.List = append(resp.List, types.SystemArticleSearch{
|
|
|
Id: item.Id,
|
|
|
Title: item.Title,
|
...
|
...
|
@@ -68,7 +81,7 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS |
|
|
CountLove: item.CountLove,
|
|
|
CountComment: item.CountComment,
|
|
|
Show: int(item.Show),
|
|
|
Tags: nil,
|
|
|
Tags: articleTags,
|
|
|
TargetUser: int(item.TargetUser),
|
|
|
})
|
|
|
})
|
...
|
...
|
|