by Robin at 20240308; moment list by ids add follow

This commit is contained in:
Leufolium 2024-03-08 23:03:20 +08:00
parent 7497d4afe5
commit d93e59e24f
1 changed files with 19 additions and 2 deletions

View File

@ -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
}