diff --git a/internal/api/manage/management_chat.go b/internal/api/manage/management_chat.go index f547b9b92..ba715bf68 100644 --- a/internal/api/manage/management_chat.go +++ b/internal/api/manage/management_chat.go @@ -61,7 +61,7 @@ func newUserSendMsgReq(params *ManagementSendMsgReq) *pbChat.SendMsgReq { ContentType: params.ContentType, Content: []byte(newContent), ForceList: params.ForceList, - CreateTime: utils.GetCurrentTimestampByNano(), + CreateTime: utils.GetCurrentTimestampByMill(), Options: options, OfflinePushInfo: params.OfflinePushInfo, }, diff --git a/internal/msg_gateway/gate/logic.go b/internal/msg_gateway/gate/logic.go index c7f0ff8a1..5fec367aa 100644 --- a/internal/msg_gateway/gate/logic.go +++ b/internal/msg_gateway/gate/logic.go @@ -7,7 +7,6 @@ import ( "Open_IM/pkg/grpc-etcdv3/getcdv3" pbChat "Open_IM/pkg/proto/chat" sdk_ws "Open_IM/pkg/proto/sdk_ws" - "Open_IM/pkg/utils" "bytes" "context" "encoding/gob" @@ -51,14 +50,13 @@ func (ws *WServer) msgParse(conn *UserConn, binaryMsg []byte) { switch m.ReqIdentifier { case constant.WSGetNewestSeq: - go ws.getSeqReq(conn, &m) + ws.getSeqReq(conn, &m) case constant.WSPullMsg: - go ws.pullMsgReq(conn, &m) + ws.pullMsgReq(conn, &m) case constant.WSSendMsg: - sendTime := utils.GetCurrentTimestampByNano() - go ws.sendMsgReq(conn, &m, sendTime) + ws.sendMsgReq(conn, &m) case constant.WSPullMsgBySeqList: - go ws.pullMsgBySeqListReq(conn, &m) + ws.pullMsgBySeqListReq(conn, &m) default: } log.NewInfo("", "goroutine num is ", runtime.NumGoroutine()) @@ -229,13 +227,12 @@ func (ws *WServer) pullMsgBySeqListResp(conn *UserConn, m *Req, pb *sdk_ws.PullM ws.sendMsg(conn, mReply) } -func (ws *WServer) sendMsgReq(conn *UserConn, m *Req, sendTime int64) { - log.NewInfo(m.OperationID, "Ws call success to sendMsgReq start", m.MsgIncr, m.ReqIdentifier, m.SendID, sendTime) +func (ws *WServer) sendMsgReq(conn *UserConn, m *Req) { + log.NewInfo(m.OperationID, "Ws call success to sendMsgReq start", m.MsgIncr, m.ReqIdentifier, m.SendID) nReply := new(pbChat.SendMsgResp) isPass, errCode, errMsg, pData := ws.argsValidate(m, constant.WSSendMsg) if isPass { data := pData.(sdk_ws.MsgData) - data.SendTime = sendTime pbData := pbChat.SendMsgReq{ Token: m.Token, OperationID: m.OperationID, @@ -249,26 +246,26 @@ func (ws *WServer) sendMsgReq(conn *UserConn, m *Req, sendTime int64) { log.NewError(pbData.OperationID, "UserSendMsg err", err.Error()) nReply.ErrCode = 200 nReply.ErrMsg = err.Error() - ws.sendMsgResp(conn, m, nReply, sendTime) + ws.sendMsgResp(conn, m, nReply) } else { log.NewInfo(pbData.OperationID, "rpc call success to sendMsgReq", reply.String()) - ws.sendMsgResp(conn, m, reply, sendTime) + ws.sendMsgResp(conn, m, reply) } } else { nReply.ErrCode = errCode nReply.ErrMsg = errMsg - ws.sendMsgResp(conn, m, nReply, sendTime) + ws.sendMsgResp(conn, m, nReply) } } -func (ws *WServer) sendMsgResp(conn *UserConn, m *Req, pb *pbChat.SendMsgResp, sendTime int64) { +func (ws *WServer) sendMsgResp(conn *UserConn, m *Req, pb *pbChat.SendMsgResp) { // := make(map[string]interface{}) var mReplyData sdk_ws.UserSendMsgResp mReplyData.ClientMsgID = pb.GetClientMsgID() mReplyData.ServerMsgID = pb.GetServerMsgID() - mReplyData.SendTime = sendTime + mReplyData.SendTime = pb.GetSendTime() b, _ := proto.Marshal(&mReplyData) mReply := Resp{ ReqIdentifier: m.ReqIdentifier, diff --git a/internal/rpc/msg/send_msg.go b/internal/rpc/msg/send_msg.go index bf371f0a2..96c777220 100644 --- a/internal/rpc/msg/send_msg.go +++ b/internal/rpc/msg/send_msg.go @@ -46,7 +46,7 @@ type MsgCallBackResp struct { func (rpc *rpcChat) encapsulateMsgData(msg *sdk_ws.MsgData) { msg.ServerMsgID = GetMsgID(msg.SendID) if msg.SendTime == 0 { - msg.SendTime = utils.GetCurrentTimestampByNano() + msg.SendTime = utils.GetCurrentTimestampByMill() } switch msg.ContentType { case constant.Text: @@ -252,7 +252,7 @@ func Notification(n *NotificationMsg, onlineUserOnly bool) { msg.MsgFrom = n.MsgFrom msg.ContentType = n.ContentType msg.SessionType = n.SessionType - msg.CreateTime = utils.GetCurrentTimestampByNano() + msg.CreateTime = utils.GetCurrentTimestampByMill() msg.ClientMsgID = utils.GetMsgID(n.SendID) switch n.SessionType { case constant.GroupChatType: diff --git a/pkg/proto/sdk_ws/ws.proto b/pkg/proto/sdk_ws/ws.proto index bd3729e85..fcd90b9ae 100644 --- a/pkg/proto/sdk_ws/ws.proto +++ b/pkg/proto/sdk_ws/ws.proto @@ -187,12 +187,12 @@ message MsgData { int32 msgFrom = 10; int32 contentType = 11; bytes content = 12; - repeated string forceList = 13; int64 seq = 14; int64 sendTime = 15; int64 createTime = 16; - map options = 17; - OfflinePushInfo offlinePushInfo = 18; + int32 status = 17; + map options = 18; + OfflinePushInfo offlinePushInfo = 19; } message OfflinePushInfo{