mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-26 19:46:57 +08:00
test GetMsgBySeqIndexIn1Doc
This commit is contained in:
parent
b1459cd7c7
commit
af4a6bddb2
@ -6,6 +6,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
|
||||
"strings"
|
||||
|
||||
table "github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/unrelation"
|
||||
@ -181,6 +182,7 @@ func (m *MsgMongoDriver) DeleteDocs(ctx context.Context, docIDs []string) error
|
||||
}
|
||||
|
||||
func (m *MsgMongoDriver) GetMsgBySeqIndexIn1Doc(ctx context.Context, userID string, docID string, seqs []int64) (msgs []*table.MsgInfoModel, err error) {
|
||||
log.ZDebug(ctx, "GetMsgBySeqIndexIn1Doc in", "docID", docID, "userID", userID, "seqs", seqs)
|
||||
indexs := make([]int64, 0, len(seqs))
|
||||
for _, seq := range seqs {
|
||||
indexs = append(indexs, m.model.GetMsgIndex(seq))
|
||||
@ -236,10 +238,14 @@ func (m *MsgMongoDriver) GetMsgBySeqIndexIn1Doc(ctx context.Context, userID stri
|
||||
if err := cur.All(ctx, &msgDocModel); err != nil {
|
||||
return nil, errs.Wrap(err)
|
||||
}
|
||||
log.ZDebug(ctx, "GetMsgBySeqIndexIn1Doc mongo res", "docID", docID, "userID", userID, "seqs", seqs, "msgDocModel", len(msgDocModel))
|
||||
if len(msgDocModel) == 0 {
|
||||
return nil, errs.Wrap(mongo.ErrNoDocuments)
|
||||
}
|
||||
for i, model := range msgDocModel[0].Msg {
|
||||
if i < 10 {
|
||||
log.ZDebug(ctx, "GetMsgBySeqIndexIn1Doc for", "index", i, "msg", model.Msg, "del", model.DelList, "revoke", model.Revoke)
|
||||
}
|
||||
if model.Msg != nil && model.Revoke != nil {
|
||||
var conversationID string
|
||||
if index := strings.LastIndex(docID, ":"); index > 0 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user