diff --git a/internal/rpc/msg/tag_send_msg.go b/internal/rpc/msg/tag_send_msg.go index 7f0550d62..195640498 100644 --- a/internal/rpc/msg/tag_send_msg.go +++ b/internal/rpc/msg/tag_send_msg.go @@ -3,6 +3,7 @@ package msg import ( "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/db" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" pbChat "Open_IM/pkg/proto/chat" @@ -12,20 +13,22 @@ import ( "strings" ) -func TagSendMessage(operationID, sendID, recvID, content string, senderPlatformID int32) { - log.NewInfo(operationID, utils.GetSelfFuncName(), "args: ", sendID, recvID, content) +func TagSendMessage(operationID string, user *db.User, recvID, content string, senderPlatformID int32) { + log.NewInfo(operationID, utils.GetSelfFuncName(), "args: ", user.UserID, recvID, content) var req pbChat.SendMsgReq var msgData pbCommon.MsgData - msgData.SendID = sendID + msgData.SendID = user.UserID msgData.RecvID = recvID msgData.ContentType = constant.Custom msgData.SessionType = constant.SingleChatType msgData.MsgFrom = constant.UserMsgType msgData.Content = []byte(content) + msgData.SenderFaceURL = user.FaceURL + msgData.SenderNickname = user.Nickname msgData.Options = map[string]bool{} msgData.Options[constant.IsSenderConversationUpdate] = false msgData.CreateTime = utils.GetCurrentTimestampByMill() - msgData.ClientMsgID = utils.GetMsgID(sendID) + msgData.ClientMsgID = utils.GetMsgID(user.UserID) msgData.SenderPlatformID = senderPlatformID req.MsgData = &msgData req.OperationID = operationID diff --git a/internal/rpc/office/office.go b/internal/rpc/office/office.go index b390b99bc..43e757497 100644 --- a/internal/rpc/office/office.go +++ b/internal/rpc/office/office.go @@ -6,6 +6,7 @@ import ( "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db" "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" pbOffice "Open_IM/pkg/proto/office" @@ -179,8 +180,12 @@ func (s *officeServer) SendMsg2Tag(_ context.Context, req *pbOffice.SendMsg2TagR } } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "total userIDList result: ", userIDList) + us, err := imdb.GetUserByUserID(req.SendID) + if err != nil { + log.NewError(req.OperationID, "GetUserByUserID failed ", err.Error(), req.SendID) + } for _, userID := range userIDList { - msg.TagSendMessage(req.OperationID, req.SendID, userID, req.Content, req.SenderPlatformID) + msg.TagSendMessage(req.OperationID, us, userID, req.Content, req.SenderPlatformID) } var tagSendLogs db.TagSendLog for _, userID := range userIDList {