...
|
...
|
@@ -46,19 +46,19 @@ func (l *MiniMyLikeLogic) MiniMyLike(req *types.MiniMyLikeRequest) (resp *types. |
|
|
|
|
|
var userMap = make(map[int64]*domain.User)
|
|
|
var articleMap = make(map[int64]*domain.Article)
|
|
|
var commentMap = make(map[int64]*domain.Comment)
|
|
|
var commentMap = make(map[int64]*domain.ArticleComment)
|
|
|
|
|
|
lo.ForEach(list, func(item *domain.UserLoveFlag, index int) {
|
|
|
var (
|
|
|
user *domain.User
|
|
|
article *domain.Article
|
|
|
comment *domain.Comment
|
|
|
comment *domain.ArticleComment
|
|
|
)
|
|
|
|
|
|
if item.CommentId != 0 { // 点赞评论
|
|
|
user, _ = domain.LazyLoad(userMap, l.ctx, conn, item.CommentAuthor, l.svcCtx.UserRepository.FindOne)
|
|
|
article, _ = domain.LazyLoad(articleMap, l.ctx, conn, item.ArticleId, l.svcCtx.ArticleRepository.FindOne)
|
|
|
comment, _ = domain.LazyLoad(commentMap, l.ctx, conn, item.CommentId, l.svcCtx.CommentRepository.FindOne)
|
|
|
comment, _ = domain.LazyLoad(commentMap, l.ctx, conn, item.CommentId, l.svcCtx.ArticleCommentRepository.FindOne)
|
|
|
} else {
|
|
|
user, _ = domain.LazyLoad(userMap, l.ctx, conn, item.ArticleAuthor, l.svcCtx.UserRepository.FindOne)
|
|
|
article, _ = domain.LazyLoad(articleMap, l.ctx, conn, item.ArticleId, l.svcCtx.ArticleRepository.FindOne)
|
...
|
...
|
@@ -70,7 +70,7 @@ func (l *MiniMyLikeLogic) MiniMyLike(req *types.MiniMyLikeRequest) (resp *types. |
|
|
return
|
|
|
}
|
|
|
|
|
|
func NewItemSimple(love *domain.UserLoveFlag, user *domain.User, article *domain.Article, comment *domain.Comment) types.MyLikeItem {
|
|
|
func NewItemSimple(love *domain.UserLoveFlag, user *domain.User, article *domain.Article, comment *domain.ArticleComment) types.MyLikeItem {
|
|
|
item := types.MyLikeItem{
|
|
|
UserId: love.UserId,
|
|
|
ArticleId: love.ArticleId,
|
...
|
...
|
@@ -101,10 +101,11 @@ func NewItemSimple(love *domain.UserLoveFlag, user *domain.User, article *domain |
|
|
|
|
|
if comment != nil {
|
|
|
item.Comment = &types.SimpleComment{
|
|
|
Id: comment.Id,
|
|
|
//Content: comment.Content,
|
|
|
//CountLove: comment.CountLove,
|
|
|
//CountComment: comment.CountComment,
|
|
|
Id: comment.Id,
|
|
|
Content: comment.Content,
|
|
|
CountLove: comment.CountUserLove,
|
|
|
CountComment: comment.CountReply,
|
|
|
Show: int(comment.Show),
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|