...
|
...
|
@@ -51,36 +51,7 @@ func (l *MiniTop5ArticleCommentLogic) MiniTop5ArticleComment(req *types.MiniTop5 |
|
|
List: make([]types.ArticleCommentItem, len(commentList)),
|
|
|
}
|
|
|
for i, val := range commentList {
|
|
|
item := types.ArticleCommentItem{
|
|
|
Id: val.Id,
|
|
|
Pid: val.Pid,
|
|
|
TopId: val.TopId,
|
|
|
ArtitcleId: val.ArticleId,
|
|
|
SectionId: val.SectionId,
|
|
|
FromUserId: val.FromUserId,
|
|
|
FromUser: types.CommentAuthor{
|
|
|
Id: val.FromUser.Id,
|
|
|
Name: val.FromUser.Name,
|
|
|
Avatar: val.FromUser.Avatar,
|
|
|
Position: val.FromUser.Position,
|
|
|
Company: val.FromUser.Company,
|
|
|
},
|
|
|
ToUserId: val.ToUserId,
|
|
|
ToUser: types.CommentAuthor{
|
|
|
Id: val.ToUser.Id,
|
|
|
Name: val.ToUser.Name,
|
|
|
Avatar: val.ToUser.Avatar,
|
|
|
Position: val.ToUser.Position,
|
|
|
Company: val.ToUser.Company,
|
|
|
},
|
|
|
SectionContent: val.SectionContent,
|
|
|
CountReply: val.CountReply,
|
|
|
CountUserLove: val.CountUserLove,
|
|
|
CountAdminLove: val.CountAdminLove,
|
|
|
AtWho: []types.CommentAtWho{},
|
|
|
CreatedAt: val.CreatedAt,
|
|
|
MeLoveFlag: 0,
|
|
|
}
|
|
|
item := NewArticleCommentItem(val)
|
|
|
|
|
|
if _, ok := flagMap[val.Id]; ok {
|
|
|
item.MeLoveFlag = 1
|
...
|
...
|
@@ -95,3 +66,38 @@ func (l *MiniTop5ArticleCommentLogic) MiniTop5ArticleComment(req *types.MiniTop5 |
|
|
}
|
|
|
return
|
|
|
}
|
|
|
|
|
|
func NewArticleCommentItem(val *domain.ArticleComment) types.ArticleCommentItem {
|
|
|
item := types.ArticleCommentItem{
|
|
|
Id: val.Id,
|
|
|
Pid: val.Pid,
|
|
|
TopId: val.TopId,
|
|
|
ArtitcleId: val.ArticleId,
|
|
|
SectionId: val.SectionId,
|
|
|
FromUserId: val.FromUserId,
|
|
|
FromUser: types.CommentAuthor{
|
|
|
Id: val.FromUser.Id,
|
|
|
Name: val.FromUser.Name,
|
|
|
Avatar: val.FromUser.Avatar,
|
|
|
Position: val.FromUser.Position,
|
|
|
Company: val.FromUser.Company,
|
|
|
},
|
|
|
ToUserId: val.ToUserId,
|
|
|
ToUser: types.CommentAuthor{
|
|
|
Id: val.ToUser.Id,
|
|
|
Name: val.ToUser.Name,
|
|
|
Avatar: val.ToUser.Avatar,
|
|
|
Position: val.ToUser.Position,
|
|
|
Company: val.ToUser.Company,
|
|
|
},
|
|
|
SectionContent: val.SectionContent,
|
|
|
CountReply: val.CountReply,
|
|
|
CountUserLove: val.CountUserLove,
|
|
|
CountAdminLove: val.CountAdminLove,
|
|
|
AtWho: []types.CommentAtWho{},
|
|
|
CreatedAt: val.CreatedAt,
|
|
|
MeLoveFlag: 0,
|
|
|
Content: val.Content,
|
|
|
}
|
|
|
return item
|
|
|
} |
...
|
...
|
|