提交 50928669 编写于 作者: programor_guo's avatar programor_guo

message send module changes

上级 0ac4dbfa
......@@ -33,6 +33,7 @@ func UserToken(c *gin.Context) {
params := paramsUserToken{}
if err := c.BindJSON(&params); err != nil {
log.Error("", "", params.UID, params.Platform, params.Secret)
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
return
}
......
......@@ -31,7 +31,6 @@ func UserNewestSeq(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
return
}
pbData := pbMsg.GetNewSeqReq{}
pbData.UserID = params.SendID
pbData.OperationID = params.OperationID
......
......@@ -16,7 +16,6 @@ type paramsUserPullMsg struct {
ReqIdentifier *int `json:"reqIdentifier" binding:"required"`
SendID string `json:"sendID" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
MsgIncr *int `json:"msgIncr" binding:"required"`
Data struct {
SeqBegin *int64 `json:"seqBegin" binding:"required"`
SeqEnd *int64 `json:"seqEnd" binding:"required"`
......@@ -35,7 +34,6 @@ func UserPullMsg(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
return
}
pbData := pbChat.PullMessageReq{}
pbData.UserID = params.SendID
pbData.OperationID = params.OperationID
......@@ -67,7 +65,6 @@ func UserPullMsg(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"errCode": reply.ErrCode,
"errMsg": reply.ErrMsg,
"msgIncr": *params.MsgIncr,
"reqIdentifier": *params.ReqIdentifier,
"data": msg,
})
......
......@@ -14,12 +14,13 @@ import (
)
type paramsUserSendMsg struct {
ReqIdentifier int32 `json:"reqIdentifier" binding:"required"`
PlatformID int32 `json:"platformID" binding:"required"`
SendID string `json:"sendID" binding:"required"`
OperationID string `json:"operationID" binding:"required"`
MsgIncr int32 `json:"msgIncr"`
Data struct {
ReqIdentifier int32 `json:"reqIdentifier" binding:"required"`
PlatformID int32 `json:"platformID" binding:"required"`
SendID string `json:"sendID" binding:"required"`
SenderNickName string `json:"senderNickName" binding:"required"`
SenderFaceURL string `json:"senderFaceUrl"`
OperationID string `json:"operationID" binding:"required"`
Data struct {
SessionType int32 `json:"sessionType" binding:"required"`
MsgFrom int32 `json:"msgFrom" binding:"required"`
ContentType int32 `json:"contentType" binding:"required"`
......@@ -35,22 +36,23 @@ type paramsUserSendMsg struct {
func newUserSendMsgReq(token string, params *paramsUserSendMsg) *pbChat.UserSendMsgReq {
pbData := pbChat.UserSendMsgReq{
ReqIdentifier: params.ReqIdentifier,
Token: token,
SendID: params.SendID,
OperationID: params.OperationID,
MsgIncr: params.MsgIncr,
PlatformID: params.PlatformID,
SessionType: params.Data.SessionType,
MsgFrom: params.Data.MsgFrom,
ContentType: params.Data.ContentType,
RecvID: params.Data.RecvID,
ForceList: params.Data.ForceList,
Content: params.Data.Content,
Options: utils.MapToJsonString(params.Data.Options),
ClientMsgID: params.Data.ClientMsgID,
OffLineInfo: utils.MapToJsonString(params.Data.OffLineInfo),
Ex: utils.MapToJsonString(params.Data.Ex),
ReqIdentifier: params.ReqIdentifier,
Token: token,
SendID: params.SendID,
SenderNickName: params.SenderNickName,
SenderFaceURL: params.SenderFaceURL,
OperationID: params.OperationID,
PlatformID: params.PlatformID,
SessionType: params.Data.SessionType,
MsgFrom: params.Data.MsgFrom,
ContentType: params.Data.ContentType,
RecvID: params.Data.RecvID,
ForceList: params.Data.ForceList,
Content: params.Data.Content,
Options: utils.MapToJsonString(params.Data.Options),
ClientMsgID: params.Data.ClientMsgID,
OffLineInfo: utils.MapToJsonString(params.Data.OffLineInfo),
Ex: utils.MapToJsonString(params.Data.Ex),
}
return &pbData
}
......@@ -85,7 +87,6 @@ func UserSendMsg(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"errCode": reply.ErrCode,
"errMsg": reply.ErrMsg,
"msgIncr": reply.MsgIncr,
"reqIdentifier": reply.ReqIdentifier,
"data": gin.H{
"clientMsgID": reply.ClientMsgID,
......
......@@ -29,6 +29,7 @@ const (
Voice = 103
Video = 104
File = 105
AtText = 106
SyncSenderMsg = 108
//SysRelated
......
......@@ -51,6 +51,9 @@ func (d *DataBases) GetUserChat(uid string, seqBegin, seqEnd int64) (SingleMsg [
temp.Content = pChat.Content
temp.ContentType = pChat.ContentType
temp.SenderPlatformID = pChat.PlatformID
temp.ClientMsgID = pChat.ClientMsgID
temp.SenderFaceURL = pChat.SenderFaceURL
temp.SenderNickName = pChat.SenderNickName
if pChat.RecvSeq > MaxSeq {
MaxSeq = pChat.RecvSeq
}
......@@ -101,7 +104,6 @@ func (d *DataBases) SaveUserChat(uid string, sendTime int64, m proto.Message) er
return err
}
} else {
err = c.Update(bson.M{"uid": uid}, bson.M{"$push": bson.M{"msg": sMsg}})
if err != nil {
return err
......
......@@ -155,7 +155,6 @@ func (ws *WServer) sendMsgReq(conn *websocket.Conn, m *Req) {
Token: m.Token,
SendID: m.SendID,
OperationID: m.OperationID,
MsgIncr: m.MsgIncr,
PlatformID: data.PlatformID,
SessionType: data.SessionType,
MsgFrom: data.MsgFrom,
......
......@@ -65,11 +65,13 @@ func (r *RPCServer) MsgToUser(_ context.Context, in *pbRelay.MsgToUserReq) (*pbR
msg["msgFrom"] = in.MsgFrom
msg["contentType"] = in.ContentType
msg["sessionType"] = in.SessionType
msg["senderNickName"] = in.SenderNickName
msg["senderFaceUrl"] = in.SenderFaceURL
msg["clientMsgID"] = in.ClientMsgID
msg["serverMsgID"] = in.ServerMsgID
msg["content"] = in.Content
msg["seq"] = in.RecvSeq
msg["sendTime"] = in.SendTime
msg["isEmphasize"] = in.IsEmphasize
msg["senderPlatformID"] = in.PlatformID
mReply["data"] = msg
bMsg, _ := json.Marshal(mReply)
......
......@@ -7,6 +7,7 @@ import (
"Open_IM/src/common/log"
pbMsg "Open_IM/src/proto/chat"
pbPush "Open_IM/src/proto/push"
"Open_IM/src/push/content_struct"
"Open_IM/src/utils"
"context"
"github.com/Shopify/sarama"
......@@ -41,12 +42,16 @@ func (mc *HistoryConsumerHandler) handleChatWs2Mongo(msg []byte, msgKey string)
}
pbSaveData := pbMsg.MsgSvrToPushSvrChatMsg{}
pbSaveData.SendID = pbData.SendID
pbSaveData.SenderNickName = pbData.SenderNickName
pbSaveData.SenderFaceURL = pbData.SenderFaceURL
pbSaveData.ClientMsgID = pbData.ClientMsgID
pbSaveData.SendTime = pbData.SendTime
pbSaveData.Content = pbData.Content
pbSaveData.MsgFrom = pbData.MsgFrom
pbSaveData.ContentType = pbData.ContentType
pbSaveData.SessionType = pbData.SessionType
pbSaveData.MsgID = pbData.MsgID
pbSaveData.OperationID = pbData.OperationID
pbSaveData.RecvID = pbData.RecvID
pbSaveData.PlatformID = pbData.PlatformID
Options := utils.JsonStringToMap(pbData.Options)
......@@ -82,12 +87,20 @@ func (mc *HistoryConsumerHandler) handleChatWs2Mongo(msg []byte, msgKey string)
} else if pbData.SessionType == constant.GroupChatType {
log.Info("", "", "msg_transfer chat type = GroupChatType")
uidAndGroupID := strings.Split(pbData.RecvID, " ")
if pbData.ContentType == constant.AtText {
atContent := content_struct.AtTextContent{
Text: pbData.Content,
AtUserList: pbData.ForceList,
}
if utils.IsContain(uidAndGroupID[0], pbData.ForceList) {
atContent.IsAtSelf = true
}
pbSaveData.Content = utils.StructToJsonString(atContent)
}
saveUserChat(uidAndGroupID[0], &pbSaveData)
pbSaveData.Options = pbData.Options
pbSaveData.OfflineInfo = pbData.OfflineInfo
if utils.IsContain(uidAndGroupID[0], pbData.ForceList) {
pbSaveData.IsEmphasize = true
}
sendMessageToPush(&pbSaveData)
log.InfoByKv("msg_transfer handle topic success...", "", "")
} else {
......@@ -115,7 +128,9 @@ func sendMessageToPush(message *pbMsg.MsgSvrToPushSvrChatMsg) {
msg.SessionType = message.SessionType
msg.RecvID = message.RecvID
msg.SendID = message.SendID
msg.IsEmphasize = message.IsEmphasize
msg.SenderNickName = message.SenderNickName
msg.SenderFaceURL = message.SenderFaceURL
msg.ClientMsgID = message.ClientMsgID
msg.MsgFrom = message.MsgFrom
msg.Options = message.Options
msg.RecvSeq = message.RecvSeq
......
......@@ -5,7 +5,7 @@ source ./proto_dir.cfg
for ((i = 0; i < ${#all_proto[*]}; i++)); do
proto=${all_proto[$i]}
protoc --go_out=plugins=grpc:. $proto
s=$(echo $proto | sed 's/ //g')
s=`echo $proto | sed 's/ //g'`
v=${s//proto/pb.go}
protoc-go-inject-tag -input=./$v
echo "protoc --go_out=plugins=grpc:." $proto
......
此差异已折叠。
......@@ -8,15 +8,19 @@ message WSToMsgSvrChatMsg{
string Content = 3;
int64 SendTime = 4;
int32 MsgFrom = 5;
int32 ContentType = 6;
int32 SessionType = 7;
string OperationID = 8;
string MsgID = 9;
string Token = 10;
string OfflineInfo =11;
string Options = 12;
int32 PlatformID =13;
repeated string ForceList = 14;
string SenderNickName = 6;
string SenderFaceURL = 7;
int32 ContentType = 8;
int32 SessionType = 9;
string OperationID = 10;
string MsgID = 11;
string Token = 12;
string OfflineInfo =13;
string Options = 14;
int32 PlatformID =15;
repeated string ForceList = 16;
string ClientMsgID = 17;
}
......@@ -27,14 +31,17 @@ message MsgSvrToPushSvrChatMsg {
int64 RecvSeq = 4;
int64 SendTime = 5;
int32 MsgFrom = 6;
int32 ContentType = 7;
int32 SessionType = 8;
string OperationID = 9;
string MsgID = 10;
string OfflineInfo = 11;
string Options =12;
int32 PlatformID =13;
bool IsEmphasize = 14;
string SenderNickName = 7;
string SenderFaceURL = 8;
int32 ContentType = 9;
int32 SessionType = 10;
string OperationID = 11;
string MsgID = 12;
string OfflineInfo = 13;
string Options =14;
int32 PlatformID =15;
string ClientMsgID = 16;
}
message PullMessageReq {
......@@ -86,6 +93,12 @@ message MsgFormat{
int64 SendTime = 8;
// @inject_tag: json:"senderPlatformID"
int32 SenderPlatformID = 9;
// @inject_tag: json:"senderNickName"
string SenderNickName = 10;
// @inject_tag: json:"senderFaceUrl"
string SenderFaceURL = 11;
// @inject_tag: json:"clientMsgID"
string ClientMsgID = 12;
}
message UserSendMsgReq {
......@@ -94,18 +107,19 @@ message UserSendMsgReq {
string Token = 2;
string SendID = 3;
string OperationID = 4;
int32 MsgIncr = 5;
int32 PlatformID = 6;
int32 SessionType = 7;
int32 MsgFrom = 8;
int32 ContentType = 9;
string RecvID = 10;
repeated string ForceList = 11;
string Content = 12;
string Options = 13;
string ClientMsgID = 14;
string OffLineInfo = 15;
string Ex = 16;
string SenderNickName = 5;
string SenderFaceURL = 6;
int32 PlatformID = 7;
int32 SessionType = 8;
int32 MsgFrom = 9;
int32 ContentType = 10;
string RecvID = 11;
repeated string ForceList = 12;
string Content = 13;
string Options = 14;
string ClientMsgID = 15;
string OffLineInfo = 16;
string Ex = 17;
}
......@@ -114,7 +128,6 @@ message UserSendMsgResp {
int32 ErrCode = 1;
string ErrMsg = 2;
int32 ReqIdentifier = 3;
int32 MsgIncr = 4;
int64 SendTime = 5;
string ServerMsgID = 6;
string ClientMsgID = 7;
......
......@@ -38,7 +38,9 @@ type PushMsgReq struct {
OfflineInfo string `protobuf:"bytes,11,opt,name=OfflineInfo,proto3" json:"OfflineInfo,omitempty"`
Options string `protobuf:"bytes,12,opt,name=Options,proto3" json:"Options,omitempty"`
PlatformID int32 `protobuf:"varint,13,opt,name=PlatformID,proto3" json:"PlatformID,omitempty"`
IsEmphasize bool `protobuf:"varint,14,opt,name=IsEmphasize,proto3" json:"IsEmphasize,omitempty"`
SenderNickName string `protobuf:"bytes,14,opt,name=SenderNickName,proto3" json:"SenderNickName,omitempty"`
SenderFaceURL string `protobuf:"bytes,15,opt,name=SenderFaceURL,proto3" json:"SenderFaceURL,omitempty"`
ClientMsgID string `protobuf:"bytes,16,opt,name=ClientMsgID,proto3" json:"ClientMsgID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
......@@ -160,11 +162,25 @@ func (m *PushMsgReq) GetPlatformID() int32 {
return 0
}
func (m *PushMsgReq) GetIsEmphasize() bool {
func (m *PushMsgReq) GetSenderNickName() string {
if m != nil {
return m.IsEmphasize
return m.SenderNickName
}
return false
return ""
}
func (m *PushMsgReq) GetSenderFaceURL() string {
if m != nil {
return m.SenderFaceURL
}
return ""
}
func (m *PushMsgReq) GetClientMsgID() string {
if m != nil {
return m.ClientMsgID
}
return ""
}
type PushMsgResp struct {
......@@ -216,29 +232,31 @@ func init() {
}
var fileDescriptor_ae0042da44e9a7a7 = []byte{
// 346 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x92, 0x4d, 0x6b, 0xf2, 0x40,
0x14, 0x85, 0xc9, 0xab, 0xf1, 0x63, 0xf2, 0x6a, 0xdb, 0xa1, 0x94, 0x8b, 0x8b, 0x12, 0x5c, 0x65,
0x53, 0x0b, 0xed, 0xb2, 0x9b, 0x52, 0xd3, 0x42, 0x16, 0xa2, 0x4c, 0x5c, 0x75, 0xe7, 0xc7, 0x8d,
0x06, 0xcc, 0xcc, 0x98, 0x89, 0x42, 0xfb, 0x6b, 0xfa, 0x53, 0xcb, 0x9d, 0x44, 0x0d, 0xdd, 0x88,
0xe7, 0x39, 0xe7, 0x1e, 0x2e, 0xb9, 0xc3, 0xae, 0xf4, 0xc1, 0x6c, 0x1f, 0xe9, 0x67, 0xa4, 0x73,
0x55, 0x28, 0xde, 0xa4, 0xff, 0xc3, 0x9f, 0x06, 0x63, 0xb3, 0x83, 0xd9, 0x4e, 0xcc, 0x46, 0xe0,
0x9e, 0xdf, 0xb1, 0x56, 0x8c, 0x72, 0x1d, 0x85, 0xe0, 0xf8, 0x4e, 0xd0, 0x15, 0x95, 0x22, 0x2e,
0x70, 0x75, 0x8c, 0x42, 0xf8, 0x57, 0xf2, 0x52, 0x71, 0x60, 0xed, 0xb1, 0x92, 0x05, 0xca, 0x02,
0x1a, 0xd6, 0x38, 0x49, 0x72, 0x28, 0x13, 0xe3, 0x1e, 0x9a, 0xbe, 0x13, 0x34, 0xc4, 0x49, 0xf2,
0x01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be, 0x97, 0xe7, 0xdf, 0x00, 0x00, 0x00,
0xff, 0xff, 0x20, 0x4b, 0x09, 0x6a, 0x42, 0x02, 0x00, 0x00,
// 377 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x92, 0x5d, 0xeb, 0xda, 0x30,
0x14, 0xc6, 0xe9, 0xb4, 0xbe, 0x9c, 0xce, 0x97, 0x85, 0x31, 0x82, 0x17, 0xa3, 0xc8, 0x18, 0xde,
0xcc, 0xc1, 0x76, 0xb9, 0x9b, 0x31, 0x8b, 0x50, 0x98, 0x2f, 0xa4, 0xee, 0x66, 0x77, 0xb5, 0x9e,
0x6a, 0x59, 0x9b, 0xc4, 0xa6, 0x0a, 0xfb, 0xd2, 0xfb, 0x0c, 0x23, 0x49, 0xd5, 0xfe, 0xbd, 0x29,
0x7d, 0x7e, 0xe7, 0x39, 0x87, 0x27, 0xc9, 0x81, 0x91, 0xbc, 0xa8, 0xd3, 0x67, 0xfd, 0x99, 0xcb,
0x52, 0x54, 0x82, 0xb4, 0xf5, 0xff, 0xf4, 0x5f, 0x0b, 0x60, 0x7b, 0x51, 0xa7, 0x95, 0x3a, 0x32,
0x3c, 0x93, 0x77, 0xd0, 0x89, 0x90, 0x1f, 0xc2, 0x80, 0x3a, 0xbe, 0x33, 0xeb, 0xb3, 0x5a, 0x69,
0xce, 0x30, 0xb9, 0x86, 0x01, 0x7d, 0x65, 0xb9, 0x55, 0x84, 0x42, 0x77, 0x21, 0x78, 0x85, 0xbc,
0xa2, 0x2d, 0x53, 0xb8, 0x49, 0x5d, 0xd1, 0x9e, 0x08, 0xcf, 0xb4, 0xed, 0x3b, 0xb3, 0x16, 0xbb,
0x49, 0x32, 0x81, 0x9e, 0x9e, 0xba, 0xcb, 0x0a, 0xa4, 0xae, 0x29, 0xdd, 0xb5, 0xee, 0x5a, 0xa9,
0xe3, 0xb2, 0x14, 0x05, 0xed, 0xf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 0xe0, 0xb7,
0xa7, 0xd9, 0x37, 0xb9, 0xd7, 0x74, 0xdf, 0x31, 0xdb, 0xf7, 0xf5, 0x7f, 0x00, 0x00, 0x00, 0xff,
0xff, 0x50, 0x88, 0x84, 0xf6, 0x90, 0x02, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
......
......@@ -16,7 +16,9 @@ message PushMsgReq {
string OfflineInfo = 11;
string Options =12;
int32 PlatformID =13;
bool IsEmphasize = 14;
string SenderNickName = 14;
string SenderFaceURL = 15;
string ClientMsgID = 16;
}
message PushMsgResp{
int32 ResultCode = 1;
......
......@@ -36,7 +36,9 @@ type MsgToUserReq struct {
OperationID string `protobuf:"bytes,11,opt,name=OperationID,proto3" json:"OperationID,omitempty"`
ServerMsgID string `protobuf:"bytes,12,opt,name=ServerMsgID,proto3" json:"ServerMsgID,omitempty"`
PlatformID int32 `protobuf:"varint,13,opt,name=PlatformID,proto3" json:"PlatformID,omitempty"`
IsEmphasize bool `protobuf:"varint,14,opt,name=IsEmphasize,proto3" json:"IsEmphasize,omitempty"`
SenderNickName string `protobuf:"bytes,14,opt,name=SenderNickName,proto3" json:"SenderNickName,omitempty"`
SenderFaceURL string `protobuf:"bytes,15,opt,name=SenderFaceURL,proto3" json:"SenderFaceURL,omitempty"`
ClientMsgID string `protobuf:"bytes,16,opt,name=ClientMsgID,proto3" json:"ClientMsgID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
......@@ -144,11 +146,25 @@ func (m *MsgToUserReq) GetPlatformID() int32 {
return 0
}
func (m *MsgToUserReq) GetIsEmphasize() bool {
func (m *MsgToUserReq) GetSenderNickName() string {
if m != nil {
return m.IsEmphasize
return m.SenderNickName
}
return false
return ""
}
func (m *MsgToUserReq) GetSenderFaceURL() string {
if m != nil {
return m.SenderFaceURL
}
return ""
}
func (m *MsgToUserReq) GetClientMsgID() string {
if m != nil {
return m.ClientMsgID
}
return ""
}
type MsgToUserResp struct {
......@@ -267,31 +283,33 @@ func init() {
}
var fileDescriptor_b6da3b5c0d1535b3 = []byte{
// 381 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xcb, 0x6a, 0xe3, 0x30,
0x18, 0x85, 0x71, 0x3c, 0xb9, 0x29, 0x37, 0x46, 0x33, 0x04, 0x4d, 0x16, 0x83, 0xc9, 0xa2, 0x98,
0x2e, 0x52, 0x48, 0xa1, 0x9b, 0xec, 0x1a, 0x37, 0xe0, 0x85, 0x49, 0x91, 0xd3, 0x4d, 0x77, 0x4e,
0xf2, 0xd7, 0x35, 0xd8, 0x92, 0x22, 0xb9, 0x81, 0xf4, 0xb1, 0xfb, 0x04, 0x45, 0x72, 0xd2, 0x88,
0x94, 0x6e, 0x8c, 0xcf, 0xf7, 0x1f, 0x1f, 0x1f, 0x5d, 0xd0, 0x6f, 0x09, 0x79, 0x72, 0xb8, 0x31,
0xcf, 0x89, 0x90, 0xbc, 0xe4, 0xb8, 0x6e, 0xc4, 0xf8, 0xa3, 0x86, 0xba, 0x91, 0x4a, 0x57, 0xfc,
0x49, 0x81, 0xa4, 0xb0, 0xc3, 0x43, 0xd4, 0x88, 0x81, 0x6d, 0xc3, 0x80, 0x38, 0x9e, 0xe3, 0xb7,
0xe9, 0x51, 0x69, 0x4e, 0x61, 0xb3, 0x0f, 0x03, 0x52, 0xab, 0x78, 0xa5, 0x30, 0x41, 0xcd, 0x39,
0x67, 0x25, 0xb0, 0x92, 0xd4, 0xcd, 0xe0, 0x24, 0xf5, 0x44, 0x7b, 0x62, 0xd8, 0x91, 0x86, 0xe7,
0xf8, 0x2e, 0x3d, 0x49, 0x3c, 0x42, 0x2d, 0x9d, 0xba, 0xca, 0x0a, 0x20, 0x4d, 0x33, 0xfa, 0xd2,
0xfa, 0xab, 0x48, 0xa5, 0x0b, 0xc9, 0x0b, 0xd2,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0xe2, 0x7e, 0xf0, 0xdc, 0x33, 0x78, 0x26, 0xd6, 0x26, 0x6f, 0xdd, 0x30, 0x17, 0xf3, 0xf6,
0x33, 0x00, 0x00, 0xff, 0xff, 0x57, 0x9a, 0x71, 0x03, 0xad, 0x02, 0x00, 0x00,
// 412 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xc1, 0x6f, 0xd3, 0x30,
0x14, 0xc6, 0x15, 0x42, 0xbb, 0xf5, 0x75, 0x6d, 0xc1, 0xa0, 0xc9, 0xec, 0x80, 0xa2, 0x0a, 0x4d,
0x11, 0x87, 0x21, 0x0d, 0x89, 0xcb, 0x6e, 0x2c, 0xaa, 0x14, 0x89, 0x6c, 0xc8, 0xe9, 0x2e, 0xdc,
0xb2, 0xec, 0x11, 0x59, 0x24, 0x76, 0x6a, 0x87, 0x49, 0xfb, 0xef, 0xf8, 0xd3, 0x90, 0x9f, 0x5b,
0x6a, 0x8a, 0xb8, 0x44, 0xf9, 0x7e, 0xef, 0xcb, 0xcb, 0xe7, 0xe7, 0x07, 0x2f, 0x0d, 0xb6, 0xd5,
0xd3, 0x07, 0x7a, 0x5e, 0xf4, 0x46, 0x0f, 0x9a, 0x8d, 0x48, 0x2c, 0x7f, 0xc5, 0x70, 0x52, 0xd8,
0x66, 0xad, 0xef, 0x2c, 0x1a, 0x81, 0x1b, 0x76, 0x0a, 0xe3, 0x12, 0xd5, 0x43, 0x9e, 0xf1, 0x28,
0x89, 0xd2, 0x89, 0xd8, 0x2a, 0xc7, 0x05, 0xd6, 0x8f, 0x79, 0xc6, 0x9f, 0x79, 0xee, 0x15, 0xe3,
0x70, 0x74, 0xad, 0xd5, 0x80, 0x6a, 0xe0, 0x23, 0x2a, 0xec, 0xa4, 0xab, 0x38, 0x4f, 0x89, 0x1b,
0x3e, 0x4e, 0xa2, 0x34, 0x16, 0x3b, 0xc9, 0xce, 0xe0, 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x61, 0xee, 0xde, 0xdc, 0x24, 0x56, 0x7e, 0x36, 0x31, 0xcd, 0xe6, 0x80, 0x5e, 0x96, 0xf0,
0xe6, 0x56, 0xb5, 0x52, 0x61, 0x81, 0xd6, 0x56, 0x0d, 0x0a, 0x17, 0xcf, 0x0d, 0x58, 0xd6, 0xc8,
0x3e, 0xc1, 0x64, 0x9f, 0xe4, 0xd5, 0x36, 0x7a, 0xb8, 0xa0, 0x67, 0xaf, 0xff, 0x85, 0xb6, 0xff,
0xbc, 0xf8, 0x36, 0x23, 0x7c, 0xd5, 0xdf, 0x53, 0xbf, 0xfb, 0x31, 0xad, 0xf9, 0xc7, 0xdf, 0x01,
0x00, 0x00, 0xff, 0xff, 0xca, 0xdd, 0x7b, 0x0c, 0xfb, 0x02, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
......
......@@ -14,7 +14,9 @@ message MsgToUserReq {
string OperationID = 11;
string ServerMsgID = 12;
int32 PlatformID = 13;
bool IsEmphasize = 14;
string SenderNickName = 14;
string SenderFaceURL = 15;
string ClientMsgID = 16;
}
message MsgToUserResp{
repeated SingleMsgToUser resp = 1;
......
......@@ -44,6 +44,11 @@ type AgreeOrRejectGroupMember struct {
FaceUrl string `json:"faceUrl"`
Reason string `json:"reason"`
}
type AtTextContent struct {
Text string `json:"text"`
AtUserList []string `json:"atUserList"`
IsAtSelf bool `json:"isAtSelf"`
}
type CreateGroupSysMsg struct {
uIdCreator string `creatorUid`
......
......@@ -47,9 +47,11 @@ func (ms *PushConsumerHandler) handleMs2PsChat(msg []byte) {
sendPbData.RecvID = pbData.RecvID
sendPbData.Content = pbData.Content
sendPbData.SendID = pbData.SendID
sendPbData.SenderNickName = pbData.SenderNickName
sendPbData.SenderFaceURL = pbData.SenderFaceURL
sendPbData.ClientMsgID = pbData.ClientMsgID
sendPbData.PlatformID = pbData.PlatformID
sendPbData.RecvSeq = pbData.RecvSeq
sendPbData.IsEmphasize = pbData.IsEmphasize
//Call push module to send message to the user
MsgToUser(&sendPbData, pbData.OfflineInfo, pbData.Options)
}
......
......@@ -55,13 +55,15 @@ func (r *RPCServer) PushMsg(_ context.Context, pbData *pbPush.PushMsgReq) (*pbPu
sendPbData.ServerMsgID = pbData.MsgID
sendPbData.MsgFrom = pbData.MsgFrom
sendPbData.ContentType = pbData.ContentType
sendPbData.SenderNickName = pbData.SenderNickName
sendPbData.SenderFaceURL = pbData.SenderFaceURL
sendPbData.ClientMsgID = pbData.ClientMsgID
sendPbData.SessionType = pbData.SessionType
sendPbData.RecvID = pbData.RecvID
sendPbData.Content = pbData.Content
sendPbData.SendID = pbData.SendID
sendPbData.PlatformID = pbData.PlatformID
sendPbData.RecvSeq = pbData.RecvSeq
sendPbData.IsEmphasize = pbData.IsEmphasize
//Call push module to send message to the user
MsgToUser(&sendPbData, pbData.OfflineInfo, pbData.Options)
return &pbPush.PushMsgResp{
......
......@@ -108,6 +108,7 @@ func MsgToUser(sendPbData *pbRelay.MsgToUserReq, OfflineInfo, Options string) {
func SendMsgByWS(m *pbChat.WSToMsgSvrChatMsg) {
m.MsgID = rpcChat.GetMsgID(m.SendID)
m.ClientMsgID = m.MsgID
switch m.SessionType {
case constant.SingleChatType:
sendMsgToKafka(m, m.SendID, "msgKey--sendID")
......
......@@ -31,7 +31,6 @@ func (rpc *rpcChat) GetNewSeq(_ context.Context, in *pbMsg.GetNewSeqReq) (*pbMsg
}
}
func (rpc *rpcChat) PullMessage(_ context.Context, in *pbMsg.PullMessageReq) (*pbMsg.PullMessageResp, error) {
log.InfoByKv("rpc pullMessage is arriving", in.OperationID, "args", in.String())
resp := new(pbMsg.PullMessageResp)
......
......@@ -50,7 +50,10 @@ func (rpc *rpcChat) UserSendMsg(_ context.Context, pb *pbChat.UserSendMsgReq) (*
pbData.OfflineInfo = pb.OffLineInfo
pbData.Options = pb.Options
pbData.PlatformID = pb.PlatformID
pbData.ClientMsgID = pb.ClientMsgID
pbData.SendID = pb.SendID
pbData.SenderNickName = pb.SenderNickName
pbData.SenderFaceURL = pb.SenderFaceURL
pbData.MsgID = serverMsgID
pbData.OperationID = pb.OperationID
pbData.Token = pb.Token
......@@ -136,7 +139,6 @@ func returnMsg(replay *pbChat.UserSendMsgResp, pb *pbChat.UserSendMsgReq, errCod
replay.ErrCode = errCode
replay.ErrMsg = errMsg
replay.ReqIdentifier = pb.ReqIdentifier
replay.MsgIncr = pb.MsgIncr
replay.ClientMsgID = pb.ClientMsgID
replay.ServerMsgID = serverMsgID
replay.SendTime = sendTime
......
......@@ -56,7 +56,7 @@ func (s *friendServer) AddFriendResponse(ctx context.Context, req *pbFriend.AddF
logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
SendID: claims.UID,
RecvID: req.Uid,
Content: senderInfo.Name + " agreed to add you as a friend.",
Content: content_struct.NewContentStructString(1, "", senderInfo.Name+" agreed to add you as a friend."),
SendTime: utils.GetCurrentTimestampBySecond(),
MsgFrom: constant.UserMsgType, //Notification message identification
ContentType: constant.AcceptFriendApplicationTip, //Add friend flag
......
......@@ -6,7 +6,10 @@
*/
package utils
import "strconv"
import (
"encoding/json"
"strconv"
)
func IntToString(i int) string {
return strconv.FormatInt(int64(i), 10)
......@@ -39,3 +42,8 @@ func InterfaceArrayToStringArray(data []interface{}) (i []string) {
}
return i
}
func StructToJsonString(param interface{}) string {
dataType, _ := json.Marshal(param)
dataString := string(dataType)
return dataString
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册