By Robin at 20240325; fix bug

This commit is contained in:
Leufolium 2024-03-25 12:11:29 +08:00
parent dacc31cb31
commit 294bea59e4
3 changed files with 10 additions and 16 deletions

View File

@ -1296,7 +1296,7 @@ func (m *Mongo) GetMomentListByIds(ctx *gin.Context, req *momentproto.OpListById
},
"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 {
err = nil
return list, err

View File

@ -1161,17 +1161,6 @@ func (s *Service) utilGetApiMomentVOListByIds(ctx *gin.Context, visitorMid int64
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)
if err != nil {
@ -1185,8 +1174,8 @@ func (s *Service) utilGetApiMomentVOListByIds(ctx *gin.Context, visitorMid int64
logger.Error("utilFillMomentsStreamerInfo fail, , err: %v", err)
return
}
volist = make([]*momentproto.ApiMomentVO, len(vos))
for i, vo := range vos {
volist = make([]*momentproto.ApiMomentVO, 0)
for _, vo := range vos {
apiVO, _ := vo.(*momentproto.ApiMomentVO)
// 填充是否关注
s.utilFillIsFollowedFillable(ctx, followMap, apiVO)
@ -1195,7 +1184,7 @@ func (s *Service) utilGetApiMomentVOListByIds(ctx *gin.Context, visitorMid int64
logger.Error("utilFillIsThumbedUpFillable fail")
return
}
volist[_momentIndexMap[i]] = apiVO
volist = append(volist, apiVO)
}
return

View File

@ -39,7 +39,12 @@ func (interceptor *CryptoTagInterceptor) Intercept(p any, tags ...string) (err e
//开始遍历标签
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.eleType == StructPtr { // *struct
if err = interceptor.parse(cryptoElement.eleValue.Interface(), tags...); err != nil {