diff --git a/internal/push/logic/callback.go b/internal/push/logic/callback.go index a706ef006..4e3961066 100644 --- a/internal/push/logic/callback.go +++ b/internal/push/logic/callback.go @@ -5,7 +5,9 @@ import ( "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/http" + "Open_IM/pkg/common/log" commonPb "Open_IM/pkg/proto/sdk_ws" + "Open_IM/pkg/utils" http2 "net/http" ) @@ -24,10 +26,11 @@ func callbackOfflinePush(operationID, userID string, info *commonPb.OfflinePushI }, OfflinePushInfo: info, } - callbackOfflinePushResp := &cbApi.CallbackOfflinePushResp{CommonCallbackResp: callbackResp} + callbackOfflinePushResp := &cbApi.CallbackOfflinePushResp{CommonCallbackResp: &callbackResp} if err := http.PostReturn(config.Config.Callback.CallbackUrl, callbackOfflinePushReq, callbackOfflinePushResp, config.Config.Callback.CallbackOfflinePush.CallbackTimeOut); err != nil { callbackResp.ErrCode = http2.StatusInternalServerError callbackResp.ErrMsg = err.Error() } + log.NewDebug(operationID, utils.GetSelfFuncName(), callbackOfflinePushResp) return callbackResp } diff --git a/internal/push/logic/push_to_client.go b/internal/push/logic/push_to_client.go index 8911218f2..55aadbda3 100644 --- a/internal/push/logic/push_to_client.go +++ b/internal/push/logic/push_to_client.go @@ -111,6 +111,7 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) { log.NewError(pushMsg.OperationID, utils.GetSelfFuncName(), "callbackOfflinePush result: ", callbackResp) } if callbackResp.ActionCode != constant.ActionAllow { + log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "offline push was stop") break } diff --git a/internal/rpc/msg/callback.go b/internal/rpc/msg/callback.go index af8f7c334..142171aaa 100644 --- a/internal/rpc/msg/callback.go +++ b/internal/rpc/msg/callback.go @@ -41,7 +41,7 @@ func callbackBeforeSendSingleMsg(msg *pbChat.SendMsgReq) cbApi.CommonCallbackRes RecvID: msg.MsgData.RecvID, } resp := &cbApi.CallbackBeforeSendSingleMsgResp{ - CommonCallbackResp: callbackResp, + CommonCallbackResp: &callbackResp, } //utils.CopyStructFields(req, msg.MsgData) defer log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), req, *resp) @@ -71,7 +71,7 @@ func callbackAfterSendSingleMsg(msg *pbChat.SendMsgReq) cbApi.CommonCallbackResp CommonCallbackReq: commonCallbackReq, RecvID: msg.MsgData.RecvID, } - resp := &cbApi.CallbackAfterSendSingleMsgResp{CommonCallbackResp: callbackResp} + resp := &cbApi.CallbackAfterSendSingleMsgResp{CommonCallbackResp: &callbackResp} defer log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), req, *resp) if err := http.PostReturn(config.Config.Callback.CallbackUrl, req, resp, config.Config.Callback.CallbackAfterSendSingleMsg.CallbackTimeOut); err != nil { callbackResp.ErrCode = http2.StatusInternalServerError @@ -93,7 +93,7 @@ func callbackBeforeSendGroupMsg(msg *pbChat.SendMsgReq) cbApi.CommonCallbackResp CommonCallbackReq: commonCallbackReq, GroupID: msg.MsgData.GroupID, } - resp := &cbApi.CallbackBeforeSendGroupMsgResp{CommonCallbackResp: callbackResp} + resp := &cbApi.CallbackBeforeSendGroupMsgResp{CommonCallbackResp: &callbackResp} defer log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), req, *resp) if err := http.PostReturn(config.Config.Callback.CallbackUrl, req, resp, config.Config.Callback.CallbackBeforeSendGroupMsg.CallbackTimeOut); err != nil { callbackResp.ErrCode = http2.StatusInternalServerError @@ -121,7 +121,7 @@ func callbackAfterSendGroupMsg(msg *pbChat.SendMsgReq) cbApi.CommonCallbackResp CommonCallbackReq: commonCallbackReq, GroupID: msg.MsgData.GroupID, } - resp := &cbApi.CallbackAfterSendGroupMsgResp{CommonCallbackResp: callbackResp} + resp := &cbApi.CallbackAfterSendGroupMsgResp{CommonCallbackResp: &callbackResp} defer log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), req, *resp) if err := http.PostReturn(config.Config.Callback.CallbackUrl, req, resp, config.Config.Callback.CallbackAfterSendGroupMsg.CallbackTimeOut); err != nil { callbackResp.ErrCode = http2.StatusInternalServerError @@ -142,7 +142,7 @@ func callbackWordFilter(msg *pbChat.SendMsgReq) cbApi.CommonCallbackResp { req := cbApi.CallbackWordFilterReq{ CommonCallbackReq: commonCallbackReq, } - resp := &cbApi.CallbackWordFilterResp{CommonCallbackResp: callbackResp} + resp := &cbApi.CallbackWordFilterResp{CommonCallbackResp: &callbackResp} defer log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), req, *resp) if err := http.PostReturn(config.Config.Callback.CallbackUrl, req, resp, config.Config.Callback.CallbackWordFilter.CallbackTimeOut); err != nil { callbackResp.ErrCode = http2.StatusInternalServerError diff --git a/pkg/call_back_struct/message.go b/pkg/call_back_struct/message.go index 31c215ea2..65f281bb8 100644 --- a/pkg/call_back_struct/message.go +++ b/pkg/call_back_struct/message.go @@ -1,22 +1,21 @@ package call_back_struct - type CallbackBeforeSendSingleMsgReq struct { CommonCallbackReq - RecvID string `json:"recvID"` + RecvID string `json:"recvID"` } type CallbackBeforeSendSingleMsgResp struct { - CommonCallbackResp + *CommonCallbackResp } type CallbackAfterSendSingleMsgReq struct { CommonCallbackReq - RecvID string `json:"recvID"` + RecvID string `json:"recvID"` } type CallbackAfterSendSingleMsgResp struct { - CommonCallbackResp + *CommonCallbackResp } type CallbackBeforeSendGroupMsgReq struct { @@ -25,7 +24,7 @@ type CallbackBeforeSendGroupMsgReq struct { } type CallbackBeforeSendGroupMsgResp struct { - CommonCallbackResp + *CommonCallbackResp } type CallbackAfterSendGroupMsgReq struct { @@ -34,7 +33,7 @@ type CallbackAfterSendGroupMsgReq struct { } type CallbackAfterSendGroupMsgResp struct { - CommonCallbackResp + *CommonCallbackResp } type CallbackWordFilterReq struct { @@ -42,6 +41,6 @@ type CallbackWordFilterReq struct { } type CallbackWordFilterResp struct { - CommonCallbackResp + *CommonCallbackResp Content string `json:"content"` } diff --git a/pkg/call_back_struct/push.go b/pkg/call_back_struct/push.go index a63b2930d..af7e38d79 100644 --- a/pkg/call_back_struct/push.go +++ b/pkg/call_back_struct/push.go @@ -8,5 +8,5 @@ type CallbackOfflinePushReq struct { } type CallbackOfflinePushResp struct { - CommonCallbackResp + *CommonCallbackResp }