Merge branch 'shichuang' of https://github.com/OpenIMSDK/Open-IM-Server into shichuang

This commit is contained in:
wangchuxiao
2022-09-07 18:23:06 +08:00
8 changed files with 64 additions and 18 deletions
+7
View File
@@ -13,6 +13,7 @@ import (
"Open_IM/pkg/common/log"
pbChat "Open_IM/pkg/proto/msg"
pbPush "Open_IM/pkg/proto/push"
"Open_IM/pkg/utils"
"github.com/Shopify/sarama"
"github.com/golang/protobuf/proto"
)
@@ -43,6 +44,11 @@ func (ms *PushConsumerHandler) handleMs2PsChat(msg []byte) {
MsgData: msgFromMQ.MsgData,
PushToUserID: msgFromMQ.PushToUserID,
}
sec := msgFromMQ.MsgData.SendTime / 1000
nowSec := utils.GetCurrentTimestampBySecond()
if nowSec-sec > 10 {
return
}
switch msgFromMQ.MsgData.SessionType {
case constant.SuperGroupChatType:
MsgToSuperGroupUser(pbData)
@@ -59,6 +65,7 @@ func (ms *PushConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession,
for msg := range claim.Messages() {
log.NewDebug("", "kafka get info to mysql", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value))
ms.msgHandle[msg.Topic](msg.Value)
sess.MarkMessage(msg, "")
}
return nil
}
+5 -1
View File
@@ -79,10 +79,14 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) {
}
}
if pushMsg.MsgData.ContentType == constant.SignalingNotification {
if err := db.DB.HandleSignalInfo(pushMsg.OperationID, pushMsg.MsgData); err != nil {
isSend, err := db.DB.HandleSignalInfo(pushMsg.OperationID, pushMsg.MsgData, pushMsg.PushToUserID)
if err != nil {
log.NewError(pushMsg.OperationID, utils.GetSelfFuncName(), err.Error(), pushMsg.MsgData)
return
}
if !isSend {
return
}
}
customContent := OpenIMContent{
SessionType: int(pushMsg.MsgData.SessionType),