alter callback fg

pull/168/head
wangchuxiao 3 years ago
parent fb4c02ca9b
commit 3698f1dab8

@ -20,9 +20,9 @@ func callbackBeforeSendSingleMsg(msg *pbChat.SendMsgReq) (canSend bool, err erro
}} }}
resp := &cbApi.CallbackBeforeSendSingleMsgResp{CommonCallbackResp:cbApi.CommonCallbackResp{ resp := &cbApi.CallbackBeforeSendSingleMsgResp{CommonCallbackResp:cbApi.CommonCallbackResp{
}} }}
defer log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), req, *resp)
utils.CopyStructFields(req, msg.MsgData) utils.CopyStructFields(req, msg.MsgData)
req.Content = string(msg.MsgData.Content) 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.CallbackbeforeSendSingleMsg.CallbackTimeOut); err != nil{ if err := http.PostReturn(config.Config.Callback.CallbackUrl, req, resp, config.Config.Callback.CallbackbeforeSendSingleMsg.CallbackTimeOut); err != nil{
if !config.Config.Callback.CallbackbeforeSendSingleMsg.CallbackFailedContinue { if !config.Config.Callback.CallbackbeforeSendSingleMsg.CallbackFailedContinue {
return false, err return false, err
@ -43,9 +43,9 @@ func callbackAfterSendSingleMsg(msg *pbChat.SendMsgReq) error {
log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), msg) log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), msg)
req := cbApi.CallbackAfterSendSingleMsgReq{CommonCallbackReq: cbApi.CommonCallbackReq{CallbackCommand:constant.CallbackAfterSendSingleMsgCommand}} req := cbApi.CallbackAfterSendSingleMsgReq{CommonCallbackReq: cbApi.CommonCallbackReq{CallbackCommand:constant.CallbackAfterSendSingleMsgCommand}}
resp := &cbApi.CallbackAfterSendSingleMsgResp{CommonCallbackResp: cbApi.CommonCallbackResp{}} resp := &cbApi.CallbackAfterSendSingleMsgResp{CommonCallbackResp: cbApi.CommonCallbackResp{}}
defer log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), req, *resp)
utils.CopyStructFields(req, msg.MsgData) utils.CopyStructFields(req, msg.MsgData)
req.Content = string(msg.MsgData.Content) 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.CallbackAfterSendSingleMsg.CallbackTimeOut); err != nil{ if err := http.PostReturn(config.Config.Callback.CallbackUrl, req, resp, config.Config.Callback.CallbackAfterSendSingleMsg.CallbackTimeOut); err != nil{
return err return err
} }
@ -60,9 +60,9 @@ func callbackBeforeSendGroupMsg(msg *pbChat.SendMsgReq) (canSend bool, err error
log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), msg) log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), msg)
req := cbApi.CallbackBeforeSendSingleMsgReq{CommonCallbackReq: cbApi.CommonCallbackReq{CallbackCommand:constant.CallbackBeforeSendGroupMsgCommand}} req := cbApi.CallbackBeforeSendSingleMsgReq{CommonCallbackReq: cbApi.CommonCallbackReq{CallbackCommand:constant.CallbackBeforeSendGroupMsgCommand}}
resp := &cbApi.CallbackBeforeSendGroupMsgResp{CommonCallbackResp: cbApi.CommonCallbackResp{}} resp := &cbApi.CallbackBeforeSendGroupMsgResp{CommonCallbackResp: cbApi.CommonCallbackResp{}}
defer log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), req, *resp)
utils.CopyStructFields(req, msg.MsgData) utils.CopyStructFields(req, msg.MsgData)
req.Content = string(msg.MsgData.Content) 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.CallbackBeforeSendGroupMsg.CallbackTimeOut); err != nil { if err := http.PostReturn(config.Config.Callback.CallbackUrl, req, resp, config.Config.Callback.CallbackBeforeSendGroupMsg.CallbackTimeOut); err != nil {
if !config.Config.Callback.CallbackBeforeSendGroupMsg.CallbackFailedContinue { if !config.Config.Callback.CallbackBeforeSendGroupMsg.CallbackFailedContinue {
return false, nil return false, nil
@ -82,9 +82,9 @@ func callbackAfterSendGroupMsg(msg *pbChat.SendMsgReq) error {
log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), msg) 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}}
resp := &cbApi.CallbackAfterSendGroupMsgResp{CommonCallbackResp: cbApi.CommonCallbackResp{}} resp := &cbApi.CallbackAfterSendGroupMsgResp{CommonCallbackResp: cbApi.CommonCallbackResp{}}
defer log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), req, *resp)
utils.CopyStructFields(req, msg.MsgData) utils.CopyStructFields(req, msg.MsgData)
req.Content = string(msg.MsgData.Content) 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 { if err := http.PostReturn(config.Config.Callback.CallbackUrl, req, resp, config.Config.Callback.CallbackAfterSendGroupMsg.CallbackTimeOut); err != nil {
return err return err
} }
@ -112,7 +112,7 @@ func callBackWordFilter(msg *pbChat.SendMsgReq) (canSend bool, err error) {
return false, nil return false, nil
} }
msg.MsgData.Content = []byte(resp.Content) msg.MsgData.Content = []byte(resp.Content)
log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), msg.MsgData.Content) log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), string(msg.MsgData.Content))
} }
return true, nil return true, nil
} }

Loading…
Cancel
Save