mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-08-06 19:20:12 +08:00
alter callback fg
This commit is contained in:
parent
3698f1dab8
commit
2ed3fd3cba
@ -80,9 +80,24 @@ func callbackAfterSendGroupMsg(msg *pbChat.SendMsgReq) error {
|
||||
return nil
|
||||
}
|
||||
log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), msg)
|
||||
req := cbApi.CallbackAfterSendGroupMsgReq{CommonCallbackReq: cbApi.CommonCallbackReq{CallbackCommand:constant.CallbackAfterSendGroupMsgCommand}}
|
||||
req := cbApi.CallbackAfterSendGroupMsgReq{
|
||||
CommonCallbackReq: cbApi.CommonCallbackReq{
|
||||
CallbackCommand:constant.CallbackAfterSendGroupMsgCommand,
|
||||
ServerMsgID: msg.MsgData.ServerMsgID,
|
||||
ClientMsgID: msg.MsgData.ClientMsgID,
|
||||
OperationID: msg.OperationID,
|
||||
|
||||
},
|
||||
GroupMsg: cbApi.GroupMsg{
|
||||
Msg: cbApi.Msg{
|
||||
SendID: msg.MsgData.
|
||||
},
|
||||
GroupID: msg.MsgData.GroupID,
|
||||
}
|
||||
}
|
||||
resp := &cbApi.CallbackAfterSendGroupMsgResp{CommonCallbackResp: cbApi.CommonCallbackResp{}}
|
||||
utils.CopyStructFields(req, msg.MsgData)
|
||||
|
||||
//utils.CopyStructFields(req, msg.MsgData)
|
||||
req.Content = string(msg.MsgData.Content)
|
||||
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 {
|
||||
@ -97,10 +112,21 @@ func callBackWordFilter(msg *pbChat.SendMsgReq) (canSend bool, err error) {
|
||||
return true, nil
|
||||
}
|
||||
log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), msg)
|
||||
req := cbApi.CallbackWordFilterReq{CommonCallbackReq: cbApi.CommonCallbackReq{CallbackCommand:constant.CallbackWordFilterCommand}}
|
||||
//req := cbApi.CallbackWordFilterReq{
|
||||
// CommonCallbackReq: cbApi.CommonCallbackReq{
|
||||
// CallbackCommand: constant.CallbackWordFilterCommand,
|
||||
// ServerMsgID: msg.MsgData.ServerMsgID,
|
||||
// ClientMsgID: msg.MsgData.ClientMsgID,
|
||||
// OperationID: msg.OperationID,
|
||||
// },
|
||||
// Content: string(msg.MsgData.Content),
|
||||
//}
|
||||
req := cbApi.CallbackWordFilterReq{
|
||||
CommonCallbackReq: cbApi.CommonCallbackReq{},
|
||||
}
|
||||
utils.CopyStructFields(req.CommonCallbackReq, msg.MsgData)
|
||||
resp := &cbApi.CallbackWordFilterResp{CommonCallbackResp: cbApi.CommonCallbackResp{}}
|
||||
utils.CopyStructFields(&req, msg.MsgData)
|
||||
req.Content = string(msg.MsgData.Content)
|
||||
//utils.CopyStructFields(&req., msg.MsgData)
|
||||
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 {
|
||||
if !config.Config.Callback.CallbackWordFilter.CallbackFailedContinue {
|
||||
|
@ -3,8 +3,14 @@ package call_back_struct
|
||||
type CommonCallbackReq struct {
|
||||
CallbackCommand string `json:"callbackCommand"`
|
||||
ServerMsgID string `json:"serverID"`
|
||||
ClientID string `json:"clientID"`
|
||||
ClientMsgID string `json:"clientID"`
|
||||
OperationID string `json:"operationID"`
|
||||
SenderPlatformID int32 `json:"senderPlatformID"`
|
||||
SenderNickname string `json:"senderNickname"`
|
||||
SessionType int32 `json:"sessionType"`
|
||||
MsgFrom int32 `json:"MsgFrom"`
|
||||
ContentType int32 `json:"contentType"`
|
||||
Status int32 `json:"status"`
|
||||
}
|
||||
|
||||
type CommonCallbackResp struct {
|
||||
|
@ -1,54 +1,52 @@
|
||||
package call_back_struct
|
||||
|
||||
type msg struct {
|
||||
type Msg struct {
|
||||
SendID string `json:"sendID"`
|
||||
ClientMsgID string `json:"clientMsgID"`
|
||||
ServerMsgID string `json:"serverMsgId"`
|
||||
CreateTime int64 `json:"createTime"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
type singleMsg struct {
|
||||
msg
|
||||
type SingleMsg struct {
|
||||
Msg
|
||||
RecvID string `json:"recvID"`
|
||||
}
|
||||
|
||||
type CallbackBeforeSendSingleMsgReq struct {
|
||||
CommonCallbackReq
|
||||
singleMsg
|
||||
SingleMsg
|
||||
}
|
||||
|
||||
type CallbackBeforeSendSingleMsgResp struct {
|
||||
CommonCallbackResp
|
||||
singleMsg
|
||||
SingleMsg
|
||||
}
|
||||
|
||||
type CallbackAfterSendSingleMsgReq struct {
|
||||
CommonCallbackReq
|
||||
singleMsg
|
||||
SingleMsg
|
||||
}
|
||||
|
||||
type CallbackAfterSendSingleMsgResp struct {
|
||||
CommonCallbackResp
|
||||
}
|
||||
|
||||
type groupMsg struct {
|
||||
msg
|
||||
type GroupMsg struct {
|
||||
Msg
|
||||
GroupID string `json:"groupID"`
|
||||
}
|
||||
|
||||
type CallbackBeforeSendGroupMsgReq struct {
|
||||
CommonCallbackReq
|
||||
groupMsg
|
||||
GroupMsg
|
||||
}
|
||||
|
||||
type CallbackBeforeSendGroupMsgResp struct {
|
||||
CommonCallbackResp
|
||||
groupMsg
|
||||
GroupMsg
|
||||
}
|
||||
|
||||
type CallbackAfterSendGroupMsgReq struct {
|
||||
groupMsg
|
||||
GroupMsg
|
||||
CommonCallbackReq
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user