From 7497d4afe57e49f97d7f70cc7488b7eac82ee54b Mon Sep 17 00:00:00 2001 From: Leufolium Date: Fri, 8 Mar 2024 22:46:49 +0800 Subject: [PATCH 1/2] by Robin at 20240308; remove log --- app/mix/service/utilservice.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/mix/service/utilservice.go b/app/mix/service/utilservice.go index 0ce3ec41..de6f92b6 100644 --- a/app/mix/service/utilservice.go +++ b/app/mix/service/utilservice.go @@ -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 { -- 2.41.0 From d93e59e24f17a18ad4b983db0375dcf392e8b75b Mon Sep 17 00:00:00 2001 From: Leufolium Date: Fri, 8 Mar 2024 23:03:20 +0800 Subject: [PATCH 2/2] 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 } -- 2.41.0