Merge remote-tracking branch 'origin/tuoyun' into tuoyun

pull/168/head
Gordon 3 years ago
commit 341ec6e9a0

@ -197,18 +197,18 @@ callback:
callbackUrl : "http://127.0.0.1:8080/callback" callbackUrl : "http://127.0.0.1:8080/callback"
# 开启关闭操作前后回调的配置 # 开启关闭操作前后回调的配置
callbackbeforeSendSingleMsg: callbackbeforeSendSingleMsg:
enable: true # 回调是否启用 enable: false # 回调是否启用
callbackTimeOut: 2 # 回调超时时间 callbackTimeOut: 2 # 回调超时时间
CallbackFailedContinue: true # 回调超时是否继续执行代码 CallbackFailedContinue: true # 回调超时是否继续执行代码
callbackAfterSendSingleMsg: callbackAfterSendSingleMsg:
enable: true enable: false
callbackTimeOut: 2 callbackTimeOut: 2
callbackBeforeSendGroupMsg: callbackBeforeSendGroupMsg:
enable: true enable: false
callbackTimeOut: 2 callbackTimeOut: 2
CallbackFailedContinue: true CallbackFailedContinue: true
callbackAfterSendGroupMsg: callbackAfterSendGroupMsg:
enable: true enable: false
callbackTimeOut: 2 callbackTimeOut: 2
callbackWordFilter: callbackWordFilter:
enable: true enable: true

@ -28,7 +28,6 @@ func copyCallbackCommonReqStruct(msg *pbChat.SendMsgReq) cbApi.CommonCallbackReq
} }
func callbackBeforeSendSingleMsg(msg *pbChat.SendMsgReq) (canSend bool, err error) { func callbackBeforeSendSingleMsg(msg *pbChat.SendMsgReq) (canSend bool, err error) {
log.NewDebug(msg.OperationID, config.Config.Callback.CallbackBeforeSendSingleMsg.Enable)
if !config.Config.Callback.CallbackBeforeSendSingleMsg.Enable { if !config.Config.Callback.CallbackBeforeSendSingleMsg.Enable {
return true, nil return true, nil
} }
@ -58,7 +57,6 @@ func callbackBeforeSendSingleMsg(msg *pbChat.SendMsgReq) (canSend bool, err erro
func callbackAfterSendSingleMsg(msg *pbChat.SendMsgReq) error { func callbackAfterSendSingleMsg(msg *pbChat.SendMsgReq) error {
log.NewDebug(msg.OperationID, config.Config.Callback.CallbackAfterSendSingleMsg.Enable)
if !config.Config.Callback.CallbackAfterSendSingleMsg.Enable { if !config.Config.Callback.CallbackAfterSendSingleMsg.Enable {
return nil return nil
} }
@ -80,7 +78,6 @@ func callbackAfterSendSingleMsg(msg *pbChat.SendMsgReq) error {
func callbackBeforeSendGroupMsg(msg *pbChat.SendMsgReq) (canSend bool, err error) { func callbackBeforeSendGroupMsg(msg *pbChat.SendMsgReq) (canSend bool, err error) {
log.NewDebug(msg.OperationID, config.Config.Callback.CallbackBeforeSendGroupMsg.Enable)
if !config.Config.Callback.CallbackBeforeSendGroupMsg.Enable { if !config.Config.Callback.CallbackBeforeSendGroupMsg.Enable {
return true, nil return true, nil
} }
@ -103,11 +100,11 @@ func callbackBeforeSendGroupMsg(msg *pbChat.SendMsgReq) (canSend bool, err error
return false, nil return false, nil
} }
} }
log.NewInfo()
return true, err return true, err
} }
func callbackAfterSendGroupMsg(msg *pbChat.SendMsgReq) error { func callbackAfterSendGroupMsg(msg *pbChat.SendMsgReq) error {
log.NewDebug(msg.OperationID, config.Config.Callback.CallbackAfterSendGroupMsg.Enable)
if !config.Config.Callback.CallbackAfterSendGroupMsg.Enable { if !config.Config.Callback.CallbackAfterSendGroupMsg.Enable {
return nil return nil
} }
@ -130,7 +127,6 @@ func callbackAfterSendGroupMsg(msg *pbChat.SendMsgReq) error {
func callbackWordFilter(msg *pbChat.SendMsgReq) (canSend bool, err error) { func callbackWordFilter(msg *pbChat.SendMsgReq) (canSend bool, err error) {
log.NewDebug(msg.OperationID, config.Config.Callback.CallbackWordFilter.Enable)
if !config.Config.Callback.CallbackWordFilter.Enable || msg.MsgData.ContentType != constant.Text { if !config.Config.Callback.CallbackWordFilter.Enable || msg.MsgData.ContentType != constant.Text {
return true, nil return true, nil
} }
@ -157,6 +153,7 @@ func callbackWordFilter(msg *pbChat.SendMsgReq) (canSend bool, err error) {
} }
log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), string(msg.MsgData.Content)) log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), string(msg.MsgData.Content))
} }
log.NewDebug(msg.OperationID, utils.GetSelfFuncName(), err.Error())
return true, err return true, err
} }

@ -243,7 +243,7 @@ func (rpc *rpcChat) SendMsg(_ context.Context, pb *pbChat.SendMsgReq) (*pbChat.S
} }
// callback // callback
if err := callbackAfterSendGroupMsg(pb); err != nil { if err := callbackAfterSendGroupMsg(pb); err != nil {
log.NewError(pb.OperationID, utils.GetSelfFuncName(), "CallBackAfterSendMsg failed", err.Error()) log.NewError(pb.OperationID, utils.GetSelfFuncName(), "callbackAfterSendGroupMsg failed", err.Error())
} }
return returnMsg(&replay, pb, 0, "", msgToMQ.MsgData.ServerMsgID, msgToMQ.MsgData.SendTime) return returnMsg(&replay, pb, 0, "", msgToMQ.MsgData.ServerMsgID, msgToMQ.MsgData.SendTime)
default: default:

Loading…
Cancel
Save