From 0f7825454c782675158be3bf0087b0f769ffaf14 Mon Sep 17 00:00:00 2001 From: ltf Date: Sat, 26 Feb 2022 17:14:35 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E6=94=B9mock=E6=8B=A6=E6=88=AA?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E5=99=A8=E7=9A=84=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/rpc/open_im_msg/filters/mock.go | 6 +++--- internal/rpc/msg/context.go | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/rpc/open_im_msg/filters/mock.go b/cmd/rpc/open_im_msg/filters/mock.go index 17eccd5c4..71ab4030f 100644 --- a/cmd/rpc/open_im_msg/filters/mock.go +++ b/cmd/rpc/open_im_msg/filters/mock.go @@ -11,7 +11,7 @@ import ( func MockBeforeSendFilter1(ctx *rpcChat.SendContext, pb *pbChat.SendMsgReq) (*pbChat.SendMsgResp, bool, error) { ctxKey := "test_key" v := true - fmt.Printf("MockBeforeSendFilter1:%s set value to ctx,value is :%v\n", ctxKey, v) + // fmt.Printf("MockBeforeSendFilter1:%s set value to ctx,value is :%v\n", ctxKey, v) ctx.WithValue(ctxKey, v) return nil, true, nil @@ -25,10 +25,10 @@ func MockBeforeSendFilter2(ctx *rpcChat.SendContext, pb *pbChat.SendMsgReq) (*pb fmt.Printf("MockBeforeSendFilter2:%s selected from ctx,value is :%v\n", ctxKey, v) } - fmt.Printf("MockBeforeSendHandler trigger,contentType:%d\n", pb.MsgData.GetContentType()) + // fmt.Printf("MockBeforeSendHandler trigger,contentType:%d\n", pb.MsgData.GetContentType()) if pb.MsgData.ContentType == constant.Text { msg := string(pb.MsgData.Content) - fmt.Printf("text msg:%s", msg) + // fmt.Printf("text msg:%s\n", msg) if msg == "this is a m..m..mock msg" { fmt.Println(".==>msg had banned") return nil, false, errors.New("BANG! This msg has been banned by MockBeforeSendHandler") diff --git a/internal/rpc/msg/context.go b/internal/rpc/msg/context.go index 00f41c8f5..3116cf725 100644 --- a/internal/rpc/msg/context.go +++ b/internal/rpc/msg/context.go @@ -60,6 +60,8 @@ func (c *SendContext) SendMsg(pb *pbChat.SendMsgReq) (*pbChat.SendMsgResp, error return res, nil } + // fmt.Println("SEND_MSG:before send filters do over") + res, err = c.rpc.doSendMsg(c.ctx, pb) if err != nil { return res, err