Merge pull request 'by Robin at 20240325; fix bug' (#200) from BUG-20240322-0001-Robin into main

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/200
This commit is contained in:
chenhao 2024-03-25 12:27:53 +08:00
commit bf2605738c
1 changed files with 13 additions and 1 deletions

View File

@ -1254,7 +1254,7 @@ func (s *Service) utilGetApiMomentVOListByIds(ctx *gin.Context, visitorMid int64
return make([]*momentproto.ApiMomentVO, 0), nil return make([]*momentproto.ApiMomentVO, 0), nil
} }
list, err := _DefaultMoment.OpListByIds(ctx, &momentproto.OpListByIdsReq{ rlist, err := _DefaultMoment.OpListByIds(ctx, &momentproto.OpListByIdsReq{
Ids: ids, Ids: ids,
}) })
if err != nil { if err != nil {
@ -1262,6 +1262,18 @@ func (s *Service) utilGetApiMomentVOListByIds(ctx *gin.Context, visitorMid int64
return return
} }
// 重新按照ids的顺序排列list
momentMap := make(map[int64]*dbstruct.Moment)
for _, moment := range rlist {
momentMap[util.DerefInt64(moment.Id)] = moment
}
list := make([]*dbstruct.Moment, 0)
for _, id := range ids {
if momentMap[id] != nil {
list = append(list, momentMap[id])
}
}
// 获取访问者的关注列表 // 获取访问者的关注列表
followMap, err := s.utilGetFollowMap(ctx, visitorMid) followMap, err := s.utilGetFollowMap(ctx, visitorMid)
if err != nil { if err != nil {