正在显示
3 个修改的文件
包含
30 行增加
和
0 行删除
| @@ -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 | } |
| @@ -66,9 +66,35 @@ func (l *SystemGetArticleDraftLogic) SystemGetArticleDraft(req *types.SystemArti | @@ -66,9 +66,35 @@ func (l *SystemGetArticleDraftLogic) SystemGetArticleDraft(req *types.SystemArti | ||
| 66 | Videos: videos, | 66 | Videos: videos, |
| 67 | TargetUser: int(articleDraft.TargetUser), | 67 | TargetUser: int(articleDraft.TargetUser), |
| 68 | WhoRead: articleDraft.WhoRead, | 68 | WhoRead: articleDraft.WhoRead, |
| 69 | + WhoReadInfo: make([]types.UserShowName, 0), | ||
| 69 | WhoReview: articleDraft.WhoReview, | 70 | WhoReview: articleDraft.WhoReview, |
| 71 | + WhoReviewInfo: make([]types.UserShowName, 0), | ||
| 70 | MatchUrl: articleDraft.MatchUrl, | 72 | MatchUrl: articleDraft.MatchUrl, |
| 71 | Tags: articleDraft.Tags, | 73 | Tags: articleDraft.Tags, |
| 72 | } | 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 | + }) | ||
| 98 | + } | ||
| 73 | return | 99 | return |
| 74 | } | 100 | } |
| @@ -1571,7 +1571,9 @@ type SystemArticleDraftGetResponse struct { | @@ -1571,7 +1571,9 @@ type SystemArticleDraftGetResponse struct { | ||
| 1571 | Videos []Video `json:"video,optional"` // 视频 | 1571 | Videos []Video `json:"video,optional"` // 视频 |
| 1572 | TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | 1572 | TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] |
| 1573 | WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | 1573 | WhoRead []int64 `json:"whoRead,optional"` //谁可查看 |
| 1574 | + WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看 | ||
| 1574 | WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | 1575 | WhoReview []int64 `json:"whoReview,optional"` //谁可评论 |
| 1576 | + WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论 | ||
| 1575 | MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | 1577 | MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 |
| 1576 | Tags []int64 `json:"tags"` // 标签 | 1578 | Tags []int64 `json:"tags"` // 标签 |
| 1577 | } | 1579 | } |
-
请 注册 或 登录 后发表评论