From d93e59e24f17a18ad4b983db0375dcf392e8b75b Mon Sep 17 00:00:00 2001 From: Leufolium Date: Fri, 8 Mar 2024 23:03:20 +0800 Subject: [PATCH] by Robin at 20240308; moment list by ids add follow --- app/mix/service/apiservice.go | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index ae7fd7b3..84a02f87 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -1839,6 +1839,15 @@ func (s *Service) ApiGetMomentListByIds(ctx *gin.Context, req *momentproto.ApiLi return } + // 获取访问者的关注列表 + visitorMid := req.GetBaseRequest().Mid + followMap, err := s.utilGetFollowMap(ctx, visitorMid) + if err != nil { + logger.Error("utilGetFollowMap fail") + ec = errcode.ErrCodeAccountRelationSrvFail + return + } + // 填充主播信息 vos, ec := s.utilFillMomentsStreamerInfo(ctx, list, consts.InterfaceType_Api) if ec != errcode.ErrCodeMomentSrvOk { @@ -1848,8 +1857,16 @@ func (s *Service) ApiGetMomentListByIds(ctx *gin.Context, req *momentproto.ApiLi } voList = make([]*momentproto.ApiMomentVO, 0) for _, vo := range vos { - opVO, _ := vo.(*momentproto.ApiMomentVO) - voList = append(voList, opVO) + apiVO, _ := vo.(*momentproto.ApiMomentVO) + // 填充是否关注 + s.utilFillIsFollowedFillable(ctx, followMap, apiVO) + // 填充是否点赞 + if err := s.utilFillIsThumbedUpFillable(ctx, visitorMid, apiVO); err != nil { + logger.Error("utilFillIsThumbedUpFillable fail") + ec = errcode.ErrCodeThumbsUpSrvFail + return + } + voList = append(voList, apiVO) } return }