作者 庄敏学

合并分支 'dev' 到 'test'

Dev



查看合并请求 !8
... ... @@ -749,7 +749,9 @@ type (
Videos []Video `json:"video,optional"` // 视频
TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人]
WhoRead []int64 `json:"whoRead,optional"` //谁可查看
WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看
WhoReview []int64 `json:"whoReview,optional"` //谁可评论
WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论
MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本
Tags []int64 `json:"tags"` // 标签
}
... ...
... ... @@ -58,17 +58,43 @@ func (l *SystemGetArticleDraftLogic) SystemGetArticleDraft(req *types.SystemArti
})
})
resp = &types.SystemArticleDraftGetResponse{
Id: articleDraft.Id,
Title: articleDraft.Title,
Content: articleDraft.Content,
AuthorId: articleDraft.AuthorId,
Images: images,
Videos: videos,
TargetUser: int(articleDraft.TargetUser),
WhoRead: articleDraft.WhoRead,
WhoReview: articleDraft.WhoReview,
MatchUrl: articleDraft.MatchUrl,
Tags: articleDraft.Tags,
Id: articleDraft.Id,
Title: articleDraft.Title,
Content: articleDraft.Content,
AuthorId: articleDraft.AuthorId,
Images: images,
Videos: videos,
TargetUser: int(articleDraft.TargetUser),
WhoRead: articleDraft.WhoRead,
WhoReadInfo: make([]types.UserShowName, 0),
WhoReview: articleDraft.WhoReview,
WhoReviewInfo: make([]types.UserShowName, 0),
MatchUrl: articleDraft.MatchUrl,
Tags: articleDraft.Tags,
}
userIds := lo.Union(resp.WhoRead, resp.WhoReview)
if len(userIds) > 0 {
_, users, err := l.svcCtx.UserRepository.Find(l.ctx, l.conn, domain.NewQueryOptions().WithKV("ids", userIds))
if err != nil {
return nil, xerr.NewErrMsgErr("获取帖子异常", err)
}
userSlices := make(map[int64]types.UserShowName)
lo.ForEach(users, func(user *domain.User, index int) {
userSlices[user.Id] = types.UserShowName{
Id: int(user.Id),
Name: user.Name,
}
})
lo.ForEach(resp.WhoRead, func(userId int64, index int) {
if value, ok := userSlices[userId]; ok {
resp.WhoReadInfo = append(resp.WhoReadInfo, value)
}
})
lo.ForEach(resp.WhoReview, func(userId int64, index int) {
if value, ok := userSlices[userId]; ok {
resp.WhoReviewInfo = append(resp.WhoReviewInfo, value)
}
})
}
return
}
... ...
... ... @@ -1563,17 +1563,19 @@ type SystemArticleDraftGetRequest struct {
}
type SystemArticleDraftGetResponse struct {
Id int64 `json:"id"` //ID
Title string `json:"title"` //标题
Content string `json:"content"` //文章的文本内容
AuthorId int64 `json:"authorId"` //发布人id
Images []string `json:"images,optional"` //图片
Videos []Video `json:"video,optional"` // 视频
TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人]
WhoRead []int64 `json:"whoRead,optional"` //谁可查看
WhoReview []int64 `json:"whoReview,optional"` //谁可评论
MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本
Tags []int64 `json:"tags"` // 标签
Id int64 `json:"id"` //ID
Title string `json:"title"` //标题
Content string `json:"content"` //文章的文本内容
AuthorId int64 `json:"authorId"` //发布人id
Images []string `json:"images,optional"` //图片
Videos []Video `json:"video,optional"` // 视频
TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人]
WhoRead []int64 `json:"whoRead,optional"` //谁可查看
WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看
WhoReview []int64 `json:"whoReview,optional"` //谁可评论
WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论
MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本
Tags []int64 `json:"tags"` // 标签
}
type SystemArticleSearchDeletedRequest struct {
... ...