From a2e62c9fb529b70e974f9a7d9a6676027e9e29fe Mon Sep 17 00:00:00 2001 From: skiffer-git <44203734@qq.com> Date: Sun, 1 May 2022 16:21:28 +0800 Subject: [PATCH] fix bug: group chat share pb --- internal/rpc/msg/send_msg.go | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/internal/rpc/msg/send_msg.go b/internal/rpc/msg/send_msg.go index 013ee16cc..c33c46caf 100644 --- a/internal/rpc/msg/send_msg.go +++ b/internal/rpc/msg/send_msg.go @@ -268,12 +268,16 @@ func (rpc *rpcChat) SendMsg(_ context.Context, pb *pbChat.SendMsgReq) (*pbChat.S for i := 0; i < len(memberUserIDList)/split; i++ { wg.Add(1) go func(list []string) { - msgToMQGroup := pbChat.MsgDataToMQ{Token: pb.Token, OperationID: pb.OperationID, MsgData: pb.MsgData} + groupPB := pbChat.SendMsgReq{MsgData: &sdk_ws.MsgData{OfflinePushInfo: &sdk_ws.OfflinePushInfo{}}} + groupPB = *pb + *groupPB.MsgData = *pb.MsgData + *groupPB.MsgData.OfflinePushInfo = *pb.MsgData.OfflinePushInfo + msgToMQGroup := pbChat.MsgDataToMQ{Token: groupPB.Token, OperationID: groupPB.OperationID, MsgData: groupPB.MsgData} for _, v := range list { - pb.MsgData.RecvID = v - isSend := modifyMessageByUserMessageReceiveOpt(v, groupID, constant.GroupChatType, pb) + groupPB.MsgData.RecvID = v + isSend := modifyMessageByUserMessageReceiveOpt(v, groupID, constant.GroupChatType, &groupPB) if isSend { - msgToMQGroup.MsgData = pb.MsgData + msgToMQGroup.MsgData = groupPB.MsgData err := rpc.sendMsgToKafka(&msgToMQGroup, v) if err != nil { log.NewError(msgToMQGroup.OperationID, "kafka send msg err:UserId", v, msgToMQGroup.String()) @@ -288,12 +292,16 @@ func (rpc *rpcChat) SendMsg(_ context.Context, pb *pbChat.SendMsgReq) (*pbChat.S if remain > 0 { wg.Add(1) go func(list []string) { + groupPB := pbChat.SendMsgReq{MsgData: &sdk_ws.MsgData{OfflinePushInfo: &sdk_ws.OfflinePushInfo{}}} + groupPB = *pb + *groupPB.MsgData = *pb.MsgData + *groupPB.MsgData.OfflinePushInfo = *pb.MsgData.OfflinePushInfo + msgToMQGroup := pbChat.MsgDataToMQ{Token: groupPB.Token, OperationID: groupPB.OperationID, MsgData: groupPB.MsgData} for _, v := range list { - msgToMQGroup := pbChat.MsgDataToMQ{Token: pb.Token, OperationID: pb.OperationID, MsgData: pb.MsgData} - pb.MsgData.RecvID = v - isSend := modifyMessageByUserMessageReceiveOpt(v, groupID, constant.GroupChatType, pb) + groupPB.MsgData.RecvID = v + isSend := modifyMessageByUserMessageReceiveOpt(v, groupID, constant.GroupChatType, &groupPB) if isSend { - msgToMQGroup.MsgData = pb.MsgData + msgToMQGroup.MsgData = groupPB.MsgData err := rpc.sendMsgToKafka(&msgToMQGroup, v) if err != nil { log.NewError(msgToMQGroup.OperationID, "kafka send msg err:UserId", v, msgToMQGroup.String())