|
|
@ -3,6 +3,7 @@ package msg
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"Open_IM/pkg/common/config"
|
|
|
|
"Open_IM/pkg/common/config"
|
|
|
|
"Open_IM/pkg/common/constant"
|
|
|
|
"Open_IM/pkg/common/constant"
|
|
|
|
|
|
|
|
"Open_IM/pkg/common/db"
|
|
|
|
"Open_IM/pkg/common/log"
|
|
|
|
"Open_IM/pkg/common/log"
|
|
|
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
|
|
|
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
|
|
|
pbChat "Open_IM/pkg/proto/chat"
|
|
|
|
pbChat "Open_IM/pkg/proto/chat"
|
|
|
@ -12,20 +13,22 @@ import (
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func TagSendMessage(operationID, sendID, recvID, content string, senderPlatformID int32) {
|
|
|
|
func TagSendMessage(operationID string, user *db.User, recvID, content string, senderPlatformID int32) {
|
|
|
|
log.NewInfo(operationID, utils.GetSelfFuncName(), "args: ", sendID, recvID, content)
|
|
|
|
log.NewInfo(operationID, utils.GetSelfFuncName(), "args: ", user.UserID, recvID, content)
|
|
|
|
var req pbChat.SendMsgReq
|
|
|
|
var req pbChat.SendMsgReq
|
|
|
|
var msgData pbCommon.MsgData
|
|
|
|
var msgData pbCommon.MsgData
|
|
|
|
msgData.SendID = sendID
|
|
|
|
msgData.SendID = user.UserID
|
|
|
|
msgData.RecvID = recvID
|
|
|
|
msgData.RecvID = recvID
|
|
|
|
msgData.ContentType = constant.Custom
|
|
|
|
msgData.ContentType = constant.Custom
|
|
|
|
msgData.SessionType = constant.SingleChatType
|
|
|
|
msgData.SessionType = constant.SingleChatType
|
|
|
|
msgData.MsgFrom = constant.UserMsgType
|
|
|
|
msgData.MsgFrom = constant.UserMsgType
|
|
|
|
msgData.Content = []byte(content)
|
|
|
|
msgData.Content = []byte(content)
|
|
|
|
|
|
|
|
msgData.SenderFaceURL = user.FaceURL
|
|
|
|
|
|
|
|
msgData.SenderNickname = user.Nickname
|
|
|
|
msgData.Options = map[string]bool{}
|
|
|
|
msgData.Options = map[string]bool{}
|
|
|
|
msgData.Options[constant.IsSenderConversationUpdate] = false
|
|
|
|
msgData.Options[constant.IsSenderConversationUpdate] = false
|
|
|
|
msgData.CreateTime = utils.GetCurrentTimestampByMill()
|
|
|
|
msgData.CreateTime = utils.GetCurrentTimestampByMill()
|
|
|
|
msgData.ClientMsgID = utils.GetMsgID(sendID)
|
|
|
|
msgData.ClientMsgID = utils.GetMsgID(user.UserID)
|
|
|
|
msgData.SenderPlatformID = senderPlatformID
|
|
|
|
msgData.SenderPlatformID = senderPlatformID
|
|
|
|
req.MsgData = &msgData
|
|
|
|
req.MsgData = &msgData
|
|
|
|
req.OperationID = operationID
|
|
|
|
req.OperationID = operationID
|
|
|
|