feat-IRONFANS-58-Robin #171
|
@ -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
|
||||
}
|
||||
|
|
|
@ -432,11 +432,6 @@ func (s *Service) utilGetFollowMap(ctx *gin.Context, visitorMid int64) (_map map
|
|||
}
|
||||
|
||||
func (s *Service) utilFillIsFollowedFillable(ctx *gin.Context, visitorFollowMap map[int64]*dbstruct.AccountRelation, isFollowedFillable interfaces.IsFollowedFillable) {
|
||||
mids := make([]int64, 0)
|
||||
for k, _ := range visitorFollowMap {
|
||||
mids = append(mids, k)
|
||||
}
|
||||
logger.Info("mids: %v, obj_mid: %v", mids, isFollowedFillable.GetMid())
|
||||
if visitorFollowMap[isFollowedFillable.GetMid()] != nil {
|
||||
isFollowedFillable.SetIsFollowed(consts.IsFollowed_Yes)
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue