By Robin at 20240325; fix bug
This commit is contained in:
parent
dacc31cb31
commit
294bea59e4
|
@ -1296,7 +1296,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
|
||||||
|
|
|
@ -1161,17 +1161,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 {
|
||||||
|
@ -1185,8 +1174,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)
|
||||||
|
@ -1195,7 +1184,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
|
||||||
|
|
|
@ -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.eleType == StructPtr { // *struct
|
if cryptoElement.eleType == StructPtr { // *struct
|
||||||
if err = interceptor.parse(cryptoElement.eleValue.Interface(), tags...); err != nil {
|
if err = interceptor.parse(cryptoElement.eleValue.Interface(), tags...); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue