diff --git a/cmd/open_im_api/main.go b/cmd/open_im_api/main.go index f27e53277..d199bcdbb 100644 --- a/cmd/open_im_api/main.go +++ b/cmd/open_im_api/main.go @@ -75,7 +75,7 @@ func main() { thirdGroup.POST("/tencent_cloud_storage_credential", apiThird.TencentCloudStorageCredential) } //Message - chatGroup := r.Group("/chat") + chatGroup := r.Group("/msg") { chatGroup.POST("/newest_seq", apiChat.UserGetSeq) chatGroup.POST("/pull_msg", apiChat.UserPullMsg) diff --git a/cmd/rpc/open_im_msg/main.go b/cmd/rpc/open_im_msg/main.go index 0dffe8aaa..7344facf4 100644 --- a/cmd/rpc/open_im_msg/main.go +++ b/cmd/rpc/open_im_msg/main.go @@ -1,7 +1,7 @@ package main import ( - rpcChat "Open_IM/internal/rpc/chat" + rpcChat "Open_IM/internal/rpc/msg" "flag" ) diff --git a/internal/api/chat/send_msg.go b/internal/api/chat/send_msg.go index e48582eb1..310be2ec2 100644 --- a/internal/api/chat/send_msg.go +++ b/internal/api/chat/send_msg.go @@ -34,8 +34,8 @@ type paramsUserSendMsg struct { } } -func newUserSendMsgReq(token string, params *paramsUserSendMsg) *pbChat.UserSendMsgReq { - pbData := pbChat.UserSendMsgReq{ +func newUserSendMsgReq(token string, params *paramsUserSendMsg) *pbChat.SendMsgReq { + pbData := pbChat.SendMsgReq{ ReqIdentifier: params.ReqIdentifier, Token: token, SendID: params.SendID, @@ -70,20 +70,20 @@ func UserSendMsg(c *gin.Context) { log.InfoByKv("api call success to sendMsgReq", params.OperationID, "Parameters", params) pbData := newUserSendMsgReq(token, ¶ms) - log.Info("", "", "api UserSendMsg call start..., [data: %s]", pbData.String()) + log.Info("", "", "api SendMsg call start..., [data: %s]", pbData.String()) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) client := pbChat.NewChatClient(etcdConn) - log.Info("", "", "api UserSendMsg call, api call rpc...") + log.Info("", "", "api SendMsg call, api call rpc...") - reply, err := client.UserSendMsg(context.Background(), pbData) + reply, err := client.SendMsg(context.Background(), pbData) if err != nil { - log.NewError(params.OperationID, "UserSendMsg rpc failed, ", params, err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "UserSendMsg rpc failed, " + err.Error()}) + log.NewError(params.OperationID, "SendMsg rpc failed, ", params, err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "SendMsg rpc failed, " + err.Error()}) return } - log.Info("", "", "api UserSendMsg call end..., [data: %s] [reply: %s]", pbData.String(), reply.String()) + log.Info("", "", "api SendMsg call end..., [data: %s] [reply: %s]", pbData.String(), reply.String()) c.JSON(http.StatusOK, gin.H{ "errCode": reply.ErrCode, diff --git a/internal/msg_gateway/gate/logic.go b/internal/msg_gateway/gate/logic.go index 9b449d4b2..9838d0808 100644 --- a/internal/msg_gateway/gate/logic.go +++ b/internal/msg_gateway/gate/logic.go @@ -6,7 +6,7 @@ import ( "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" pbChat "Open_IM/pkg/proto/chat" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" + sdk_ws "Open_IM/pkg/proto/sdk_ws" "Open_IM/pkg/utils" "bytes" "context" @@ -86,7 +86,7 @@ func (ws *WServer) getSeqReq(conn *UserConn, m *Req) { } } func (ws *WServer) getSeqResp(conn *UserConn, m *Req, pb *pbChat.GetMaxAndMinSeqResp) { - var mReplyData open_im_sdk.GetMaxAndMinSeqResp + var mReplyData sdk_ws.GetMaxAndMinSeqResp mReplyData.MaxSeq = pb.GetMaxSeq() mReplyData.MinSeq = pb.GetMinSeq() b, _ := proto.Marshal(&mReplyData) @@ -131,7 +131,7 @@ func (ws *WServer) pullMsgReq(conn *UserConn, m *Req) { } func (ws *WServer) pullMsgResp(conn *UserConn, m *Req, pb *pbChat.PullMessageResp) { log.NewInfo(m.OperationID, "pullMsgResp come here ", pb.String()) - var mReplyData open_im_sdk.PullMessageBySeqListResp + var mReplyData sdk_ws.PullMessageBySeqListResp a, err := json.Marshal(pb.SingleUserMsg) if err != nil { log.NewError(m.OperationID, "GetSingleUserMsg,json marshal,err", err.Error()) @@ -170,10 +170,10 @@ func (ws *WServer) pullMsgBySeqListReq(conn *UserConn, m *Req) { log.NewInfo(m.OperationID, "Ws call success to pullMsgBySeqListReq start", m.SendID, m.ReqIdentifier, m.MsgIncr) nReply := new(pbChat.PullMessageResp) isPass, errCode, errMsg, data := ws.argsValidate(m, constant.WSPullMsgBySeqList) - log.NewInfo(m.OperationID, "Ws call success to pullMsgBySeqListReq middle", m.SendID, m.ReqIdentifier, m.MsgIncr, data.(open_im_sdk.PullMessageBySeqListReq).SeqList) + log.NewInfo(m.OperationID, "Ws call success to pullMsgBySeqListReq middle", m.SendID, m.ReqIdentifier, m.MsgIncr, data.(sdk_ws.PullMessageBySeqListReq).SeqList) if isPass { pbData := pbChat.PullMessageBySeqListReq{} - pbData.SeqList = data.(open_im_sdk.PullMessageBySeqListReq).SeqList + pbData.SeqList = data.(sdk_ws.PullMessageBySeqListReq).SeqList pbData.UserID = m.SendID pbData.OperationID = m.OperationID grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) @@ -196,32 +196,20 @@ func (ws *WServer) pullMsgBySeqListReq(conn *UserConn, m *Req) { } 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) - nReply := new(pbChat.UserSendMsgResp) + nReply := new(pbChat.SendMsgResp) isPass, errCode, errMsg, pData := ws.argsValidate(m, constant.WSSendMsg) if isPass { - data := pData.(open_im_sdk.UserSendMsgReq) - pbData := pbChat.UserSendMsgReq{ - ReqIdentifier: m.ReqIdentifier, - Token: m.Token, - SendID: m.SendID, - OperationID: m.OperationID, - PlatformID: data.PlatformID, - SessionType: data.SessionType, - MsgFrom: data.MsgFrom, - ContentType: data.ContentType, - RecvID: data.RecvID, - ForceList: data.ForceList, - SenderNickName: data.SenderNickName, - SenderFaceURL: data.SenderFaceURL, - Content: data.Content, - Options: utils.MapIntToJsonString(data.Options), - ClientMsgID: data.ClientMsgID, - SendTime: sendTime, + data := pData.(sdk_ws.MsgData) + data.SendTime = sendTime + pbData := pbChat.SendMsgReq{ + Token: m.Token, + OperationID: m.OperationID, + MsgData: &data, } log.NewInfo(m.OperationID, "Ws call success to sendMsgReq middle", m.ReqIdentifier, m.SendID, m.MsgIncr, data) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) client := pbChat.NewChatClient(etcdConn) - reply, err := client.UserSendMsg(context.Background(), &pbData) + reply, err := client.SendMsg(context.Background(), &pbData) if err != nil { log.NewError(pbData.OperationID, "UserSendMsg err", err.Error()) nReply.ErrCode = 200 @@ -239,10 +227,10 @@ func (ws *WServer) sendMsgReq(conn *UserConn, m *Req, sendTime int64) { } } -func (ws *WServer) sendMsgResp(conn *UserConn, m *Req, pb *pbChat.UserSendMsgResp, sendTime int64) { +func (ws *WServer) sendMsgResp(conn *UserConn, m *Req, pb *pbChat.SendMsgResp, sendTime int64) { // := make(map[string]interface{}) - var mReplyData open_im_sdk.UserSendMsgResp + var mReplyData sdk_ws.UserSendMsgResp mReplyData.ClientMsgID = pb.GetClientMsgID() mReplyData.ServerMsgID = pb.GetServerMsgID() mReplyData.SendTime = sendTime @@ -263,12 +251,14 @@ func (ws *WServer) sendMsg(conn *UserConn, mReply interface{}) { enc := gob.NewEncoder(&b) err := enc.Encode(mReply) if err != nil { - log.NewError(mReply.(Resp).OperationID, mReply.(Resp).ReqIdentifier, mReply.(Resp).ErrCode, mReply.(Resp).ErrMsg, "Encode Msg error", conn.RemoteAddr().String(), ws.getUserUid(conn), err.Error()) + uid, platform := ws.getUserUid(conn) + log.NewError(mReply.(Resp).OperationID, mReply.(Resp).ReqIdentifier, mReply.(Resp).ErrCode, mReply.(Resp).ErrMsg, "Encode Msg error", conn.RemoteAddr().String(), uid, platform, err.Error()) return } err = ws.writeMsg(conn, websocket.BinaryMessage, b.Bytes()) if err != nil { - log.NewError(mReply.(Resp).OperationID, mReply.(Resp).ReqIdentifier, mReply.(Resp).ErrCode, mReply.(Resp).ErrMsg, "WS WriteMsg error", conn.RemoteAddr().String(), ws.getUserUid(conn), err.Error()) + uid, platform := ws.getUserUid(conn) + log.NewError(mReply.(Resp).OperationID, mReply.(Resp).ReqIdentifier, mReply.(Resp).ErrCode, mReply.(Resp).ErrMsg, "WS WriteMsg error", conn.RemoteAddr().String(), uid, platform, err.Error()) } } func (ws *WServer) sendErrMsg(conn *UserConn, errCode int32, errMsg string, reqIdentifier int32, msgIncr string, operationID string) { diff --git a/internal/msg_gateway/gate/rpc_server.go b/internal/msg_gateway/gate/rpc_server.go index a3ef373d6..4c9c03f34 100644 --- a/internal/msg_gateway/gate/rpc_server.go +++ b/internal/msg_gateway/gate/rpc_server.go @@ -6,7 +6,6 @@ import ( "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" pbRelay "Open_IM/pkg/proto/relay" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" "Open_IM/pkg/utils" "bytes" "context" @@ -55,26 +54,10 @@ func (r *RPCServer) run() { return } } -func (r *RPCServer) MsgToUser(_ context.Context, in *pbRelay.MsgToUserReq) (*pbRelay.MsgToUserResp, error) { +func (r *RPCServer) OnlinePushMsg(_ context.Context, in *pbRelay.OnlinePushMsgReq) (*pbRelay.OnlinePushMsgResp, error) { log.InfoByKv("PushMsgToUser is arriving", in.OperationID, "args", in.String()) var resp []*pbRelay.SingleMsgToUser - var RecvID string - msg := open_im_sdk.MsgData{ - SendID: in.SendID, - RecvID: in.RecvID, - MsgFrom: in.MsgFrom, - ContentType: in.ContentType, - SessionType: in.SessionType, - SenderNickName: in.SenderNickName, - SenderFaceURL: in.SenderFaceURL, - ClientMsgID: in.ClientMsgID, - ServerMsgID: in.ServerMsgID, - Content: in.Content, - Seq: in.RecvSeq, - SendTime: in.SendTime, - SenderPlatformID: in.PlatformID, - } - msgBytes, _ := proto.Marshal(&msg) + msgBytes, _ := proto.Marshal(in.MsgData) mReply := Resp{ ReqIdentifier: constant.WSPushMsg, OperationID: in.OperationID, @@ -86,65 +69,52 @@ func (r *RPCServer) MsgToUser(_ context.Context, in *pbRelay.MsgToUserReq) (*pbR if err != nil { log.NewError(in.OperationID, "data encode err", err.Error()) } - switch in.GetSessionType() { - case constant.SingleChatType: - RecvID = in.GetRecvID() - case constant.GroupChatType: - RecvID = strings.Split(in.GetRecvID(), " ")[0] - } var tag bool - var UIDAndPID []string - userIDList := genUidPlatformArray(RecvID) - for _, v := range userIDList { - UIDAndPID = strings.Split(v, " ") - if conn := ws.getUserConn(v); conn != nil { + recvID := in.MsgData.RecvID + platformList := genPlatformArray() + for _, v := range platformList { + if conn := ws.getUserConn(recvID, v); conn != nil { tag = true - resultCode := sendMsgToUser(conn, replyBytes.Bytes(), in, UIDAndPID[1], UIDAndPID[0]) + resultCode := sendMsgToUser(conn, replyBytes.Bytes(), in, v, recvID) temp := &pbRelay.SingleMsgToUser{ ResultCode: resultCode, - RecvID: UIDAndPID[0], - RecvPlatFormID: constant.PlatformNameToID(UIDAndPID[1]), + RecvID: recvID, + RecvPlatFormID: constant.PlatformNameToID(v), } resp = append(resp, temp) } else { temp := &pbRelay.SingleMsgToUser{ ResultCode: -1, - RecvID: UIDAndPID[0], - RecvPlatFormID: constant.PlatformNameToID(UIDAndPID[1]), + RecvID: recvID, + RecvPlatFormID: constant.PlatformNameToID(v), } resp = append(resp, temp) } } //Single chat sender synchronization message - if in.GetSessionType() == constant.SingleChatType && in.ContentType <= constant.Quote && in.ContentType != constant.Typing && in.ContentType != constant.HasReadReceipt { - userIDList = genUidPlatformArray(in.SendID) - for _, v := range userIDList { - UIDAndPID = strings.Split(v, " ") - if conn := ws.getUserConn(v); conn != nil { - _ = sendMsgToUser(conn, replyBytes.Bytes(), in, UIDAndPID[1], UIDAndPID[0]) - } + if in.MsgData.GetSessionType() == constant.SingleChatType { + for k, v := range ws.getSingleUserAllConn(recvID) { + _ = sendMsgToUser(v, replyBytes.Bytes(), in, k, recvID) } } if !tag { log.NewError(in.OperationID, "push err ,no matched ws conn not in map", in.String()) } - return &pbRelay.MsgToUserResp{ + return &pbRelay.OnlinePushMsgResp{ Resp: resp, }, nil } func (r *RPCServer) GetUsersOnlineStatus(_ context.Context, req *pbRelay.GetUsersOnlineStatusReq) (*pbRelay.GetUsersOnlineStatusResp, error) { log.NewDebug(req.OperationID, "rpc GetUsersOnlineStatus arrived server", req.String()) - var UIDAndPID []string var resp pbRelay.GetUsersOnlineStatusResp - for _, v1 := range req.UserIDList { - userIDList := genUidPlatformArray(v1) + for _, userID := range req.UserIDList { + platformList := genPlatformArray() temp := new(pbRelay.GetUsersOnlineStatusResp_SuccessResult) - temp.UserID = v1 - for _, v2 := range userIDList { - UIDAndPID = strings.Split(v2, " ") - if conn := ws.getUserConn(v2); conn != nil { + temp.UserID = userID + for _, platform := range platformList { + if conn := ws.getUserConn(userID, platform); conn != nil { ps := new(pbRelay.GetUsersOnlineStatusResp_SuccessDetail) - ps.Platform = UIDAndPID[1] + ps.Platform = platform ps.Status = constant.OnlineStatus temp.Status = constant.OnlineStatus temp.DetailPlatformStatus = append(temp.DetailPlatformStatus, ps) @@ -157,11 +127,11 @@ func (r *RPCServer) GetUsersOnlineStatus(_ context.Context, req *pbRelay.GetUser } return &resp, nil } -func sendMsgToUser(conn *UserConn, bMsg []byte, in *pbRelay.MsgToUserReq, RecvPlatForm, RecvID string) (ResultCode int64) { +func sendMsgToUser(conn *UserConn, bMsg []byte, in *pbRelay.OnlinePushMsgReq, RecvPlatForm, RecvID string) (ResultCode int64) { err := ws.writeMsg(conn, websocket.BinaryMessage, bMsg) if err != nil { log.ErrorByKv("PushMsgToUser is failed By Ws", "", "Addr", conn.RemoteAddr().String(), - "error", err, "senderPlatform", constant.PlatformIDToName(in.PlatformID), "recvPlatform", RecvPlatForm, "args", in.String(), "recvID", RecvID) + "error", err, "senderPlatform", constant.PlatformIDToName(in.MsgData.SenderPlatformID), "recvPlatform", RecvPlatForm, "args", in.String(), "recvID", RecvID) ResultCode = -2 return ResultCode } else { @@ -171,9 +141,9 @@ func sendMsgToUser(conn *UserConn, bMsg []byte, in *pbRelay.MsgToUserReq, RecvPl } } -func genUidPlatformArray(uid string) (array []string) { +func genPlatformArray() (array []string) { for i := 1; i <= constant.LinuxPlatformID; i++ { - array = append(array, uid+" "+constant.PlatformIDToName(int32(i))) + array = append(array, constant.PlatformIDToName(int32(i))) } return array } diff --git a/internal/msg_gateway/gate/ws_server.go b/internal/msg_gateway/gate/ws_server.go index fc6151cf1..150a11b64 100644 --- a/internal/msg_gateway/gate/ws_server.go +++ b/internal/msg_gateway/gate/ws_server.go @@ -9,6 +9,7 @@ import ( "Open_IM/pkg/utils" "bytes" "encoding/gob" + "github.com/garyburd/redigo/redis" "net/http" "sync" "time" @@ -24,15 +25,15 @@ type WServer struct { wsAddr string wsMaxConnNum int wsUpGrader *websocket.Upgrader - wsConnToUser map[*UserConn]string - wsUserToConn map[string]*UserConn + wsConnToUser map[*UserConn]map[string]string + wsUserToConn map[string]map[string]*UserConn } func (ws *WServer) onInit(wsPort int) { ws.wsAddr = ":" + utils.IntToString(wsPort) ws.wsMaxConnNum = config.Config.LongConnSvr.WebsocketMaxConnNum - ws.wsConnToUser = make(map[*UserConn]string) - ws.wsUserToConn = make(map[string]*UserConn) + ws.wsConnToUser = make(map[*UserConn]map[string]string) + ws.wsUserToConn = make(map[string]map[string]*UserConn) ws.wsUpGrader = &websocket.Upgrader{ HandshakeTimeout: time.Duration(config.Config.LongConnSvr.WebsocketTimeOut) * time.Second, ReadBufferSize: config.Config.LongConnSvr.WebsocketMaxMsgLen, @@ -74,7 +75,8 @@ func (ws *WServer) readMsg(conn *UserConn) { log.NewInfo("", "this is a pingMessage") } if err != nil { - log.ErrorByKv("WS ReadMsg error", "", "userIP", conn.RemoteAddr().String(), "userUid", ws.getUserUid(conn), "error", err) + uid, platform := ws.getUserUid(conn) + log.ErrorByKv("WS ReadMsg error", "", "userIP", conn.RemoteAddr().String(), "userUid", uid, "platform", platform, "error", err.Error()) ws.delUserConn(conn) return } else { @@ -94,34 +96,43 @@ func (ws *WServer) writeMsg(conn *UserConn, a int, msg []byte) error { func (ws *WServer) MultiTerminalLoginChecker(uid string, platformID int32, newConn *UserConn, token string) { switch config.Config.MultiLoginPolicy { case constant.AllLoginButSameTermKick: - if oldConn, ok := ws.wsUserToConn[genMapKey(uid, platformID)]; ok { - log.NewDebug("", uid, platformID, "kick old conn") - ws.sendKickMsg(oldConn, newConn) - m, err := db.DB.GetTokenMapByUidPid(uid, constant.PlatformIDToName(platformID)) - if err != nil { - log.NewError("", "get token from redis err", err.Error()) - return - } - if m == nil { - log.NewError("", "get token from redis err", "m is nil") - return - } - for k, _ := range m { - if k != token { - m[k] = constant.KickedToken + if oldConnMap, ok := ws.wsUserToConn[uid]; ok { + if oldConn, ok := oldConnMap[constant.PlatformIDToName(platformID)]; ok { + log.NewDebug("", uid, platformID, "kick old conn") + ws.sendKickMsg(oldConn, newConn) + m, err := db.DB.GetTokenMapByUidPid(uid, constant.PlatformIDToName(platformID)) + if err != nil && err != redis.ErrNil { + log.NewError("", "get token from redis err", err.Error()) + return } + if m == nil { + log.NewError("", "get token from redis err", "m is nil") + return + } + for k, _ := range m { + if k != token { + m[k] = constant.KickedToken + } + } + log.NewDebug("get map is ", m) + err = db.DB.SetTokenMapByUidPid(uid, platformID, m) + if err != nil { + log.NewError("", "SetTokenMapByUidPid err", err.Error()) + return + } + err = oldConn.Close() + delete(oldConnMap, constant.PlatformIDToName(platformID)) + ws.wsUserToConn[uid] = oldConnMap + if len(oldConnMap) == 0 { + delete(ws.wsUserToConn, uid) + } + delete(ws.wsConnToUser, oldConn) + if err != nil { + log.NewError("", "conn close err", err.Error()) + } + } - log.NewDebug("get map is ", m) - err = db.DB.SetTokenMapByUidPid(uid, platformID, m) - if err != nil { - log.NewError("", "SetTokenMapByUidPid err", err.Error()) - return - } - err = oldConn.Close() - delete(ws.wsConnToUser, oldConn) - if err != nil { - log.NewError("", "conn close err", err.Error()) - } + } else { log.NewDebug("no other conn", ws.wsUserToConn) } @@ -149,53 +160,97 @@ func (ws *WServer) sendKickMsg(oldConn, newConn *UserConn) { } } func (ws *WServer) addUserConn(uid string, platformID int32, conn *UserConn, token string) { - key := genMapKey(uid, platformID) rwLock.Lock() defer rwLock.Unlock() ws.MultiTerminalLoginChecker(uid, platformID, conn, token) - ws.wsConnToUser[conn] = key - ws.wsUserToConn[key] = conn - log.WarnByKv("WS Add operation", "", "wsUser added", ws.wsUserToConn, "uid", uid, "online_num", len(ws.wsUserToConn)) + if oldConnMap, ok := ws.wsUserToConn[uid]; ok { + oldConnMap[constant.PlatformIDToName(platformID)] = conn + ws.wsUserToConn[uid] = oldConnMap + } else { + i := make(map[string]*UserConn) + i[constant.PlatformIDToName(platformID)] = conn + ws.wsUserToConn[uid] = i + } + if oldStringMap, ok := ws.wsConnToUser[conn]; ok { + oldStringMap[constant.PlatformIDToName(platformID)] = uid + ws.wsConnToUser[conn] = oldStringMap + } else { + i := make(map[string]string) + i[constant.PlatformIDToName(platformID)] = uid + ws.wsConnToUser[conn] = i + } + count := 0 + for _, v := range ws.wsUserToConn { + count = count + len(v) + } + log.WarnByKv("WS Add operation", "", "wsUser added", ws.wsUserToConn, "uid", uid, "online_user_num", len(ws.wsUserToConn), "online_conn_num", count) } func (ws *WServer) delUserConn(conn *UserConn) { rwLock.Lock() defer rwLock.Unlock() - var uidPlatform string - if uid, ok := ws.wsConnToUser[conn]; ok { - uidPlatform = uid - if _, ok = ws.wsUserToConn[uid]; ok { - delete(ws.wsUserToConn, uid) - log.WarnByKv("WS delete operation", "", "wsUser deleted", ws.wsUserToConn, "uid", uid, "online_num", len(ws.wsUserToConn)) + var platform, uid string + if oldStringMap, ok := ws.wsConnToUser[conn]; ok { + for k, v := range oldStringMap { + platform = k + uid = v + } + if oldConnMap, ok := ws.wsUserToConn[uid]; ok { + delete(oldConnMap, platform) + ws.wsUserToConn[uid] = oldConnMap + if len(oldConnMap) == 0 { + delete(ws.wsUserToConn, uid) + } + count := 0 + for _, v := range ws.wsUserToConn { + count = count + len(v) + } + log.WarnByKv("WS delete operation", "", "wsUser deleted", ws.wsUserToConn, "uid", uid, "online_user_num", len(ws.wsUserToConn), "online_conn_num", count) } else { - log.WarnByKv("uid not exist", "", "wsUser deleted", ws.wsUserToConn, "uid", uid, "online_num", len(ws.wsUserToConn)) + log.WarnByKv("WS delete operation", "", "wsUser deleted", ws.wsUserToConn, "uid", uid, "online_user_num", len(ws.wsUserToConn)) } delete(ws.wsConnToUser, conn) + } err := conn.Close() if err != nil { - log.ErrorByKv("close err", "", "uid", uidPlatform) + log.ErrorByKv("close err", "", "uid", uid, "platform", platform) + } } -func (ws *WServer) getUserConn(uid string) *UserConn { +func (ws *WServer) getUserConn(uid string, platform string) *UserConn { rwLock.RLock() defer rwLock.RUnlock() - if conn, ok := ws.wsUserToConn[uid]; ok { - return conn + if connMap, ok := ws.wsUserToConn[uid]; ok { + if conn, flag := connMap[platform]; flag { + return conn + } } return nil } -func (ws *WServer) getUserUid(conn *UserConn) string { +func (ws *WServer) getSingleUserAllConn(uid string) map[string]*UserConn { + rwLock.RLock() + defer rwLock.RUnlock() + if connMap, ok := ws.wsUserToConn[uid]; ok { + return connMap + } + return nil +} +func (ws *WServer) getUserUid(conn *UserConn) (uid, platform string) { rwLock.RLock() defer rwLock.RUnlock() - if uid, ok := ws.wsConnToUser[conn]; ok { - return uid + if stringMap, ok := ws.wsConnToUser[conn]; ok { + for k, v := range stringMap { + platform = k + uid = v + } + return uid, platform } - return "" + return "", "" } func (ws *WServer) headerCheck(w http.ResponseWriter, r *http.Request) bool { status := http.StatusUnauthorized diff --git a/internal/msg_transfer/logic/db.go b/internal/msg_transfer/logic/db.go index 3d6e0e3f6..bd1972386 100644 --- a/internal/msg_transfer/logic/db.go +++ b/internal/msg_transfer/logic/db.go @@ -8,16 +8,18 @@ import ( "Open_IM/pkg/utils" ) -func saveUserChat(uid string, pbMsg *pbMsg.MsgSvrToPushSvrChatMsg) error { +func saveUserChat(uid string, msg *pbMsg.MsgDataToMQ) error { time := utils.GetCurrentTimestampByMill() seq, err := db.DB.IncrUserSeq(uid) if err != nil { - log.NewError(pbMsg.OperationID, "data insert to redis err", err.Error(), pbMsg.String()) + log.NewError(msg.OperationID, "data insert to redis err", err.Error(), msg.String()) return err } - pbMsg.RecvSeq = seq - log.NewInfo(pbMsg.OperationID, "IncrUserSeq cost time", utils.GetCurrentTimestampByMill()-time) - return db.DB.SaveUserChat(uid, pbMsg.SendTime, pbMsg) + msg.MsgData.Seq = seq + pbSaveData := pbMsg.MsgDataToDB{} + pbSaveData.MsgData = msg.MsgData + log.NewInfo(msg.OperationID, "IncrUserSeq cost time", utils.GetCurrentTimestampByMill()-time) + return db.DB.SaveUserChat(uid, pbSaveData.MsgData.SendTime, &pbSaveData) } func getGroupList(groupID string) ([]string, error) { diff --git a/internal/msg_transfer/logic/history_msg_handler.go b/internal/msg_transfer/logic/history_msg_handler.go index 4b25bd9bc..01677cdb0 100644 --- a/internal/msg_transfer/logic/history_msg_handler.go +++ b/internal/msg_transfer/logic/history_msg_handler.go @@ -32,80 +32,60 @@ func (mc *HistoryConsumerHandler) Init() { } func (mc *HistoryConsumerHandler) handleChatWs2Mongo(msg []byte, msgKey string) { - log.InfoByKv("chat come mongo!!!", "", "chat", string(msg)) + log.InfoByKv("msg come mongo!!!", "", "msg", string(msg)) time := utils.GetCurrentTimestampByNano() - pbData := pbMsg.WSToMsgSvrChatMsg{} - err := proto.Unmarshal(msg, &pbData) + msgFromMQ := pbMsg.MsgDataToMQ{} + err := proto.Unmarshal(msg, &msgFromMQ) if err != nil { - log.ErrorByKv("msg_transfer Unmarshal chat err", "", "chat", string(msg), "err", err.Error()) + log.ErrorByKv("msg_transfer Unmarshal msg err", "", "msg", string(msg), "err", err.Error()) return } - 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) + operationID := msgFromMQ.OperationID //Control whether to store offline messages (mongo) - isHistory := utils.GetSwitchFromOptions(options, "history") + isHistory := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsHistory) //Control whether to store history messages (mysql) - isPersist := utils.GetSwitchFromOptions(options, "persistent") - switch pbData.SessionType { + isPersist := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsPersistent) + switch msgFromMQ.MsgData.SessionType { case constant.SingleChatType: - log.NewDebug(pbSaveData.OperationID, "msg_transfer chat type = SingleChatType", isHistory, isPersist) + log.NewDebug(msgFromMQ.OperationID, "msg_transfer msg type = SingleChatType", isHistory, isPersist) if isHistory { - if msgKey == pbSaveData.RecvID { - err := saveUserChat(pbData.RecvID, &pbSaveData) + if msgKey == msgFromMQ.MsgData.RecvID { + err := saveUserChat(msgFromMQ.MsgData.RecvID, &msgFromMQ) if err != nil { - log.NewError(pbSaveData.OperationID, "single data insert to mongo err", err.Error(), pbSaveData.String()) + log.NewError(operationID, "single data insert to mongo err", err.Error(), msgFromMQ.String()) return } - } else if msgKey == pbSaveData.SendID { - err := saveUserChat(pbData.SendID, &pbSaveData) + } else if msgKey == msgFromMQ.MsgData.SendID { + err := saveUserChat(msgFromMQ.MsgData.SendID, &msgFromMQ) if err != nil { - log.NewError(pbSaveData.OperationID, "single data insert to mongo err", err.Error(), pbSaveData.String()) + log.NewError(operationID, "single data insert to mongo err", err.Error(), msgFromMQ.String()) return } - } - log.NewDebug(pbSaveData.OperationID, "saveUserChat cost time ", utils.GetCurrentTimestampByNano()-time) + log.NewDebug(operationID, "saveUserChat cost time ", utils.GetCurrentTimestampByNano()-time) } - if msgKey == pbSaveData.RecvID { - pbSaveData.Options = pbData.Options - pbSaveData.OfflineInfo = pbData.OfflineInfo - go sendMessageToPush(&pbSaveData) - log.NewDebug(pbSaveData.OperationID, "sendMessageToPush cost time ", utils.GetCurrentTimestampByNano()-time) + if msgKey == msgFromMQ.MsgData.RecvID { + go sendMessageToPush(&msgFromMQ) + log.NewDebug(msgFromMQ.OperationID, "sendMessageToPush cost time ", utils.GetCurrentTimestampByNano()-time) } case constant.GroupChatType: - log.NewDebug(pbSaveData.OperationID, "msg_transfer chat type = GroupChatType", isHistory, isPersist) + log.NewDebug(msgFromMQ.OperationID, "msg_transfer msg type = GroupChatType", isHistory, isPersist) if isHistory { - uidAndGroupID := strings.Split(pbData.RecvID, " ") - err := saveUserChat(uidAndGroupID[0], &pbSaveData) + err := saveUserChat(msgFromMQ.MsgData.RecvID, &msgFromMQ) if err != nil { - log.NewError(pbSaveData.OperationID, "group data insert to mongo err", pbSaveData.String(), uidAndGroupID[0], err.Error()) + log.NewError(operationID, "group data insert to mongo err", msgFromMQ.String(), msgFromMQ.MsgData.RecvID, err.Error()) return } } - pbSaveData.Options = pbData.Options - pbSaveData.OfflineInfo = pbData.OfflineInfo - go sendMessageToPush(&pbSaveData) + go sendMessageToPush(&msgFromMQ) default: - log.NewError(pbSaveData.OperationID, "SessionType error", pbSaveData.String()) + log.NewError(msgFromMQ.OperationID, "SessionType error", msgFromMQ.String()) return } - log.NewDebug(pbSaveData.OperationID, "msg_transfer handle topic data to database success...", pbSaveData.String()) + log.NewDebug(msgFromMQ.OperationID, "msg_transfer handle topic data to database success...", msgFromMQ.String()) } func (HistoryConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil } @@ -113,50 +93,35 @@ func (HistoryConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { ret func (mc *HistoryConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error { for msg := range claim.Messages() { - log.InfoByKv("kafka get info to mongo", "", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "chat", string(msg.Value)) + log.InfoByKv("kafka get info to mongo", "", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value)) mc.msgHandle[msg.Topic](msg.Value, string(msg.Key)) sess.MarkMessage(msg, "") } return nil } -func sendMessageToPush(message *pbMsg.MsgSvrToPushSvrChatMsg) { +func sendMessageToPush(message *pbMsg.MsgDataToMQ) { log.InfoByKv("msg_transfer send message to push", message.OperationID, "message", message.String()) - msg := pbPush.PushMsgReq{} - msg.OperationID = message.OperationID - msg.PlatformID = message.PlatformID - msg.Content = message.Content - msg.ContentType = message.ContentType - msg.SessionType = message.SessionType - msg.RecvID = message.RecvID - msg.SendID = message.SendID - msg.SenderNickName = message.SenderNickName - msg.SenderFaceURL = message.SenderFaceURL - msg.ClientMsgID = message.ClientMsgID - msg.MsgFrom = message.MsgFrom - msg.Options = message.Options - msg.RecvSeq = message.RecvSeq - msg.SendTime = message.SendTime - msg.MsgID = message.MsgID - msg.OfflineInfo = message.OfflineInfo + rpcPushMsg := pbPush.PushMsgReq{OperationID: message.OperationID, MsgData: message.MsgData} + mqPushMsg := pbMsg.PushMsgDataToMQ{OperationID: message.OperationID, MsgData: message.MsgData} grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImPushName) if grpcConn == nil { - log.ErrorByKv("rpc dial failed", msg.OperationID, "push data", msg.String()) - pid, offset, err := producer.SendMessage(message) + log.ErrorByKv("rpc dial failed", rpcPushMsg.OperationID, "push data", rpcPushMsg.String()) + pid, offset, err := producer.SendMessage(&mqPushMsg) if err != nil { - log.ErrorByKv("kafka send failed", msg.OperationID, "send data", message.String(), "pid", pid, "offset", offset, "err", err.Error()) + log.ErrorByKv("kafka send failed", mqPushMsg.OperationID, "send data", message.String(), "pid", pid, "offset", offset, "err", err.Error()) } return } msgClient := pbPush.NewPushMsgServiceClient(grpcConn) - _, err := msgClient.PushMsg(context.Background(), &msg) + _, err := msgClient.PushMsg(context.Background(), &rpcPushMsg) if err != nil { - log.ErrorByKv("rpc send failed", msg.OperationID, "push data", msg.String(), "err", err.Error()) - pid, offset, err := producer.SendMessage(message) + log.ErrorByKv("rpc send failed", rpcPushMsg.OperationID, "push data", rpcPushMsg.String(), "err", err.Error()) + pid, offset, err := producer.SendMessage(&mqPushMsg) if err != nil { - log.ErrorByKv("kafka send failed", msg.OperationID, "send data", message.String(), "pid", pid, "offset", offset, "err", err.Error()) + log.ErrorByKv("kafka send failed", mqPushMsg.OperationID, "send data", mqPushMsg.String(), "pid", pid, "offset", offset, "err", err.Error()) } } else { - log.InfoByKv("rpc send success", msg.OperationID, "push data", msg.String()) + log.InfoByKv("rpc send success", rpcPushMsg.OperationID, "push data", rpcPushMsg.String()) } } diff --git a/internal/msg_transfer/logic/persistent_msg_handler.go b/internal/msg_transfer/logic/persistent_msg_handler.go index 2a13bb4a2..c90901212 100644 --- a/internal/msg_transfer/logic/persistent_msg_handler.go +++ b/internal/msg_transfer/logic/persistent_msg_handler.go @@ -16,7 +16,6 @@ import ( "Open_IM/pkg/utils" "github.com/Shopify/sarama" "github.com/golang/protobuf/proto" - "strings" ) type PersistentConsumerHandler struct { @@ -32,30 +31,29 @@ func (pc *PersistentConsumerHandler) Init() { config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.ConsumerGroupID.MsgToMySql) } + func (pc *PersistentConsumerHandler) handleChatWs2Mysql(msg []byte, msgKey string) { - log.InfoByKv("chat come here mysql!!!", "", "chat", string(msg)) - pbData := pbMsg.WSToMsgSvrChatMsg{} - err := proto.Unmarshal(msg, &pbData) + log.InfoByKv("msg come here mysql!!!", "", "msg", string(msg)) + msgFromMQ := pbMsg.MsgDataToMQ{} + err := proto.Unmarshal(msg, &msgFromMQ) if err != nil { - log.ErrorByKv("msg_transfer Unmarshal chat err", "", "chat", string(msg), "err", err.Error()) + log.ErrorByKv("msg_transfer Unmarshal msg err", "", "msg", string(msg), "err", err.Error()) return } - options := utils.JsonStringToMap(pbData.Options) //Control whether to store history messages (mysql) - isPersist := utils.GetSwitchFromOptions(options, "persistent") + isPersist := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsPersistent) //Only process receiver data if isPersist { - if msgKey == pbData.RecvID && pbData.SessionType == constant.SingleChatType { - log.InfoByKv("msg_transfer chat persisting", pbData.OperationID) - if err = im_mysql_msg_model.InsertMessageToChatLog(pbData); err != nil { - log.ErrorByKv("Message insert failed", pbData.OperationID, "err", err.Error(), "chat", pbData.String()) + if msgKey == msgFromMQ.MsgData.RecvID && msgFromMQ.MsgData.SessionType == constant.SingleChatType { + log.InfoByKv("msg_transfer msg persisting", msgFromMQ.OperationID) + if err = im_mysql_msg_model.InsertMessageToChatLog(msgFromMQ); err != nil { + log.ErrorByKv("Message insert failed", msgFromMQ.OperationID, "err", err.Error(), "msg", msgFromMQ.String()) return } - } else if pbData.SessionType == constant.GroupChatType && msgKey == "0" { - pbData.RecvID = strings.Split(pbData.RecvID, " ")[1] - log.InfoByKv("msg_transfer chat persisting", pbData.OperationID) - if err = im_mysql_msg_model.InsertMessageToChatLog(pbData); err != nil { - log.ErrorByKv("Message insert failed", pbData.OperationID, "err", err.Error(), "chat", pbData.String()) + } else if msgFromMQ.MsgData.SessionType == constant.GroupChatType && msgKey == msgFromMQ.MsgData.SendID { + log.InfoByKv("msg_transfer msg persisting", msgFromMQ.OperationID) + if err = im_mysql_msg_model.InsertMessageToChatLog(msgFromMQ); err != nil { + log.ErrorByKv("Message insert failed", msgFromMQ.OperationID, "err", err.Error(), "msg", msgFromMQ.String()) return } } @@ -67,7 +65,7 @@ func (PersistentConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { func (pc *PersistentConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error { for msg := range claim.Messages() { - log.InfoByKv("kafka get info to mysql", "", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "chat", string(msg.Value)) + log.InfoByKv("kafka get info to mysql", "", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value)) pc.msgHandle[msg.Topic](msg.Value, string(msg.Key)) sess.MarkMessage(msg, "") } diff --git a/internal/push/logic/push_handler.go b/internal/push/logic/push_handler.go index 5058ce26d..294c48f15 100644 --- a/internal/push/logic/push_handler.go +++ b/internal/push/logic/push_handler.go @@ -11,8 +11,7 @@ import ( kfk "Open_IM/pkg/common/kafka" "Open_IM/pkg/common/log" pbChat "Open_IM/pkg/proto/chat" - pbRelay "Open_IM/pkg/proto/relay" - "Open_IM/pkg/utils" + pbPush "Open_IM/pkg/proto/push" "github.com/Shopify/sarama" "github.com/golang/protobuf/proto" ) @@ -33,28 +32,13 @@ func (ms *PushConsumerHandler) Init() { } func (ms *PushConsumerHandler) handleMs2PsChat(msg []byte) { log.InfoByKv("msg come from kafka And push!!!", "", "msg", string(msg)) - pbData := pbChat.MsgSvrToPushSvrChatMsg{} - if err := proto.Unmarshal(msg, &pbData); err != nil { + msgFromMQ := pbChat.PushMsgDataToMQ{} + if err := proto.Unmarshal(msg, &msgFromMQ); err != nil { log.ErrorByKv("push Unmarshal msg err", "", "msg", string(msg), "err", err.Error()) return } - sendPbData := pbRelay.MsgToUserReq{} - sendPbData.SendTime = pbData.SendTime - sendPbData.OperationID = pbData.OperationID - sendPbData.ServerMsgID = pbData.MsgID - sendPbData.MsgFrom = pbData.MsgFrom - sendPbData.ContentType = pbData.ContentType - sendPbData.SessionType = pbData.SessionType - 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 //Call push module to send message to the user - MsgToUser(&sendPbData, pbData.OfflineInfo, utils.JsonStringToMap(pbData.Options)) + MsgToUser((*pbPush.PushMsgReq)(&msgFromMQ)) } func (PushConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil } func (PushConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil } diff --git a/internal/push/logic/push_rpc_server.go b/internal/push/logic/push_rpc_server.go index 570f5c28b..b622ba721 100644 --- a/internal/push/logic/push_rpc_server.go +++ b/internal/push/logic/push_rpc_server.go @@ -5,7 +5,6 @@ import ( "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/proto/push" - pbRelay "Open_IM/pkg/proto/relay" "Open_IM/pkg/utils" "context" "google.golang.org/grpc" @@ -49,23 +48,8 @@ func (r *RPCServer) run() { } } func (r *RPCServer) PushMsg(_ context.Context, pbData *pbPush.PushMsgReq) (*pbPush.PushMsgResp, error) { - sendPbData := pbRelay.MsgToUserReq{} - sendPbData.SendTime = pbData.SendTime - sendPbData.OperationID = pbData.OperationID - 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 //Call push module to send message to the user - MsgToUser(&sendPbData, pbData.OfflineInfo, utils.JsonStringToMap(pbData.Options)) + MsgToUser(pbData) return &pbPush.PushMsgResp{ ResultCode: 0, }, nil diff --git a/internal/push/logic/push_to_client.go b/internal/push/logic/push_to_client.go index b7c8c94af..e7cbf20e0 100644 --- a/internal/push/logic/push_to_client.go +++ b/internal/push/logic/push_to_client.go @@ -8,13 +8,11 @@ package logic import ( push "Open_IM/internal/push/jpush" - rpcChat "Open_IM/internal/rpc/chat" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" - pbChat "Open_IM/pkg/proto/chat" - pbGroup "Open_IM/pkg/proto/group" + pbPush "Open_IM/pkg/proto/push" pbRelay "Open_IM/pkg/proto/relay" "Open_IM/pkg/utils" "context" @@ -34,122 +32,119 @@ type AtContent struct { IsAtSelf bool `json:"isAtSelf"` } -func MsgToUser(sendPbData *pbRelay.MsgToUserReq, OfflineInfo string, Options map[string]int32) { +func MsgToUser(pushMsg *pbPush.PushMsgReq) { var wsResult []*pbRelay.SingleMsgToUser - isOfflinePush := utils.GetSwitchFromOptions(Options, "offlinePush") - log.InfoByKv("Get chat from msg_transfer And push chat", sendPbData.OperationID, "PushData", sendPbData, Options, isOfflinePush) + isOfflinePush := utils.GetSwitchFromOptions(pushMsg.MsgData.Options, constant.IsOfflinePush) + log.InfoByKv("Get msg from msg_transfer And push msg", pushMsg.OperationID, "PushData", pushMsg.String()) grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName) //Online push message - log.InfoByKv("test", sendPbData.OperationID, "len grpc", len(grpcCons), "data", sendPbData) + log.InfoByKv("test", pushMsg.OperationID, "len grpc", len(grpcCons), "data", pushMsg.String()) for _, v := range grpcCons { msgClient := pbRelay.NewOnlineMessageRelayServiceClient(v) - reply, err := msgClient.MsgToUser(context.Background(), sendPbData) + reply, err := msgClient.OnlinePushMsg(context.Background(), &pbRelay.OnlinePushMsgReq{OperationID: pushMsg.OperationID, MsgData: pushMsg.MsgData}) if err != nil { - log.InfoByKv("push data to client rpc err", sendPbData.OperationID, "err", err) + log.InfoByKv("push data to client rpc err", pushMsg.OperationID, "err", err) continue } if reply != nil && reply.Resp != nil { wsResult = append(wsResult, reply.Resp...) } } - log.InfoByKv("push_result", sendPbData.OperationID, "result", wsResult, "sendData", sendPbData) - if sendPbData.ContentType != constant.Typing && sendPbData.ContentType != constant.HasReadReceipt { - if isOfflinePush { - for _, v := range wsResult { - if v.ResultCode == 0 { - continue - } - //supported terminal - for _, t := range pushTerminal { - if v.RecvPlatFormID == t { - //Use offline push messaging - var UIDList []string - UIDList = append(UIDList, v.RecvID) - customContent := OpenIMContent{ - SessionType: int(sendPbData.SessionType), - From: sendPbData.SendID, - To: sendPbData.RecvID, - Seq: sendPbData.RecvSeq, - } - bCustomContent, _ := json.Marshal(customContent) - jsonCustomContent := string(bCustomContent) - var content string - switch sendPbData.ContentType { - case constant.Text: - content = constant.ContentType2PushContent[constant.Text] - case constant.Picture: - content = constant.ContentType2PushContent[constant.Picture] - case constant.Voice: - content = constant.ContentType2PushContent[constant.Voice] - case constant.Video: - content = constant.ContentType2PushContent[constant.Video] - case constant.File: - content = constant.ContentType2PushContent[constant.File] - case constant.AtText: - a := AtContent{} - _ = utils.JsonStringToStruct(sendPbData.Content, &a) - if utils.IsContain(v.RecvID, a.AtUserList) { - content = constant.ContentType2PushContent[constant.AtText] + constant.ContentType2PushContent[constant.Common] - } else { - content = constant.ContentType2PushContent[constant.GroupMsg] - } - default: - content = constant.ContentType2PushContent[constant.Common] - } - pushResult, err := push.JGAccountListPush(UIDList, content, jsonCustomContent, constant.PlatformIDToName(t)) - if err != nil { - log.NewError(sendPbData.OperationID, "offline push error", sendPbData.String(), err.Error(), constant.PlatformIDToName(t)) - } else { - log.NewDebug(sendPbData.OperationID, "offline push return result is ", string(pushResult), sendPbData, constant.PlatformIDToName(t)) - } - + log.InfoByKv("push_result", pushMsg.OperationID, "result", wsResult, "sendData", pushMsg.MsgData) + if isOfflinePush { + for _, v := range wsResult { + if v.ResultCode == 0 { + continue + } + //supported terminal + for _, t := range pushTerminal { + if v.RecvPlatFormID == t { + //Use offline push messaging + var UIDList []string + UIDList = append(UIDList, v.RecvID) + customContent := OpenIMContent{ + SessionType: int(pushMsg.MsgData.SessionType), + From: pushMsg.MsgData.SendID, + To: pushMsg.MsgData.RecvID, + Seq: pushMsg.MsgData.Seq, } + bCustomContent, _ := json.Marshal(customContent) + jsonCustomContent := string(bCustomContent) + var content string + switch pushMsg.MsgData.ContentType { + case constant.Text: + content = constant.ContentType2PushContent[constant.Text] + case constant.Picture: + content = constant.ContentType2PushContent[constant.Picture] + case constant.Voice: + content = constant.ContentType2PushContent[constant.Voice] + case constant.Video: + content = constant.ContentType2PushContent[constant.Video] + case constant.File: + content = constant.ContentType2PushContent[constant.File] + case constant.AtText: + a := AtContent{} + _ = utils.JsonStringToStruct(string(pushMsg.MsgData.Content), &a) + if utils.IsContain(v.RecvID, a.AtUserList) { + content = constant.ContentType2PushContent[constant.AtText] + constant.ContentType2PushContent[constant.Common] + } else { + content = constant.ContentType2PushContent[constant.GroupMsg] + } + default: + content = constant.ContentType2PushContent[constant.Common] + } + pushResult, err := push.JGAccountListPush(UIDList, content, jsonCustomContent, constant.PlatformIDToName(t)) + if err != nil { + log.NewError(pushMsg.OperationID, "offline push error", pushMsg.String(), err.Error(), constant.PlatformIDToName(t)) + } else { + log.NewDebug(pushMsg.OperationID, "offline push return result is ", string(pushResult), pushMsg.MsgData, constant.PlatformIDToName(t)) + } + } } - } - } - -} - -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") - sendMsgToKafka(m, m.RecvID, "msgKey--recvID") - case constant.GroupChatType: - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) - client := pbGroup.NewGroupClient(etcdConn) - req := &pbGroup.GetGroupAllMemberReq{ - GroupID: m.RecvID, - Token: config.Config.Secret, - OperationID: m.OperationID, - } - reply, err := client.GetGroupAllMember(context.Background(), req) - if err != nil { - log.Error(m.Token, m.OperationID, "rpc getGroupInfo failed, err = %s", err.Error()) - return - } - if reply.ErrorCode != 0 { - log.Error(m.Token, m.OperationID, "rpc getGroupInfo failed, err = %s", reply.ErrorMsg) - return - } - groupID := m.RecvID - for i, v := range reply.MemberList { - m.RecvID = v.UserId + " " + groupID - sendMsgToKafka(m, utils.IntToString(i), "msgKey--recvID+\" \"+groupID") - } - default: } } -func sendMsgToKafka(m *pbChat.WSToMsgSvrChatMsg, key string, flag string) { - pid, offset, err := producer.SendMessage(m, key) - if err != nil { - log.ErrorByKv("kafka send failed", m.OperationID, "send data", m.String(), "pid", pid, "offset", offset, "err", err.Error(), flag, key) - } - -} +//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") +// sendMsgToKafka(m, m.RecvID, "msgKey--recvID") +// case constant.GroupChatType: +// etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) +// client := pbGroup.NewGroupClient(etcdConn) +// req := &pbGroup.GetGroupAllMemberReq{ +// GroupID: m.RecvID, +// Token: config.Config.Secret, +// OperationID: m.OperationID, +// } +// reply, err := client.GetGroupAllMember(context.Background(), req) +// if err != nil { +// log.Error(m.Token, m.OperationID, "rpc getGroupInfo failed, err = %s", err.Error()) +// return +// } +// if reply.ErrorCode != 0 { +// log.Error(m.Token, m.OperationID, "rpc getGroupInfo failed, err = %s", reply.ErrorMsg) +// return +// } +// groupID := m.RecvID +// for i, v := range reply.MemberList { +// m.RecvID = v.UserId + " " + groupID +// sendMsgToKafka(m, utils.IntToString(i), "msgKey--recvID+\" \"+groupID") +// } +// default: +// +// } +//} +// +//func sendMsgToKafka(m *pbChat.WSToMsgSvrChatMsg, key string, flag string) { +// pid, offset, err := producer.SendMessage(m, key) +// if err != nil { +// log.ErrorByKv("kafka send failed", m.OperationID, "send data", m.String(), "pid", pid, "offset", offset, "err", err.Error(), flag, key) +// } +// +//} diff --git a/internal/rpc/chat/pull_message.go b/internal/rpc/msg/pull_message.go similarity index 81% rename from internal/rpc/chat/pull_message.go rename to internal/rpc/msg/pull_message.go index 725725037..dab729984 100644 --- a/internal/rpc/chat/pull_message.go +++ b/internal/rpc/msg/pull_message.go @@ -1,4 +1,4 @@ -package chat +package msg import ( "context" @@ -6,7 +6,7 @@ import ( commonDB "Open_IM/pkg/common/db" "Open_IM/pkg/common/log" - + "Open_IM/pkg/proto/sdk_ws" "sort" "strings" @@ -44,8 +44,8 @@ func (rpc *rpcChat) GetMaxAndMinSeq(_ context.Context, in *pbMsg.GetMaxAndMinSeq 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) - var respSingleMsgFormat []*pbMsg.GatherFormat - var respGroupMsgFormat []*pbMsg.GatherFormat + var respSingleMsgFormat []*open_im_sdk.GatherFormat + var respGroupMsgFormat []*open_im_sdk.GatherFormat SingleMsgFormat, GroupMsgFormat, MaxSeq, MinSeq, err := commonDB.DB.GetMsgBySeqRange(in.UserID, in.SeqBegin, in.SeqEnd) if err != nil { log.ErrorByKv("pullMsg data error", in.OperationID, in.String()) @@ -60,15 +60,15 @@ func (rpc *rpcChat) PullMessage(_ context.Context, in *pbMsg.PullMessageReq) (*p ErrMsg: "", MaxSeq: MaxSeq, MinSeq: MinSeq, - SingleUserMsg: respSingleMsgFormat, + SingleUserMsg: []*pbMsg.GatherFormat(respSingleMsgFormat), GroupUserMsg: respGroupMsgFormat, }, nil } -func (rpc *rpcChat) PullMessageBySeqList(_ context.Context, in *pbMsg.PullMessageBySeqListReq) (*pbMsg.PullMessageResp, error) { +func (rpc *rpcChat) PullMessageBySeqList(_ context.Context, in *open_im_sdk.PullMessageBySeqListReq) (*open_im_sdk.PullMessageBySeqListResp, error) { log.NewInfo(in.OperationID, "rpc PullMessageBySeqList is arriving", in.String()) - resp := new(pbMsg.PullMessageResp) - var respSingleMsgFormat []*pbMsg.GatherFormat - var respGroupMsgFormat []*pbMsg.GatherFormat + resp := new(open_im_sdk.PullMessageBySeqListResp) + var respSingleMsgFormat []*open_im_sdk.GatherFormat + var respGroupMsgFormat []*open_im_sdk.GatherFormat SingleMsgFormat, GroupMsgFormat, MaxSeq, MinSeq, err := commonDB.DB.GetMsgBySeqList(in.UserID, in.SeqList) if err != nil { log.ErrorByKv("PullMessageBySeqList data error", in.OperationID, in.String()) @@ -78,7 +78,7 @@ func (rpc *rpcChat) PullMessageBySeqList(_ context.Context, in *pbMsg.PullMessag } respSingleMsgFormat = singleMsgHandleByUser(SingleMsgFormat, in.UserID) respGroupMsgFormat = groupMsgHandleByUser(GroupMsgFormat) - return &pbMsg.PullMessageResp{ + return &open_im_sdk.PullMessageBySeqListResp{ ErrCode: 0, ErrMsg: "", MaxSeq: MaxSeq, @@ -87,9 +87,9 @@ func (rpc *rpcChat) PullMessageBySeqList(_ context.Context, in *pbMsg.PullMessag GroupUserMsg: respGroupMsgFormat, }, nil } -func singleMsgHandleByUser(allMsg []*pbMsg.MsgFormat, ownerId string) []*pbMsg.GatherFormat { +func singleMsgHandleByUser(allMsg []*open_im_sdk.MsgData, ownerId string) []*open_im_sdk.GatherFormat { var userid string - var respMsgFormat []*pbMsg.GatherFormat + var respMsgFormat []*open_im_sdk.GatherFormat m := make(map[string]MsgFormats) //Gather messages in the dimension of users for _, v := range allMsg { @@ -107,7 +107,7 @@ func singleMsgHandleByUser(allMsg []*pbMsg.MsgFormat, ownerId string) []*pbMsg.G } //Return in pb format for user, msg := range m { - tempUserMsg := new(pbMsg.GatherFormat) + tempUserMsg := new(open_im_sdk.GatherFormat) tempUserMsg.ID = user tempUserMsg.List = msg sort.Sort(msg) @@ -115,8 +115,8 @@ func singleMsgHandleByUser(allMsg []*pbMsg.MsgFormat, ownerId string) []*pbMsg.G } return respMsgFormat } -func groupMsgHandleByUser(allMsg []*pbMsg.MsgFormat) []*pbMsg.GatherFormat { - var respMsgFormat []*pbMsg.GatherFormat +func groupMsgHandleByUser(allMsg []*open_im_sdk.MsgData) []*open_im_sdk.GatherFormat { + var respMsgFormat []*open_im_sdk.GatherFormat m := make(map[string]MsgFormats) //Gather messages in the dimension of users for _, v := range allMsg { @@ -132,7 +132,7 @@ func groupMsgHandleByUser(allMsg []*pbMsg.MsgFormat) []*pbMsg.GatherFormat { } //Return in pb format for groupID, msg := range m { - tempUserMsg := new(pbMsg.GatherFormat) + tempUserMsg := new(open_im_sdk.GatherFormat) tempUserMsg.ID = groupID tempUserMsg.List = msg sort.Sort(msg) @@ -141,7 +141,7 @@ func groupMsgHandleByUser(allMsg []*pbMsg.MsgFormat) []*pbMsg.GatherFormat { return respMsgFormat } -type MsgFormats []*pbMsg.MsgFormat +type MsgFormats []*open_im_sdk.MsgData // Implement the sort.Interface interface to get the number of elements method func (s MsgFormats) Len() int { diff --git a/internal/rpc/chat/rpcChat.go b/internal/rpc/msg/rpcChat.go similarity index 99% rename from internal/rpc/chat/rpcChat.go rename to internal/rpc/msg/rpcChat.go index e3d2460dd..43113ae51 100644 --- a/internal/rpc/chat/rpcChat.go +++ b/internal/rpc/msg/rpcChat.go @@ -1,4 +1,4 @@ -package chat +package msg import ( "Open_IM/pkg/common/config" diff --git a/pkg/common/db/mongoModel.go b/pkg/common/db/mongoModel.go index 4137616ea..99da02b0b 100644 --- a/pkg/common/db/mongoModel.go +++ b/pkg/common/db/mongoModel.go @@ -5,6 +5,7 @@ import ( "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" pbMsg "Open_IM/pkg/proto/chat" + "Open_IM/pkg/proto/sdk_ws" "errors" "github.com/garyburd/redigo/redis" "github.com/golang/protobuf/proto" @@ -13,7 +14,7 @@ import ( "time" ) -const cChat = "chat" +const cChat = "msg" const cGroup = "group" const singleGocMsgNum = 5000 @@ -32,7 +33,7 @@ type GroupMember struct { UIDList []string } -func (d *DataBases) GetMsgBySeqRange(uid string, seqBegin, seqEnd int64) (SingleMsg []*pbMsg.MsgFormat, GroupMsg []*pbMsg.MsgFormat, MaxSeq int64, MinSeq int64, err error) { +func (d *DataBases) GetMsgBySeqRange(uid string, seqBegin, seqEnd int64) (SingleMsg []*open_im_sdk.MsgData, GroupMsg []*open_im_sdk.MsgData, MaxSeq int64, MinSeq int64, err error) { var count int64 session := d.mgoSession.Clone() if session == nil { @@ -46,38 +47,25 @@ func (d *DataBases) GetMsgBySeqRange(uid string, seqBegin, seqEnd int64) (Single if err = c.Find(bson.M{"uid": uid}).One(&sChat); err != nil { return nil, nil, MaxSeq, MinSeq, err } - pChat := pbMsg.MsgSvrToPushSvrChatMsg{} for i := 0; i < len(sChat.Msg); i++ { - temp := new(pbMsg.MsgFormat) - if err = proto.Unmarshal(sChat.Msg[i].Msg, &pChat); err != nil { + msg := new(open_im_sdk.MsgData) + if err = proto.Unmarshal(sChat.Msg[i].Msg, msg); err != nil { return nil, nil, MaxSeq, MinSeq, err } - if pChat.RecvSeq >= seqBegin && pChat.RecvSeq <= seqEnd { - temp.SendID = pChat.SendID - temp.RecvID = pChat.RecvID - temp.MsgFrom = pChat.MsgFrom - temp.Seq = pChat.RecvSeq - temp.ServerMsgID = pChat.MsgID - temp.SendTime = pChat.SendTime - 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 + if msg.Seq >= seqBegin && msg.Seq <= seqEnd { + if msg.Seq > MaxSeq { + MaxSeq = msg.Seq } if count == 0 { - MinSeq = pChat.RecvSeq + MinSeq = msg.Seq } - if pChat.RecvSeq < MinSeq { - MinSeq = pChat.RecvSeq + if msg.Seq < MinSeq { + MinSeq = msg.Seq } - if pChat.SessionType == constant.SingleChatType { - SingleMsg = append(SingleMsg, temp) + if msg.SessionType == constant.SingleChatType { + SingleMsg = append(SingleMsg, msg) } else { - GroupMsg = append(GroupMsg, temp) + GroupMsg = append(GroupMsg, msg) } count++ if count == (seqEnd - seqBegin + 1) { @@ -116,7 +104,7 @@ func (d *DataBases) GetMinSeqFromMongo(uid string) (MinSeq int64, err error) { } return MinSeq, nil } -func (d *DataBases) GetMsgBySeqList(uid string, seqList []int64) (SingleMsg []*pbMsg.MsgFormat, GroupMsg []*pbMsg.MsgFormat, MaxSeq int64, MinSeq int64, err error) { +func (d *DataBases) GetMsgBySeqList(uid string, seqList []int64) (SingleMsg []*open_im_sdk.MsgData, GroupMsg []*open_im_sdk.MsgData, MaxSeq int64, MinSeq int64, err error) { allCount := 0 singleCount := 0 session := d.mgoSession.Clone() @@ -140,7 +128,6 @@ func (d *DataBases) GetMsgBySeqList(uid string, seqList []int64) (SingleMsg []*p return t }(uid, seqList) sChat := UserChat{} - pChat := pbMsg.MsgSvrToPushSvrChatMsg{} for seqUid, value := range m { if err = c.Find(bson.M{"uid": seqUid}).One(&sChat); err != nil { log.NewError("", "not find seqUid", seqUid, value, uid, seqList) @@ -148,37 +135,25 @@ func (d *DataBases) GetMsgBySeqList(uid string, seqList []int64) (SingleMsg []*p } singleCount = 0 for i := 0; i < len(sChat.Msg); i++ { - temp := new(pbMsg.MsgFormat) - if err = proto.Unmarshal(sChat.Msg[i].Msg, &pChat); err != nil { + msg := new(open_im_sdk.MsgData) + if err = proto.Unmarshal(sChat.Msg[i].Msg, msg); err != nil { log.NewError("", "not find seqUid", seqUid, value, uid, seqList) return nil, nil, MaxSeq, MinSeq, err } - if isContainInt64(pChat.RecvSeq, value) { - temp.SendID = pChat.SendID - temp.RecvID = pChat.RecvID - temp.MsgFrom = pChat.MsgFrom - temp.Seq = pChat.RecvSeq - temp.ServerMsgID = pChat.MsgID - temp.SendTime = pChat.SendTime - 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 + if isContainInt64(msg.Seq, value) { + if msg.Seq > MaxSeq { + MaxSeq = msg.Seq } if allCount == 0 { - MinSeq = pChat.RecvSeq + MinSeq = msg.Seq } - if pChat.RecvSeq < MinSeq { - MinSeq = pChat.RecvSeq + if msg.Seq < MinSeq { + MinSeq = msg.Seq } - if pChat.SessionType == constant.SingleChatType { - SingleMsg = append(SingleMsg, temp) + if msg.SessionType == constant.SingleChatType { + SingleMsg = append(SingleMsg, msg) } else { - GroupMsg = append(GroupMsg, temp) + GroupMsg = append(GroupMsg, msg) } allCount++ singleCount++ @@ -190,7 +165,7 @@ func (d *DataBases) GetMsgBySeqList(uid string, seqList []int64) (SingleMsg []*p } return SingleMsg, GroupMsg, MaxSeq, MinSeq, nil } -func (d *DataBases) SaveUserChat(uid string, sendTime int64, m *pbMsg.MsgSvrToPushSvrChatMsg) error { +func (d *DataBases) SaveUserChat(uid string, sendTime int64, m *pbMsg.MsgDataToDB) error { var seqUid string newTime := getCurrentTimestampByMill() session := d.mgoSession.Clone() @@ -200,7 +175,7 @@ func (d *DataBases) SaveUserChat(uid string, sendTime int64, m *pbMsg.MsgSvrToPu defer session.Close() log.NewDebug("", "get mgoSession cost time", getCurrentTimestampByMill()-newTime) c := session.DB(config.Config.Mongo.DBDatabase).C(cChat) - seqUid = getSeqUid(uid, m.RecvSeq) + seqUid = getSeqUid(uid, m.MsgData.Seq) n, err := c.Find(bson.M{"uid": seqUid}).Count() if err != nil { return err diff --git a/pkg/common/db/mysql_model/im_mysql_msg_model/chat_log_model.go b/pkg/common/db/mysql_model/im_mysql_msg_model/chat_log_model.go index 73defd89d..5a80e6bb2 100644 --- a/pkg/common/db/mysql_model/im_mysql_msg_model/chat_log_model.go +++ b/pkg/common/db/mysql_model/im_mysql_msg_model/chat_log_model.go @@ -7,6 +7,7 @@ package im_mysql_msg_model import ( + "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db" pbMsg "Open_IM/pkg/proto/chat" "Open_IM/pkg/utils" @@ -28,21 +29,27 @@ type ChatLog struct { Remark sql.NullString `gorm:"column:remark"` // remark } -func InsertMessageToChatLog(msgData pbMsg.WSToMsgSvrChatMsg) error { +func InsertMessageToChatLog(msg pbMsg.MsgDataToMQ) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return err } chatLog := ChatLog{ - MsgId: msgData.MsgID, - SendID: msgData.SendID, - RecvID: msgData.RecvID, - SendTime: utils.UnixNanoSecondToTime(msgData.SendTime), - SessionType: msgData.SessionType, - ContentType: msgData.ContentType, - MsgFrom: msgData.MsgFrom, - Content: msgData.Content, - SenderPlatformID: msgData.PlatformID, + MsgId: msg.MsgData.ServerMsgID, + SendID: msg.MsgData.SendID, + SendTime: utils.UnixNanoSecondToTime(msg.MsgData.SendTime), + SessionType: msg.MsgData.SessionType, + ContentType: msg.MsgData.ContentType, + MsgFrom: msg.MsgData.MsgFrom, + Content: string(msg.MsgData.Content), + SenderPlatformID: msg.MsgData.SenderPlatformID, } + switch msg.MsgData.SessionType { + case constant.GroupChatType: + chatLog.RecvID = msg.MsgData.GroupID + case constant.SingleChatType: + chatLog.RecvID = msg.MsgData.RecvID + } + return dbConn.Table("chat_log").Create(chatLog).Error } diff --git a/pkg/proto/chat/chat.proto b/pkg/proto/chat/chat.proto index aec58df7d..6a969ac20 100644 --- a/pkg/proto/chat/chat.proto +++ b/pkg/proto/chat/chat.proto @@ -12,6 +12,7 @@ message MsgDataToMQ{ message MsgDataToDB { open_im_sdk.MsgData msgData = 1; + string operationID = 2; } message PushMsgDataToMQ{ @@ -19,26 +20,26 @@ message PushMsgDataToMQ{ open_im_sdk.MsgData msgData = 2; } -message PullMessageReq { - string UserID = 1; - int64 SeqBegin = 2; - int64 SeqEnd = 3; - string OperationID = 4; -} - -message PullMessageResp { - int32 ErrCode = 1; - string ErrMsg = 2; - int64 MaxSeq = 3; - int64 MinSeq = 4; - repeated GatherFormat SingleUserMsg = 5; - repeated GatherFormat GroupUserMsg = 6; -} -message PullMessageBySeqListReq{ - string UserID = 1; - string OperationID = 2; - repeated int64 seqList =3; -} +//message PullMessageReq { +// string UserID = 1; +// int64 SeqBegin = 2; +// int64 SeqEnd = 3; +// string OperationID = 4; +//} +// +//message PullMessageResp { +// int32 ErrCode = 1; +// string ErrMsg = 2; +// int64 MaxSeq = 3; +// int64 MinSeq = 4; +// repeated GatherFormat SingleUserMsg = 5; +// repeated GatherFormat GroupUserMsg = 6; +//} +//message PullMessageBySeqListReq{ +// string UserID = 1; +// string OperationID = 2; +// repeated int64 seqList =3; +//} message GetMaxAndMinSeqReq { string UserID = 1; string OperationID = 2; @@ -49,38 +50,38 @@ message GetMaxAndMinSeqResp { int64 MaxSeq = 3; int64 MinSeq = 4; } -message GatherFormat{ - // @inject_tag: json:"id" - string ID = 1; - // @inject_tag: json:"list" - repeated MsgFormat List = 2;//detail msg -} -message MsgFormat{ - // @inject_tag: json:"sendID" - string SendID = 1; - // @inject_tag: json:"recvID" - string RecvID = 2; - // @inject_tag: json:"msgFrom" - int32 MsgFrom = 3; - // @inject_tag: json:"contentType" - int32 ContentType = 4; - // @inject_tag: json:"serverMsgID" - string ServerMsgID = 5; - // @inject_tag: json:"content" - string Content = 6; - // @inject_tag: json:"seq" - int64 Seq = 7; - // @inject_tag: json:"sendTime" - 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 GatherFormat{ +// // @inject_tag: json:"id" +// string ID = 1; +// // @inject_tag: json:"list" +// repeated MsgFormat List = 2;//detail msg +//} +//message MsgFormat{ +// // @inject_tag: json:"sendID" +// string SendID = 1; +// // @inject_tag: json:"recvID" +// string RecvID = 2; +// // @inject_tag: json:"msgFrom" +// int32 MsgFrom = 3; +// // @inject_tag: json:"contentType" +// int32 ContentType = 4; +// // @inject_tag: json:"serverMsgID" +// string ServerMsgID = 5; +// // @inject_tag: json:"content" +// string Content = 6; +// // @inject_tag: json:"seq" +// int64 Seq = 7; +// // @inject_tag: json:"sendTime" +// 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 SendMsgReq { @@ -92,17 +93,16 @@ open_im_sdk.MsgData msgData = 3; } message SendMsgResp { - int32 ErrCode = 1; - string ErrMsg = 2; - int32 ReqIdentifier = 3; - string ServerMsgID = 4; - string ClientMsgID = 5; + int32 errCode = 1; + string errMsg = 2; + string serverMsgID = 4; + string clientMsgID = 5; int64 sendTime = 6; } service Chat { rpc GetMaxAndMinSeq(GetMaxAndMinSeqReq) returns(GetMaxAndMinSeqResp); - rpc PullMessage(PullMessageReq) returns(PullMessageResp); - rpc PullMessageBySeqList(PullMessageBySeqListReq) returns(PullMessageResp); + rpc PullMessage(open_im_sdk.PullMessageReq) returns(open_im_sdk.PullMessageResp); + rpc PullMessageBySeqList(open_im_sdk.PullMessageBySeqListReq) returns(open_im_sdk.PullMessageBySeqListResp); rpc SendMsg(SendMsgReq) returns(SendMsgResp); } diff --git a/pkg/proto/sdk_ws/ws.pb.go b/pkg/proto/sdk_ws/ws.pb.go index 1ce815b28..48480cfa1 100644 --- a/pkg/proto/sdk_ws/ws.pb.go +++ b/pkg/proto/sdk_ws/ws.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: sdk_ws/ws.proto -package open_im_sdk // import "./sdk_ws" +package open_im_sdk import proto "github.com/golang/protobuf/proto" import fmt "fmt" @@ -19,10 +19,12 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type PullMessageBySeqListResp struct { - MaxSeq int64 `protobuf:"varint,1,opt,name=MaxSeq" json:"MaxSeq,omitempty"` - MinSeq int64 `protobuf:"varint,2,opt,name=MinSeq" json:"MinSeq,omitempty"` - SingleUserMsg []*GatherFormat `protobuf:"bytes,3,rep,name=SingleUserMsg" json:"SingleUserMsg,omitempty"` - GroupUserMsg []*GatherFormat `protobuf:"bytes,4,rep,name=GroupUserMsg" json:"GroupUserMsg,omitempty"` + ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` + MaxSeq int64 `protobuf:"varint,3,opt,name=maxSeq" json:"maxSeq,omitempty"` + MinSeq int64 `protobuf:"varint,4,opt,name=minSeq" json:"minSeq,omitempty"` + SingleUserMsg []*GatherFormat `protobuf:"bytes,5,rep,name=singleUserMsg" json:"singleUserMsg,omitempty"` + GroupUserMsg []*GatherFormat `protobuf:"bytes,6,rep,name=groupUserMsg" json:"groupUserMsg,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -32,7 +34,7 @@ func (m *PullMessageBySeqListResp) Reset() { *m = PullMessageBySeqListRe func (m *PullMessageBySeqListResp) String() string { return proto.CompactTextString(m) } func (*PullMessageBySeqListResp) ProtoMessage() {} func (*PullMessageBySeqListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{0} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{0} } func (m *PullMessageBySeqListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PullMessageBySeqListResp.Unmarshal(m, b) @@ -52,6 +54,20 @@ func (m *PullMessageBySeqListResp) XXX_DiscardUnknown() { var xxx_messageInfo_PullMessageBySeqListResp proto.InternalMessageInfo +func (m *PullMessageBySeqListResp) GetErrCode() int32 { + if m != nil { + return m.ErrCode + } + return 0 +} + +func (m *PullMessageBySeqListResp) GetErrMsg() string { + if m != nil { + return m.ErrMsg + } + return "" +} + func (m *PullMessageBySeqListResp) GetMaxSeq() int64 { if m != nil { return m.MaxSeq @@ -81,7 +97,9 @@ func (m *PullMessageBySeqListResp) GetGroupUserMsg() []*GatherFormat { } type PullMessageBySeqListReq struct { - SeqList []int64 `protobuf:"varint,1,rep,packed,name=seqList" json:"seqList,omitempty"` + UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` + OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` + SeqList []int64 `protobuf:"varint,3,rep,packed,name=seqList" json:"seqList,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -91,7 +109,7 @@ func (m *PullMessageBySeqListReq) Reset() { *m = PullMessageBySeqListReq func (m *PullMessageBySeqListReq) String() string { return proto.CompactTextString(m) } func (*PullMessageBySeqListReq) ProtoMessage() {} func (*PullMessageBySeqListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{1} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{1} } func (m *PullMessageBySeqListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PullMessageBySeqListReq.Unmarshal(m, b) @@ -111,6 +129,20 @@ func (m *PullMessageBySeqListReq) XXX_DiscardUnknown() { var xxx_messageInfo_PullMessageBySeqListReq proto.InternalMessageInfo +func (m *PullMessageBySeqListReq) GetUserID() string { + if m != nil { + return m.UserID + } + return "" +} + +func (m *PullMessageBySeqListReq) GetOperationID() string { + if m != nil { + return m.OperationID + } + return "" +} + func (m *PullMessageBySeqListReq) GetSeqList() []int64 { if m != nil { return m.SeqList @@ -128,7 +160,7 @@ func (m *GetMaxAndMinSeqReq) Reset() { *m = GetMaxAndMinSeqReq{} } func (m *GetMaxAndMinSeqReq) String() string { return proto.CompactTextString(m) } func (*GetMaxAndMinSeqReq) ProtoMessage() {} func (*GetMaxAndMinSeqReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{2} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{2} } func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b) @@ -160,7 +192,7 @@ func (m *GetMaxAndMinSeqResp) Reset() { *m = GetMaxAndMinSeqResp{} } func (m *GetMaxAndMinSeqResp) String() string { return proto.CompactTextString(m) } func (*GetMaxAndMinSeqResp) ProtoMessage() {} func (*GetMaxAndMinSeqResp) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{3} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{3} } func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b) @@ -198,17 +230,17 @@ type GatherFormat struct { // @inject_tag: json:"id" ID string `protobuf:"bytes,1,opt,name=ID" json:"id"` // @inject_tag: json:"list" - List []*MsgFormat `protobuf:"bytes,2,rep,name=List" json:"list"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + List []*MsgData `protobuf:"bytes,2,rep,name=List" json:"list"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GatherFormat) Reset() { *m = GatherFormat{} } func (m *GatherFormat) String() string { return proto.CompactTextString(m) } func (*GatherFormat) ProtoMessage() {} func (*GatherFormat) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{4} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{4} } func (m *GatherFormat) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GatherFormat.Unmarshal(m, b) @@ -235,269 +267,13 @@ func (m *GatherFormat) GetID() string { return "" } -func (m *GatherFormat) GetList() []*MsgFormat { +func (m *GatherFormat) GetList() []*MsgData { if m != nil { return m.List } return nil } -type MsgFormat struct { - // @inject_tag: json:"sendID" - SendID string `protobuf:"bytes,1,opt,name=SendID" json:"sendID"` - // @inject_tag: json:"recvID" - RecvID string `protobuf:"bytes,2,opt,name=RecvID" json:"recvID"` - // @inject_tag: json:"msgFrom" - MsgFrom int32 `protobuf:"varint,3,opt,name=MsgFrom" json:"msgFrom"` - // @inject_tag: json:"contentType" - ContentType int32 `protobuf:"varint,4,opt,name=ContentType" json:"contentType"` - // @inject_tag: json:"serverMsgID" - ServerMsgID string `protobuf:"bytes,5,opt,name=ServerMsgID" json:"serverMsgID"` - // @inject_tag: json:"content" - Content string `protobuf:"bytes,6,opt,name=Content" json:"content"` - // @inject_tag: json:"seq" - Seq int64 `protobuf:"varint,7,opt,name=Seq" json:"seq"` - // @inject_tag: json:"sendTime" - SendTime int64 `protobuf:"varint,8,opt,name=SendTime" json:"sendTime"` - // @inject_tag: json:"senderPlatformID" - SenderPlatformID int32 `protobuf:"varint,9,opt,name=SenderPlatformID" json:"senderPlatformID"` - // @inject_tag: json:"senderNickName" - SenderNickName string `protobuf:"bytes,10,opt,name=SenderNickName" json:"senderNickName"` - // @inject_tag: json:"senderFaceUrl" - SenderFaceURL string `protobuf:"bytes,11,opt,name=SenderFaceURL" json:"senderFaceUrl"` - // @inject_tag: json:"clientMsgID" - ClientMsgID string `protobuf:"bytes,12,opt,name=ClientMsgID" json:"clientMsgID"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MsgFormat) Reset() { *m = MsgFormat{} } -func (m *MsgFormat) String() string { return proto.CompactTextString(m) } -func (*MsgFormat) ProtoMessage() {} -func (*MsgFormat) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{5} -} -func (m *MsgFormat) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MsgFormat.Unmarshal(m, b) -} -func (m *MsgFormat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MsgFormat.Marshal(b, m, deterministic) -} -func (dst *MsgFormat) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgFormat.Merge(dst, src) -} -func (m *MsgFormat) XXX_Size() int { - return xxx_messageInfo_MsgFormat.Size(m) -} -func (m *MsgFormat) XXX_DiscardUnknown() { - xxx_messageInfo_MsgFormat.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgFormat proto.InternalMessageInfo - -func (m *MsgFormat) GetSendID() string { - if m != nil { - return m.SendID - } - return "" -} - -func (m *MsgFormat) GetRecvID() string { - if m != nil { - return m.RecvID - } - return "" -} - -func (m *MsgFormat) GetMsgFrom() int32 { - if m != nil { - return m.MsgFrom - } - return 0 -} - -func (m *MsgFormat) GetContentType() int32 { - if m != nil { - return m.ContentType - } - return 0 -} - -func (m *MsgFormat) GetServerMsgID() string { - if m != nil { - return m.ServerMsgID - } - return "" -} - -func (m *MsgFormat) GetContent() string { - if m != nil { - return m.Content - } - return "" -} - -func (m *MsgFormat) GetSeq() int64 { - if m != nil { - return m.Seq - } - return 0 -} - -func (m *MsgFormat) GetSendTime() int64 { - if m != nil { - return m.SendTime - } - return 0 -} - -func (m *MsgFormat) GetSenderPlatformID() int32 { - if m != nil { - return m.SenderPlatformID - } - return 0 -} - -func (m *MsgFormat) GetSenderNickName() string { - if m != nil { - return m.SenderNickName - } - return "" -} - -func (m *MsgFormat) GetSenderFaceURL() string { - if m != nil { - return m.SenderFaceURL - } - return "" -} - -func (m *MsgFormat) GetClientMsgID() string { - if m != nil { - return m.ClientMsgID - } - return "" -} - -type UserSendMsgReq struct { - Options map[string]int32 `protobuf:"bytes,1,rep,name=Options" json:"Options,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` - SenderNickName string `protobuf:"bytes,2,opt,name=SenderNickName" json:"SenderNickName,omitempty"` - SenderFaceURL string `protobuf:"bytes,3,opt,name=SenderFaceURL" json:"SenderFaceURL,omitempty"` - PlatformID int32 `protobuf:"varint,4,opt,name=PlatformID" json:"PlatformID,omitempty"` - SessionType int32 `protobuf:"varint,5,opt,name=SessionType" json:"SessionType,omitempty"` - MsgFrom int32 `protobuf:"varint,6,opt,name=MsgFrom" json:"MsgFrom,omitempty"` - ContentType int32 `protobuf:"varint,7,opt,name=ContentType" json:"ContentType,omitempty"` - RecvID string `protobuf:"bytes,8,opt,name=RecvID" json:"RecvID,omitempty"` - ForceList []string `protobuf:"bytes,9,rep,name=ForceList" json:"ForceList,omitempty"` - Content string `protobuf:"bytes,10,opt,name=Content" json:"Content,omitempty"` - ClientMsgID string `protobuf:"bytes,11,opt,name=ClientMsgID" json:"ClientMsgID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UserSendMsgReq) Reset() { *m = UserSendMsgReq{} } -func (m *UserSendMsgReq) String() string { return proto.CompactTextString(m) } -func (*UserSendMsgReq) ProtoMessage() {} -func (*UserSendMsgReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{6} -} -func (m *UserSendMsgReq) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UserSendMsgReq.Unmarshal(m, b) -} -func (m *UserSendMsgReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UserSendMsgReq.Marshal(b, m, deterministic) -} -func (dst *UserSendMsgReq) XXX_Merge(src proto.Message) { - xxx_messageInfo_UserSendMsgReq.Merge(dst, src) -} -func (m *UserSendMsgReq) XXX_Size() int { - return xxx_messageInfo_UserSendMsgReq.Size(m) -} -func (m *UserSendMsgReq) XXX_DiscardUnknown() { - xxx_messageInfo_UserSendMsgReq.DiscardUnknown(m) -} - -var xxx_messageInfo_UserSendMsgReq proto.InternalMessageInfo - -func (m *UserSendMsgReq) GetOptions() map[string]int32 { - if m != nil { - return m.Options - } - return nil -} - -func (m *UserSendMsgReq) GetSenderNickName() string { - if m != nil { - return m.SenderNickName - } - return "" -} - -func (m *UserSendMsgReq) GetSenderFaceURL() string { - if m != nil { - return m.SenderFaceURL - } - return "" -} - -func (m *UserSendMsgReq) GetPlatformID() int32 { - if m != nil { - return m.PlatformID - } - return 0 -} - -func (m *UserSendMsgReq) GetSessionType() int32 { - if m != nil { - return m.SessionType - } - return 0 -} - -func (m *UserSendMsgReq) GetMsgFrom() int32 { - if m != nil { - return m.MsgFrom - } - return 0 -} - -func (m *UserSendMsgReq) GetContentType() int32 { - if m != nil { - return m.ContentType - } - return 0 -} - -func (m *UserSendMsgReq) GetRecvID() string { - if m != nil { - return m.RecvID - } - return "" -} - -func (m *UserSendMsgReq) GetForceList() []string { - if m != nil { - return m.ForceList - } - return nil -} - -func (m *UserSendMsgReq) GetContent() string { - if m != nil { - return m.Content - } - return "" -} - -func (m *UserSendMsgReq) GetClientMsgID() string { - if m != nil { - return m.ClientMsgID - } - return "" -} - type UserSendMsgResp struct { ServerMsgID string `protobuf:"bytes,1,opt,name=ServerMsgID" json:"ServerMsgID,omitempty"` ClientMsgID string `protobuf:"bytes,2,opt,name=ClientMsgID" json:"ClientMsgID,omitempty"` @@ -511,7 +287,7 @@ func (m *UserSendMsgResp) Reset() { *m = UserSendMsgResp{} } func (m *UserSendMsgResp) String() string { return proto.CompactTextString(m) } func (*UserSendMsgResp) ProtoMessage() {} func (*UserSendMsgResp) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{7} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{5} } func (m *UserSendMsgResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UserSendMsgResp.Unmarshal(m, b) @@ -580,7 +356,7 @@ func (m *MsgData) Reset() { *m = MsgData{} } func (m *MsgData) String() string { return proto.CompactTextString(m) } func (*MsgData) ProtoMessage() {} func (*MsgData) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{8} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{6} } func (m *MsgData) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MsgData.Unmarshal(m, b) @@ -741,7 +517,7 @@ func (m *OfflinePushInfo) Reset() { *m = OfflinePushInfo{} } func (m *OfflinePushInfo) String() string { return proto.CompactTextString(m) } func (*OfflinePushInfo) ProtoMessage() {} func (*OfflinePushInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{9} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{7} } func (m *OfflinePushInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OfflinePushInfo.Unmarshal(m, b) @@ -815,7 +591,7 @@ func (m *GroupInfo) Reset() { *m = GroupInfo{} } func (m *GroupInfo) String() string { return proto.CompactTextString(m) } func (*GroupInfo) ProtoMessage() {} func (*GroupInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{10} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{8} } func (m *GroupInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupInfo.Unmarshal(m, b) @@ -909,7 +685,7 @@ func (m *GroupMemberFullInfo) Reset() { *m = GroupMemberFullInfo{} } func (m *GroupMemberFullInfo) String() string { return proto.CompactTextString(m) } func (*GroupMemberFullInfo) ProtoMessage() {} func (*GroupMemberFullInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{11} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{9} } func (m *GroupMemberFullInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupMemberFullInfo.Unmarshal(m, b) @@ -996,7 +772,7 @@ func (m *UserInfo) Reset() { *m = UserInfo{} } func (m *UserInfo) String() string { return proto.CompactTextString(m) } func (*UserInfo) ProtoMessage() {} func (*UserInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{12} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{10} } func (m *UserInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UserInfo.Unmarshal(m, b) @@ -1080,7 +856,7 @@ func (m *PublicUserInfo) Reset() { *m = PublicUserInfo{} } func (m *PublicUserInfo) String() string { return proto.CompactTextString(m) } func (*PublicUserInfo) ProtoMessage() {} func (*PublicUserInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{13} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{11} } func (m *PublicUserInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PublicUserInfo.Unmarshal(m, b) @@ -1140,7 +916,7 @@ func (m *TipsComm) Reset() { *m = TipsComm{} } func (m *TipsComm) String() string { return proto.CompactTextString(m) } func (*TipsComm) ProtoMessage() {} func (*TipsComm) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{14} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{12} } func (m *TipsComm) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_TipsComm.Unmarshal(m, b) @@ -1189,7 +965,7 @@ func (m *MemberEnterTips) Reset() { *m = MemberEnterTips{} } func (m *MemberEnterTips) String() string { return proto.CompactTextString(m) } func (*MemberEnterTips) ProtoMessage() {} func (*MemberEnterTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{15} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{13} } func (m *MemberEnterTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MemberEnterTips.Unmarshal(m, b) @@ -1244,7 +1020,7 @@ func (m *MemberLeaveTips) Reset() { *m = MemberLeaveTips{} } func (m *MemberLeaveTips) String() string { return proto.CompactTextString(m) } func (*MemberLeaveTips) ProtoMessage() {} func (*MemberLeaveTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{16} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{14} } func (m *MemberLeaveTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MemberLeaveTips.Unmarshal(m, b) @@ -1299,7 +1075,7 @@ func (m *MemberInvitedTips) Reset() { *m = MemberInvitedTips{} } func (m *MemberInvitedTips) String() string { return proto.CompactTextString(m) } func (*MemberInvitedTips) ProtoMessage() {} func (*MemberInvitedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{17} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{15} } func (m *MemberInvitedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MemberInvitedTips.Unmarshal(m, b) @@ -1361,7 +1137,7 @@ func (m *MemberKickedTips) Reset() { *m = MemberKickedTips{} } func (m *MemberKickedTips) String() string { return proto.CompactTextString(m) } func (*MemberKickedTips) ProtoMessage() {} func (*MemberKickedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{18} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{16} } func (m *MemberKickedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MemberKickedTips.Unmarshal(m, b) @@ -1424,7 +1200,7 @@ func (m *MemberInfoChangedTips) Reset() { *m = MemberInfoChangedTips{} } func (m *MemberInfoChangedTips) String() string { return proto.CompactTextString(m) } func (*MemberInfoChangedTips) ProtoMessage() {} func (*MemberInfoChangedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{19} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{17} } func (m *MemberInfoChangedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MemberInfoChangedTips.Unmarshal(m, b) @@ -1493,7 +1269,7 @@ func (m *GroupCreatedTips) Reset() { *m = GroupCreatedTips{} } func (m *GroupCreatedTips) String() string { return proto.CompactTextString(m) } func (*GroupCreatedTips) ProtoMessage() {} func (*GroupCreatedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{20} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{18} } func (m *GroupCreatedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupCreatedTips.Unmarshal(m, b) @@ -1554,7 +1330,7 @@ func (m *GroupInfoChangedTips) Reset() { *m = GroupInfoChangedTips{} } func (m *GroupInfoChangedTips) String() string { return proto.CompactTextString(m) } func (*GroupInfoChangedTips) ProtoMessage() {} func (*GroupInfoChangedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{21} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{19} } func (m *GroupInfoChangedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupInfoChangedTips.Unmarshal(m, b) @@ -1608,7 +1384,7 @@ func (m *ReceiveJoinApplicationTips) Reset() { *m = ReceiveJoinApplicati func (m *ReceiveJoinApplicationTips) String() string { return proto.CompactTextString(m) } func (*ReceiveJoinApplicationTips) ProtoMessage() {} func (*ReceiveJoinApplicationTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{22} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{20} } func (m *ReceiveJoinApplicationTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ReceiveJoinApplicationTips.Unmarshal(m, b) @@ -1663,7 +1439,7 @@ func (m *ApplicationProcessedTips) Reset() { *m = ApplicationProcessedTi func (m *ApplicationProcessedTips) String() string { return proto.CompactTextString(m) } func (*ApplicationProcessedTips) ProtoMessage() {} func (*ApplicationProcessedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{23} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{21} } func (m *ApplicationProcessedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ApplicationProcessedTips.Unmarshal(m, b) @@ -1726,7 +1502,7 @@ func (m *FriendInfo) Reset() { *m = FriendInfo{} } func (m *FriendInfo) String() string { return proto.CompactTextString(m) } func (*FriendInfo) ProtoMessage() {} func (*FriendInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{24} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{22} } func (m *FriendInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendInfo.Unmarshal(m, b) @@ -1787,7 +1563,7 @@ func (m *FriendApplication) Reset() { *m = FriendApplication{} } func (m *FriendApplication) String() string { return proto.CompactTextString(m) } func (*FriendApplication) ProtoMessage() {} func (*FriendApplication) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{25} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{23} } func (m *FriendApplication) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendApplication.Unmarshal(m, b) @@ -1843,7 +1619,7 @@ func (m *FriendApplicationAddedTips) Reset() { *m = FriendApplicationAdd func (m *FriendApplicationAddedTips) String() string { return proto.CompactTextString(m) } func (*FriendApplicationAddedTips) ProtoMessage() {} func (*FriendApplicationAddedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{26} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{24} } func (m *FriendApplicationAddedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendApplicationAddedTips.Unmarshal(m, b) @@ -1906,7 +1682,7 @@ func (m *FriendApplicationProcessedTips) Reset() { *m = FriendApplicatio func (m *FriendApplicationProcessedTips) String() string { return proto.CompactTextString(m) } func (*FriendApplicationProcessedTips) ProtoMessage() {} func (*FriendApplicationProcessedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{27} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{25} } func (m *FriendApplicationProcessedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendApplicationProcessedTips.Unmarshal(m, b) @@ -1966,7 +1742,7 @@ func (m *FriendAddedTips) Reset() { *m = FriendAddedTips{} } func (m *FriendAddedTips) String() string { return proto.CompactTextString(m) } func (*FriendAddedTips) ProtoMessage() {} func (*FriendAddedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{28} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{26} } func (m *FriendAddedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendAddedTips.Unmarshal(m, b) @@ -2012,7 +1788,7 @@ func (m *FriendDeletedTips) Reset() { *m = FriendDeletedTips{} } func (m *FriendDeletedTips) String() string { return proto.CompactTextString(m) } func (*FriendDeletedTips) ProtoMessage() {} func (*FriendDeletedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{29} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{27} } func (m *FriendDeletedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendDeletedTips.Unmarshal(m, b) @@ -2059,7 +1835,7 @@ func (m *BlackInfo) Reset() { *m = BlackInfo{} } func (m *BlackInfo) String() string { return proto.CompactTextString(m) } func (*BlackInfo) ProtoMessage() {} func (*BlackInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{30} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{28} } func (m *BlackInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BlackInfo.Unmarshal(m, b) @@ -2112,7 +1888,7 @@ func (m *BlackAddedTips) Reset() { *m = BlackAddedTips{} } func (m *BlackAddedTips) String() string { return proto.CompactTextString(m) } func (*BlackAddedTips) ProtoMessage() {} func (*BlackAddedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{31} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{29} } func (m *BlackAddedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BlackAddedTips.Unmarshal(m, b) @@ -2158,7 +1934,7 @@ func (m *BlackDeletedTips) Reset() { *m = BlackDeletedTips{} } func (m *BlackDeletedTips) String() string { return proto.CompactTextString(m) } func (*BlackDeletedTips) ProtoMessage() {} func (*BlackDeletedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{32} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{30} } func (m *BlackDeletedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BlackDeletedTips.Unmarshal(m, b) @@ -2205,7 +1981,7 @@ func (m *FriendInfoChangedTips) Reset() { *m = FriendInfoChangedTips{} } func (m *FriendInfoChangedTips) String() string { return proto.CompactTextString(m) } func (*FriendInfoChangedTips) ProtoMessage() {} func (*FriendInfoChangedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{33} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{31} } func (m *FriendInfoChangedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendInfoChangedTips.Unmarshal(m, b) @@ -2260,7 +2036,7 @@ func (m *SelfInfoUpdatedTips) Reset() { *m = SelfInfoUpdatedTips{} } func (m *SelfInfoUpdatedTips) String() string { return proto.CompactTextString(m) } func (*SelfInfoUpdatedTips) ProtoMessage() {} func (*SelfInfoUpdatedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_a9634e8f434358ba, []int{34} + return fileDescriptor_ws_9a4768ae4ab79d99, []int{32} } func (m *SelfInfoUpdatedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SelfInfoUpdatedTips.Unmarshal(m, b) @@ -2307,9 +2083,6 @@ func init() { proto.RegisterType((*GetMaxAndMinSeqReq)(nil), "open_im_sdk.GetMaxAndMinSeqReq") proto.RegisterType((*GetMaxAndMinSeqResp)(nil), "open_im_sdk.GetMaxAndMinSeqResp") proto.RegisterType((*GatherFormat)(nil), "open_im_sdk.GatherFormat") - proto.RegisterType((*MsgFormat)(nil), "open_im_sdk.MsgFormat") - proto.RegisterType((*UserSendMsgReq)(nil), "open_im_sdk.UserSendMsgReq") - proto.RegisterMapType((map[string]int32)(nil), "open_im_sdk.UserSendMsgReq.OptionsEntry") proto.RegisterType((*UserSendMsgResp)(nil), "open_im_sdk.UserSendMsgResp") proto.RegisterType((*MsgData)(nil), "open_im_sdk.MsgData") proto.RegisterMapType((map[string]bool)(nil), "open_im_sdk.MsgData.OptionsEntry") @@ -2341,124 +2114,114 @@ func init() { proto.RegisterType((*SelfInfoUpdatedTips)(nil), "open_im_sdk.SelfInfoUpdatedTips") } -func init() { proto.RegisterFile("sdk_ws/ws.proto", fileDescriptor_ws_a9634e8f434358ba) } +func init() { proto.RegisterFile("sdk_ws/ws.proto", fileDescriptor_ws_9a4768ae4ab79d99) } -var fileDescriptor_ws_a9634e8f434358ba = []byte{ - // 1855 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x59, 0x5f, 0x6f, 0xdc, 0x5a, - 0x11, 0x97, 0xf7, 0x5f, 0xb2, 0xb3, 0x69, 0x92, 0xba, 0x6d, 0xae, 0x29, 0x57, 0x55, 0xb0, 0x10, - 0x8a, 0xae, 0xae, 0x52, 0x91, 0x08, 0x71, 0xdb, 0x2b, 0xe0, 0x26, 0xd9, 0x24, 0xda, 0xd2, 0x34, - 0x91, 0xb7, 0x15, 0x12, 0x2f, 0x95, 0x6b, 0x9f, 0xdd,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 0x17, 0xa1, 0x8b, 0xe7, 0xaa, 0xa7, 0xda, 0x3c, 0x4f, 0x3f, 0xcb, 0xa9, 0xd9, 0x65, 0x21, 0xcb, - 0x3e, 0xac, 0xaf, 0x5f, 0x1b, 0xd0, 0x3e, 0x0c, 0x5d, 0x6f, 0x44, 0x83, 0xfb, 0xa4, 0x3a, 0xb8, - 0xd7, 0xef, 0xb3, 0x72, 0x7c, 0x6f, 0x1a, 0xd3, 0x27, 0xd2, 0x8f, 0x32, 0xa5, 0xd7, 0x1f, 0x5d, - 0x68, 0xdb, 0x3e, 0xac, 0x93, 0x50, 0x16, 0xfe, 0x73, 0x68, 0x12, 0x32, 0x77, 0x0f, 0x16, 0xe9, - 0x38, 0x42, 0x69, 0xc1, 0x4a, 0x0c, 0x60, 0x93, 0xd4, 0xd5, 0xa2, 0x7f, 0x08, 0x3f, 0xbf, 0x31, - 0xe0, 0x41, 0xd9, 0x2e, 0xf5, 0x23, 0xb9, 0x74, 0x8b, 0xf7, 0x67, 0x16, 0xfc, 0x42, 0xe3, 0xb3, - 0xd8, 0xdd, 0xfb, 0xf7, 0x06, 0xdc, 0xeb, 0xb3, 0x70, 0x80, 0xa6, 0xaf, 0xc6, 0x7e, 0x71, 0x67, - 0x79, 0x02, 0x6b, 0x08, 0xe7, 0xa7, 0x5e, 0xbf, 0xdd, 0x35, 0xd5, 0x0f, 0x18, 0xed, 0xe1, 0xd6, - 0x4f, 0xef, 0xef, 0x3e, 0x16, 0xff, 0xe5, 0xf9, 0x52, 0x39, 0xf4, 0x4d, 0x8b, 0xfe, 0xdf, 0xb3, - 0xff, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x45, 0x72, 0x9b, 0x6e, 0x02, 0x1a, 0x00, 0x00, +var fileDescriptor_ws_9a4768ae4ab79d99 = []byte{ + // 1690 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x5b, 0x6f, 0x1b, 0x45, + 0x14, 0xd6, 0xfa, 0x96, 0xf8, 0xd8, 0xb9, 0x74, 0x9b, 0xa6, 0x4b, 0xa8, 0x2a, 0xb3, 0x42, 0xc8, + 0x42, 0x55, 0x2a, 0x12, 0x21, 0x9a, 0x22, 0xa0, 0x49, 0x9c, 0x04, 0x43, 0x5c, 0x47, 0xeb, 0x44, + 0x3c, 0x56, 0x1b, 0xef, 0xd8, 0x59, 0xbc, 0x17, 0x67, 0x66, 0xed, 0x36, 0xbf, 0x04, 0x09, 0x09, + 0x09, 0xc4, 0x03, 0x42, 0xbc, 0x20, 0x84, 0xf8, 0x15, 0xfc, 0x0a, 0x04, 0x8f, 0xbc, 0xf0, 0x0a, + 0x0f, 0x68, 0xce, 0xcc, 0xee, 0xce, 0xc6, 0x21, 0x71, 0x82, 0xda, 0xb7, 0x3d, 0x9f, 0xcf, 0x99, + 0xf3, 0x9d, 0xeb, 0xce, 0x1a, 0x16, 0x98, 0x33, 0x78, 0xf6, 0x9c, 0x3d, 0x7c, 0xce, 0x56, 0x87, + 0x34, 0x8c, 0x42, 0xbd, 0x12, 0x0e, 0x49, 0xf0, 0xcc, 0xf5, 0x9f, 0x31, 0x67, 0x60, 0xfe, 0xa3, + 0x81, 0x71, 0x30, 0xf2, 0xbc, 0x16, 0x61, 0xcc, 0xee, 0x93, 0xad, 0xb3, 0x0e, 0x39, 0xdd, 0x77, + 0x59, 0x64, 0x11, 0x36, 0xd4, 0x0d, 0x98, 0x21, 0x94, 0x6e, 0x87, 0x0e, 0x31, 0xb4, 0x9a, 0x56, + 0x2f, 0x5a, 0xb1, 0xa8, 0x2f, 0x43, 0x89, 0x50, 0xda, 0x62, 0x7d, 0x23, 0x57, 0xd3, 0xea, 0x65, + 0x4b, 0x4a, 0x1c, 0xf7, 0xed, 0x17, 0x1d, 0x72, 0x6a, 0xe4, 0x6b, 0x5a, 0x3d, 0x6f, 0x49, 0x09, + 0x71, 0x37, 0xe0, 0x78, 0x41, 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e7, 0x92, 0x20, 0x12, 0x1a, 0x32, + 0x2f, 0x0a, 0xa4, 0xaf, 0xc0, 0x2c, 0x23, 0x81, 0x73, 0xe8, 0xfa, 0x44, 0xb6, 0x47, 0x22, 0x9b, + 0xbf, 0x14, 0x61, 0x46, 0x92, 0xe0, 0x01, 0x72, 0x3c, 0xcd, 0xbc, 0x90, 0x38, 0x4e, 0x49, 0x77, + 0x9c, 0x1c, 0x2e, 0x25, 0x9e, 0x6f, 0x2c, 0x6a, 0xb3, 0x81, 0xc7, 0x96, 0xad, 0x58, 0xe4, 0x9c, + 0xba, 0x0a, 0xa7, 0x82, 0xe0, 0xa4, 0x40, 0x5c, 0x83, 0x29, 0x71, 0x15, 0x85, 0x86, 0x02, 0xe9, + 0x6f, 0xc3, 0x22, 0xf7, 0x4f, 0xe8, 0x81, 0x67, 0x47, 0xbd, 0x90, 0xfa, 0xcd, 0x86, 0x51, 0xc2, + 0x69, 0x98, 0xc0, 0xf5, 0xb7, 0x60, 0x5e, 0x60, 0x4f, 0xdd, 0xee, 0xe0, 0xa9, 0xed, 0x13, 0x63, + 0x06, 0x0f, 0x3c, 0x87, 0xea, 0x6f, 0xc2, 0x9c, 0x40, 0x76, 0xed, 0x2e, 0x39, 0xb2, 0xf6, 0x8d, + 0x59, 0x54, 0xcb, 0x82, 0x82, 0x1b, 0x63, 0x6e, 0x18, 0x1c, 0x9e, 0x0d, 0x89, 0x51, 0x46, 0xa7, + 0x2a, 0xc4, 0x23, 0xf7, 0x59, 0x7f, 0x97, 0x86, 0xbe, 0x01, 0x62, 0x40, 0xa5, 0x88, 0x91, 0x87, + 0x41, 0x44, 0x82, 0x08, 0x6d, 0x2b, 0xc2, 0x56, 0x81, 0xb8, 0xad, 0x14, 0x8d, 0x6a, 0x4d, 0xab, + 0x57, 0xad, 0x58, 0xd4, 0xef, 0x41, 0xb9, 0x17, 0xd2, 0x2e, 0xc1, 0x6e, 0x99, 0xab, 0xe5, 0xeb, + 0x65, 0x2b, 0x05, 0xf4, 0x45, 0xc8, 0x33, 0x72, 0x6a, 0xcc, 0x63, 0x01, 0xf9, 0x63, 0xa6, 0xae, + 0x0b, 0xd9, 0xba, 0xea, 0xf7, 0x01, 0xba, 0x94, 0xd8, 0x11, 0xc1, 0x5f, 0x17, 0xf1, 0x57, 0x05, + 0xd1, 0xdf, 0x87, 0x99, 0xf6, 0x90, 0xcf, 0x0d, 0x33, 0x6e, 0x61, 0x5f, 0xbe, 0x71, 0x51, 0x5f, + 0xae, 0x4a, 0x9d, 0x9d, 0x20, 0xa2, 0x67, 0x56, 0x6c, 0xa1, 0xef, 0xc2, 0x42, 0xd8, 0xeb, 0x79, + 0x6e, 0x40, 0x0e, 0x46, 0xec, 0xa4, 0x19, 0xf4, 0x42, 0x43, 0xaf, 0x69, 0xf5, 0xca, 0xda, 0xbd, + 0xcc, 0x21, 0xed, 0xac, 0x8e, 0x75, 0xde, 0x68, 0xe5, 0x31, 0x54, 0x55, 0x07, 0x3c, 0xc4, 0x01, + 0x39, 0x93, 0xdd, 0xc7, 0x1f, 0xf5, 0x25, 0x28, 0x8e, 0x6d, 0x6f, 0x44, 0xb0, 0xf3, 0x66, 0x2d, + 0x21, 0x3c, 0xce, 0x3d, 0xd2, 0xcc, 0x2f, 0x34, 0x58, 0x38, 0xe7, 0x80, 0x6b, 0x1f, 0xba, 0x91, + 0x47, 0xe4, 0x09, 0x42, 0xd0, 0x75, 0x28, 0x34, 0x08, 0xeb, 0xca, 0xe6, 0xc5, 0x67, 0xee, 0x69, + 0xe7, 0x45, 0x24, 0xdb, 0x96, 0x3f, 0xea, 0x26, 0x54, 0xdd, 0x76, 0x87, 0x1f, 0xd5, 0x09, 0x47, + 0x81, 0x23, 0x7b, 0x36, 0x83, 0xf1, 0xf6, 0x71, 0xdb, 0x9d, 0x2d, 0xdb, 0xe9, 0x93, 0xed, 0x70, + 0x14, 0x44, 0xd8, 0xb6, 0xb3, 0x56, 0x16, 0x34, 0xbf, 0xcc, 0x41, 0x79, 0x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x4f, 0x98, + 0x5f, 0x69, 0xb0, 0x62, 0x91, 0x2e, 0x71, 0xc7, 0x84, 0xbf, 0x8d, 0x37, 0x87, 0x43, 0x4f, 0xde, + 0x6e, 0x6e, 0x50, 0x93, 0x0d, 0x28, 0xcb, 0x03, 0x82, 0x48, 0x12, 0xbf, 0xf4, 0x56, 0x93, 0x6a, + 0xf3, 0x97, 0x8d, 0x45, 0x6c, 0x96, 0x5c, 0xb4, 0xa4, 0x64, 0xfe, 0xa4, 0x81, 0xa1, 0x90, 0x3a, + 0xa0, 0x61, 0x97, 0x30, 0xf6, 0x8a, 0x97, 0x02, 0x92, 0x63, 0x23, 0x2f, 0x92, 0xd7, 0x1b, 0x29, + 0x29, 0xa4, 0x0b, 0x19, 0xd2, 0x3f, 0x6a, 0x00, 0xe2, 0x16, 0x82, 0x73, 0xb3, 0x0e, 0x65, 0xbc, + 0xbe, 0xa1, 0x6f, 0x41, 0xf5, 0x4e, 0xc6, 0x77, 0x9a, 0x90, 0x44, 0x4f, 0x9c, 0x8d, 0xd7, 0x9a, + 0x5c, 0x7c, 0x36, 0x97, 0xce, 0x5d, 0x01, 0xf3, 0x13, 0x57, 0xc0, 0x77, 0x63, 0xd7, 0xe8, 0xad, + 0x70, 0x99, 0x37, 0x45, 0xd1, 0x1c, 0xc0, 0x2d, 0x21, 0x29, 0xc9, 0xe6, 0xf7, 0x87, 0x4d, 0x47, + 0x7c, 0xdf, 0x68, 0xe8, 0x28, 0x16, 0xf9, 0xdd, 0x79, 0xd3, 0x71, 0x3a, 0xe1, 0x88, 0x76, 0x93, + 0xbb, 0x73, 0x02, 0x70, 0x8e, 0x9b, 0x8e, 0xf3, 0x59, 0x48, 0x1d, 0x37, 0xe8, 0xcb, 0x82, 0x2a, + 0x88, 0xf9, 0x97, 0x06, 0x2b, 0x13, 0xde, 0x36, 0x1d, 0x47, 0x96, 0x75, 0x3d, 0x29, 0x94, 0x76, + 0x75, 0x0f, 0xa5, 0x8b, 0xbb, 0xa2, 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0x1c, 0x8e, 0x4f, 0xbd, 0x7c, + 0xbb, 0x67, 0x54, 0x5f, 0x22, 0xdb, 0xe3, 0x12, 0xfe, 0xe1, 0xbd, 0xfe, 0x6f, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x86, 0x83, 0x68, 0xe9, 0x03, 0x17, 0x00, 0x00, } diff --git a/pkg/proto/sdk_ws/ws.proto b/pkg/proto/sdk_ws/ws.proto index 8d6713f75..8ee089fb6 100644 --- a/pkg/proto/sdk_ws/ws.proto +++ b/pkg/proto/sdk_ws/ws.proto @@ -1,16 +1,34 @@ syntax = "proto3"; package open_im_sdk;//The package name to which the proto file belongs -option go_package = "./sdk_ws;open_im_sdk";//The generated go pb file is in the current directory, and the package name is open_im_sdk +//option go_package = "./sdk_ws;open_im_sdk";//The generated go pb file is in the current directory, and the package name is open_im_sdk message PullMessageBySeqListResp { - int64 MaxSeq = 1; - int64 MinSeq = 2; - repeated GatherFormat SingleUserMsg = 3; - repeated GatherFormat GroupUserMsg = 4; + int32 errCode = 1; + string errMsg = 2; + int64 maxSeq = 3; + int64 minSeq = 4; + repeated GatherFormat singleUserMsg = 5; + repeated GatherFormat groupUserMsg = 6; } message PullMessageBySeqListReq{ - repeated int64 seqList =1; + string userID = 1; + string operationID = 2; + repeated int64 seqList =3; +} +message PullMessageReq { + string userID = 1; + int64 seqBegin = 2; + int64 seqEnd = 3; + string operationID = 4; +} +message PullMessageResp { + int32 errCode = 1; + string errMsg = 2; + int64 maxSeq = 3; + int64 minSeq = 4; + repeated GatherFormat singleUserMsg = 5; + repeated GatherFormat groupUserMsg = 6; } message GetMaxAndMinSeqReq { } @@ -20,50 +38,37 @@ message GetMaxAndMinSeqResp { } message GatherFormat{ // @inject_tag: json:"id" - string ID = 1; + string id = 1; // @inject_tag: json:"list" - repeated MsgFormat List = 2;//detail msg -} -message MsgFormat{ - // @inject_tag: json:"sendID" - string SendID = 1; - // @inject_tag: json:"recvID" - string RecvID = 2; - // @inject_tag: json:"msgFrom" - int32 MsgFrom = 3; - // @inject_tag: json:"contentType" - int32 ContentType = 4; - // @inject_tag: json:"serverMsgID" - string ServerMsgID = 5; - // @inject_tag: json:"content" - string Content = 6; - // @inject_tag: json:"seq" - int64 Seq = 7; - // @inject_tag: json:"sendTime" - 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; + repeated MsgData list = 2;//detail msg } +//message MsgFormat{ +// // @inject_tag: json:"sendID" +// string SendID = 1; +// // @inject_tag: json:"recvID" +// string RecvID = 2; +// // @inject_tag: json:"msgFrom" +// int32 MsgFrom = 3; +// // @inject_tag: json:"contentType" +// int32 ContentType = 4; +// // @inject_tag: json:"serverMsgID" +// string ServerMsgID = 5; +// // @inject_tag: json:"content" +// string Content = 6; +// // @inject_tag: json:"seq" +// int64 Seq = 7; +// // @inject_tag: json:"sendTime" +// 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 { - map Options= 1; - string SenderNickName = 2; - string SenderFaceURL = 3; - int32 PlatformID = 4; - int32 SessionType = 5; - int32 MsgFrom = 6; - int32 ContentType = 7; - string RecvID = 8; - repeated string ForceList = 9; - string Content = 10; - string ClientMsgID = 11; -} message UserSendMsgResp { string ServerMsgID = 1; diff --git a/pkg/utils/map.go b/pkg/utils/map.go index 4b8f9fa8d..05712fe64 100644 --- a/pkg/utils/map.go +++ b/pkg/utils/map.go @@ -115,12 +115,12 @@ func JsonStringToMap(str string) (tempMap map[string]int32) { _ = json.Unmarshal([]byte(str), &tempMap) return tempMap } -func GetSwitchFromOptions(Options map[string]int32, key string) (result bool) { - if flag, ok := Options[key]; !ok || flag == 1 { +func GetSwitchFromOptions(Options map[string]bool, key string) (result bool) { + if flag, ok := Options[key]; !ok || flag { return true } return false } -func SetSwitchFromOptions(Options map[string]int32, key string, value int32) { +func SetSwitchFromOptions(Options map[string]bool, key string, value bool) { Options[key] = value }