Merge branch 'BUG-20240322-0001-Robin' into mainconflict

This commit is contained in:
Leufolium 2024-03-25 12:13:49 +08:00
commit 1ab2b556a1
3 changed files with 10 additions and 16 deletions

View File

@ -1394,7 +1394,7 @@ func (m *Mongo) GetMomentListByIds(ctx *gin.Context, req *momentproto.OpListById
}, },
"del_flag": 0, "del_flag": 0,
} }
err := col.Find(ctx, query).Sort("ct").All(&list) err := col.Find(ctx, query).Sort("_id").All(&list)
if err == qmgo.ErrNoSuchDocuments { if err == qmgo.ErrNoSuchDocuments {
err = nil err = nil
return list, err return list, err

View File

@ -1262,17 +1262,6 @@ func (s *Service) utilGetApiMomentVOListByIds(ctx *gin.Context, visitorMid int64
return return
} }
// list -> idList 索引的map保证不打乱顺序
_momentIndexMap := make(map[int]int)
for i, account := range list {
id1 := util.DerefInt64(account.Id)
for j, id2 := range ids {
if id1 == id2 {
_momentIndexMap[i] = j
}
}
}
// 获取访问者的关注列表 // 获取访问者的关注列表
followMap, err := s.utilGetFollowMap(ctx, visitorMid) followMap, err := s.utilGetFollowMap(ctx, visitorMid)
if err != nil { if err != nil {
@ -1286,8 +1275,8 @@ func (s *Service) utilGetApiMomentVOListByIds(ctx *gin.Context, visitorMid int64
logger.Error("utilFillMomentsStreamerInfo fail, , err: %v", err) logger.Error("utilFillMomentsStreamerInfo fail, , err: %v", err)
return return
} }
volist = make([]*momentproto.ApiMomentVO, len(vos)) volist = make([]*momentproto.ApiMomentVO, 0)
for i, vo := range vos { for _, vo := range vos {
apiVO, _ := vo.(*momentproto.ApiMomentVO) apiVO, _ := vo.(*momentproto.ApiMomentVO)
// 填充是否关注 // 填充是否关注
s.utilFillIsFollowedFillable(ctx, followMap, apiVO) s.utilFillIsFollowedFillable(ctx, followMap, apiVO)
@ -1296,7 +1285,7 @@ func (s *Service) utilGetApiMomentVOListByIds(ctx *gin.Context, visitorMid int64
logger.Error("utilFillIsThumbedUpFillable fail") logger.Error("utilFillIsThumbedUpFillable fail")
return return
} }
volist[_momentIndexMap[i]] = apiVO volist = append(volist, apiVO)
} }
return return

View File

@ -39,7 +39,12 @@ func (interceptor *CryptoTagInterceptor) Intercept(p any, tags ...string) (err e
//开始遍历标签 //开始遍历标签
for interceptor.cryptoEleQueue.Len() != 0 { for interceptor.cryptoEleQueue.Len() != 0 {
cryptoElement, _ := interceptor.cryptoEleQueue.Remove(interceptor.cryptoEleQueue.Front()).(*CryptoElement) ele := interceptor.cryptoEleQueue.Remove(interceptor.cryptoEleQueue.Front())
cryptoElement, ok := ele.(*CryptoElement)
if !ok {
logger.Error("crypto element assertion failed, element is: %v, type is: %v", ele, reflect.TypeOf(ele).String())
continue
}
if cryptoElement == nil { if cryptoElement == nil {
continue continue
} }