From 2b25fea86cdd62afc49587758481b3833b8003b8 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Thu, 2 Jun 2022 19:52:29 +0800 Subject: [PATCH] singal offline push --- internal/push/logic/push_to_client.go | 5 +++-- pkg/common/db/redisModel.go | 13 +++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/internal/push/logic/push_to_client.go b/internal/push/logic/push_to_client.go index 1085208d8..b079c439e 100644 --- a/internal/push/logic/push_to_client.go +++ b/internal/push/logic/push_to_client.go @@ -125,6 +125,7 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) { if err != nil { log.NewError(pushMsg.OperationID, utils.GetSelfFuncName(), "GetOfflinePushOpts failed", pushMsg, err.Error()) } + log.NewInfo(pushMsg.OperationID, utils.GetSelfFuncName(), "opts:", opts) pushResult, err := offlinePusher.Push(UIDList, content, jsonCustomContent, pushMsg.OperationID, opts) if err != nil { log.NewError(pushMsg.OperationID, "offline push error", pushMsg.String(), err.Error()) @@ -141,11 +142,11 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) { func GetOfflinePushOpts(pushMsg *pbPush.PushMsgReq) (opts push.PushOpts, err error) { if pushMsg.MsgData.ContentType < constant.SignalingNotificationEnd && pushMsg.MsgData.ContentType > constant.SignalingNotification { - req := &pbRtc.SignalMessageAssembleReq{} + req := &pbRtc.SignalReq{} if err := proto.Unmarshal(pushMsg.MsgData.Content, req); err != nil { return opts, err } - switch req.SignalReq.Payload.(type) { + switch req.Payload.(type) { case *pbRtc.SignalReq_Invite, *pbRtc.SignalReq_InviteInGroup: opts.Signal.ClientMsgID = pushMsg.MsgData.ClientMsgID } diff --git a/pkg/common/db/redisModel.go b/pkg/common/db/redisModel.go index 2e7904e7b..b1c72e12a 100644 --- a/pkg/common/db/redisModel.go +++ b/pkg/common/db/redisModel.go @@ -356,14 +356,15 @@ func (d *DataBases) CacheSignalInfo(msg *pbCommon.MsgData) error { func (d *DataBases) GetSignalInfoFromCache(clientMsgID string) (invitationInfo *pbRtc.SignalInviteReq, err error) { key := SignalCache + clientMsgID result, err := redis.Bytes(d.Exec("GET", key)) - log2.NewDebug("", utils.GetSelfFuncName(), clientMsgID, result) + log2.NewDebug("", utils.GetSelfFuncName(), clientMsgID, result, string(result)) if err != nil { - invitationInfo := &pbRtc.SignalInviteReq{} - return invitationInfo, err + return nil, err } - req := &pbRtc.SignalMessageAssembleReq{} - err = proto.Unmarshal(result, req) - req2 := req.SignalReq.Payload.(*pbRtc.SignalReq_Invite) + req := &pbRtc.SignalReq{} + if err = proto.Unmarshal(result, req); err != nil { + return nil, err + } + req2 := req.Payload.(*pbRtc.SignalReq_Invite) invitationInfo = req2.Invite return invitationInfo, err }