|
|
@ -2,9 +2,6 @@ package msgtransfer
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"context"
|
|
|
|
"encoding/json"
|
|
|
|
|
|
|
|
"errors"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws"
|
|
|
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
|
|
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
|
|
@ -66,36 +63,36 @@ func (mc *OnlineHistoryMongoConsumerHandler) handleChatWs2Mongo(ctx context.Cont
|
|
|
|
log.ZError(ctx, "DelMsgBySeqs", err, "userIDs", deleteMessageTips.UserID, "seqs", deleteMessageTips.Seqs, "totalUnExistSeqs", totalUnExistSeqs)
|
|
|
|
log.ZError(ctx, "DelMsgBySeqs", err, "userIDs", deleteMessageTips.UserID, "seqs", deleteMessageTips.Seqs, "totalUnExistSeqs", totalUnExistSeqs)
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case constant.MsgRevokeNotification:
|
|
|
|
//case constant.MsgRevokeNotification:
|
|
|
|
var elem sdkws.NotificationElem
|
|
|
|
// var elem sdkws.NotificationElem
|
|
|
|
if err := json.Unmarshal(v.Content, &elem); err != nil {
|
|
|
|
// if err := json.Unmarshal(v.Content, &elem); err != nil {
|
|
|
|
log.ZError(ctx, "json.Unmarshal NotificationElem", err, "content", string(v.Content))
|
|
|
|
// log.ZError(ctx, "json.Unmarshal NotificationElem", err, "content", string(v.Content))
|
|
|
|
continue
|
|
|
|
// continue
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
var tips sdkws.RevokeMsgTips
|
|
|
|
// var tips sdkws.RevokeMsgTips
|
|
|
|
if err := json.Unmarshal([]byte(elem.Detail), &tips); err != nil {
|
|
|
|
// if err := json.Unmarshal([]byte(elem.Detail), &tips); err != nil {
|
|
|
|
log.ZError(ctx, "json.Unmarshal RevokeMsgTips", err, "content", string(v.Content))
|
|
|
|
// log.ZError(ctx, "json.Unmarshal RevokeMsgTips", err, "content", string(v.Content))
|
|
|
|
continue
|
|
|
|
// continue
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
msgs, err := mc.msgDatabase.GetMsgBySeqs(ctx, tips.ConversationID, []int64{tips.Seq})
|
|
|
|
// msgs, err := mc.msgDatabase.GetMsgBySeqs(ctx, tips.ConversationID, []int64{tips.Seq})
|
|
|
|
if err != nil {
|
|
|
|
// if err != nil {
|
|
|
|
log.ZError(ctx, "GetMsgBySeqs", err, "conversationID", tips.ConversationID, "seq", tips.Seq)
|
|
|
|
// log.ZError(ctx, "GetMsgBySeqs", err, "conversationID", tips.ConversationID, "seq", tips.Seq)
|
|
|
|
continue
|
|
|
|
// continue
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
if len(msgs) == 0 {
|
|
|
|
// if len(msgs) == 0 {
|
|
|
|
log.ZError(ctx, "GetMsgBySeqs empty", errors.New("seq not found"), "conversationID", tips.ConversationID, "seq", tips.Seq)
|
|
|
|
// log.ZError(ctx, "GetMsgBySeqs empty", errors.New("seq not found"), "conversationID", tips.ConversationID, "seq", tips.Seq)
|
|
|
|
continue
|
|
|
|
// continue
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
msgs[0].Content = []byte(elem.Detail)
|
|
|
|
// msgs[0].Content = []byte(elem.Detail)
|
|
|
|
data, err := proto.Marshal(msgs[0])
|
|
|
|
// data, err := proto.Marshal(msgs[0])
|
|
|
|
if err != nil {
|
|
|
|
// if err != nil {
|
|
|
|
log.ZError(ctx, "proto.Marshal MsgData", err)
|
|
|
|
// log.ZError(ctx, "proto.Marshal MsgData", err)
|
|
|
|
continue
|
|
|
|
// continue
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
if err := mc.msgDatabase.RevokeMsg(ctx, tips.ConversationID, tips.Seq, data); err != nil {
|
|
|
|
// if err := mc.msgDatabase.RevokeMsg(ctx, tips.ConversationID, tips.Seq, data); err != nil {
|
|
|
|
log.ZError(ctx, "RevokeMsg", err, "conversationID", tips.ConversationID, "seq", tips.Seq)
|
|
|
|
// log.ZError(ctx, "RevokeMsg", err, "conversationID", tips.ConversationID, "seq", tips.Seq)
|
|
|
|
continue
|
|
|
|
// continue
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|