by Robin at 20240325; fix bug

This commit is contained in:
Leufolium 2024-03-25 12:27:37 +08:00
parent 294bea59e4
commit 7df6e1862c
1 changed files with 13 additions and 1 deletions

View File

@ -1153,7 +1153,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 {
@ -1161,6 +1161,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 {