mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
callback
This commit is contained in:
parent
098f8a52f7
commit
f5befcc95f
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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"`
|
||||
}
|
||||
|
@ -8,5 +8,5 @@ type CallbackOfflinePushReq struct {
|
||||
}
|
||||
|
||||
type CallbackOfflinePushResp struct {
|
||||
CommonCallbackResp
|
||||
*CommonCallbackResp
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user