diff --git a/app/mix/dao/mongo.go b/app/mix/dao/mongo.go index 339223a3..facd640a 100644 --- a/app/mix/dao/mongo.go +++ b/app/mix/dao/mongo.go @@ -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 diff --git a/app/mix/service/utilservice.go b/app/mix/service/utilservice.go index 797eb8f8..ca5ddce5 100644 --- a/app/mix/service/utilservice.go +++ b/app/mix/service/utilservice.go @@ -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 diff --git a/library/taginterceptor/cryptoTagInterceptor.go b/library/taginterceptor/cryptoTagInterceptor.go index 82044265..e73679eb 100644 --- a/library/taginterceptor/cryptoTagInterceptor.go +++ b/library/taginterceptor/cryptoTagInterceptor.go @@ -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 {