From 7e38335f0c00b3b17fb2f1861caf46762ac46779 Mon Sep 17 00:00:00 2001 From: wenxu12345 <44203734@qq.com> Date: Tue, 24 May 2022 21:34:02 +0800 Subject: [PATCH] msg cache --- internal/msg_transfer/logic/db.go | 4 ++-- pkg/common/db/mongoModel.go | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/msg_transfer/logic/db.go b/internal/msg_transfer/logic/db.go index 71e3b6aec..a4f8e998e 100644 --- a/internal/msg_transfer/logic/db.go +++ b/internal/msg_transfer/logic/db.go @@ -22,8 +22,8 @@ func saveUserChat(uid string, msg *pbMsg.MsgDataToMQ) error { // return db.DB.SaveUserChatMongo2(uid, pbSaveData.MsgData.SendTime, &pbSaveData) } -func saveUserChatList(userID string, msgList []*pbMsg.MsgDataToMQ, operationID string) error { +func saveUserChatList(userID string, msgList []*pbMsg.MsgDataToMQ, operationID string) (error, uint64) { log.Info(operationID, utils.GetSelfFuncName(), "args ", userID, len(msgList)) //return db.DB.BatchInsertChat(userID, msgList, operationID) - return db.DB.BatchInsertChatBoth(userID, msgList, operationID) + return db.DB.BatchInsertChat2Cache(userID, msgList, operationID) } diff --git a/pkg/common/db/mongoModel.go b/pkg/common/db/mongoModel.go index 02131a7df..a5dc39de4 100644 --- a/pkg/common/db/mongoModel.go +++ b/pkg/common/db/mongoModel.go @@ -799,6 +799,10 @@ func getSeqUid(uid string, seq uint32) string { return indexGen(uid, seqSuffix) } +func GetSeqUid(uid string, seq uint32) string { + return getSeqUid(uid, seq) +} + func getMsgIndex(seq uint32) int { seqSuffix := seq / singleGocMsgNum var index uint32