合并分支 'dev' 到 'test'
Dev 查看合并请求 !8
正在显示
3 个修改的文件
包含
52 行增加
和
22 行删除
| @@ -749,7 +749,9 @@ type ( | @@ -749,7 +749,9 @@ type ( | ||
| 749 | Videos []Video `json:"video,optional"` // 视频 | 749 | Videos []Video `json:"video,optional"` // 视频 |
| 750 | TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | 750 | TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] |
| 751 | WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | 751 | WhoRead []int64 `json:"whoRead,optional"` //谁可查看 |
| 752 | + WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看 | ||
| 752 | WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | 753 | WhoReview []int64 `json:"whoReview,optional"` //谁可评论 |
| 754 | + WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论 | ||
| 753 | MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | 755 | MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 |
| 754 | Tags []int64 `json:"tags"` // 标签 | 756 | Tags []int64 `json:"tags"` // 标签 |
| 755 | } | 757 | } |
| @@ -58,17 +58,43 @@ func (l *SystemGetArticleDraftLogic) SystemGetArticleDraft(req *types.SystemArti | @@ -58,17 +58,43 @@ func (l *SystemGetArticleDraftLogic) SystemGetArticleDraft(req *types.SystemArti | ||
| 58 | }) | 58 | }) |
| 59 | }) | 59 | }) |
| 60 | resp = &types.SystemArticleDraftGetResponse{ | 60 | resp = &types.SystemArticleDraftGetResponse{ |
| 61 | - Id: articleDraft.Id, | ||
| 62 | - Title: articleDraft.Title, | ||
| 63 | - Content: articleDraft.Content, | ||
| 64 | - AuthorId: articleDraft.AuthorId, | ||
| 65 | - Images: images, | ||
| 66 | - Videos: videos, | ||
| 67 | - TargetUser: int(articleDraft.TargetUser), | ||
| 68 | - WhoRead: articleDraft.WhoRead, | ||
| 69 | - WhoReview: articleDraft.WhoReview, | ||
| 70 | - MatchUrl: articleDraft.MatchUrl, | ||
| 71 | - Tags: articleDraft.Tags, | 61 | + Id: articleDraft.Id, |
| 62 | + Title: articleDraft.Title, | ||
| 63 | + Content: articleDraft.Content, | ||
| 64 | + AuthorId: articleDraft.AuthorId, | ||
| 65 | + Images: images, | ||
| 66 | + Videos: videos, | ||
| 67 | + TargetUser: int(articleDraft.TargetUser), | ||
| 68 | + WhoRead: articleDraft.WhoRead, | ||
| 69 | + WhoReadInfo: make([]types.UserShowName, 0), | ||
| 70 | + WhoReview: articleDraft.WhoReview, | ||
| 71 | + WhoReviewInfo: make([]types.UserShowName, 0), | ||
| 72 | + MatchUrl: articleDraft.MatchUrl, | ||
| 73 | + Tags: articleDraft.Tags, | ||
| 74 | + } | ||
| 75 | + userIds := lo.Union(resp.WhoRead, resp.WhoReview) | ||
| 76 | + if len(userIds) > 0 { | ||
| 77 | + _, users, err := l.svcCtx.UserRepository.Find(l.ctx, l.conn, domain.NewQueryOptions().WithKV("ids", userIds)) | ||
| 78 | + if err != nil { | ||
| 79 | + return nil, xerr.NewErrMsgErr("获取帖子异常", err) | ||
| 80 | + } | ||
| 81 | + userSlices := make(map[int64]types.UserShowName) | ||
| 82 | + lo.ForEach(users, func(user *domain.User, index int) { | ||
| 83 | + userSlices[user.Id] = types.UserShowName{ | ||
| 84 | + Id: int(user.Id), | ||
| 85 | + Name: user.Name, | ||
| 86 | + } | ||
| 87 | + }) | ||
| 88 | + lo.ForEach(resp.WhoRead, func(userId int64, index int) { | ||
| 89 | + if value, ok := userSlices[userId]; ok { | ||
| 90 | + resp.WhoReadInfo = append(resp.WhoReadInfo, value) | ||
| 91 | + } | ||
| 92 | + }) | ||
| 93 | + lo.ForEach(resp.WhoReview, func(userId int64, index int) { | ||
| 94 | + if value, ok := userSlices[userId]; ok { | ||
| 95 | + resp.WhoReviewInfo = append(resp.WhoReviewInfo, value) | ||
| 96 | + } | ||
| 97 | + }) | ||
| 72 | } | 98 | } |
| 73 | return | 99 | return |
| 74 | } | 100 | } |
| @@ -1563,17 +1563,19 @@ type SystemArticleDraftGetRequest struct { | @@ -1563,17 +1563,19 @@ type SystemArticleDraftGetRequest struct { | ||
| 1563 | } | 1563 | } |
| 1564 | 1564 | ||
| 1565 | type SystemArticleDraftGetResponse struct { | 1565 | type SystemArticleDraftGetResponse struct { |
| 1566 | - Id int64 `json:"id"` //ID | ||
| 1567 | - Title string `json:"title"` //标题 | ||
| 1568 | - Content string `json:"content"` //文章的文本内容 | ||
| 1569 | - AuthorId int64 `json:"authorId"` //发布人id | ||
| 1570 | - Images []string `json:"images,optional"` //图片 | ||
| 1571 | - Videos []Video `json:"video,optional"` // 视频 | ||
| 1572 | - TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | ||
| 1573 | - WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | ||
| 1574 | - WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | ||
| 1575 | - MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | ||
| 1576 | - Tags []int64 `json:"tags"` // 标签 | 1566 | + Id int64 `json:"id"` //ID |
| 1567 | + Title string `json:"title"` //标题 | ||
| 1568 | + Content string `json:"content"` //文章的文本内容 | ||
| 1569 | + AuthorId int64 `json:"authorId"` //发布人id | ||
| 1570 | + Images []string `json:"images,optional"` //图片 | ||
| 1571 | + Videos []Video `json:"video,optional"` // 视频 | ||
| 1572 | + TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | ||
| 1573 | + WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | ||
| 1574 | + WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看 | ||
| 1575 | + WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | ||
| 1576 | + WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论 | ||
| 1577 | + MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | ||
| 1578 | + Tags []int64 `json:"tags"` // 标签 | ||
| 1577 | } | 1579 | } |
| 1578 | 1580 | ||
| 1579 | type SystemArticleSearchDeletedRequest struct { | 1581 | type SystemArticleSearchDeletedRequest struct { |
-
请 注册 或 登录 后发表评论