diff --git a/cmd/open_im_api/main.go b/cmd/open_im_api/main.go index 98e9f5af7..6b9b5894b 100644 --- a/cmd/open_im_api/main.go +++ b/cmd/open_im_api/main.go @@ -3,6 +3,7 @@ package main import ( _ "Open_IM/cmd/open_im_api/docs" apiAuth "Open_IM/internal/api/auth" + clientInit "Open_IM/internal/api/client_init" "Open_IM/internal/api/conversation" "Open_IM/internal/api/friend" "Open_IM/internal/api/group" @@ -206,6 +207,12 @@ func main() { } + initGroup := r.Group("/init") + { + initGroup.POST("/set_client_config", clientInit.SetClientInitConfig) + initGroup.POST("/get_client_config", clientInit.GetClientInitConfig) + } + go apiThird.MinioInit() defaultPorts := config.Config.Api.GinPort ginPort := flag.Int("port", defaultPorts[0], "get ginServerPort from cmd,default 10002 as port") diff --git a/config/config.yaml b/config/config.yaml index 2cefb31b0..5524a1219 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -17,8 +17,8 @@ mysql: dbMysqlDatabaseName: openIM_v2 #默认即可 dbTableName: eMsg #默认即可 dbMsgTableNum: 1 - dbMaxOpenConns: 20 - dbMaxIdleConns: 10 + dbMaxOpenConns: 200 + dbMaxIdleConns: 100 dbMaxLifeTime: 120 mongo: @@ -73,7 +73,7 @@ kafka: serverip: 0.0.0.0 #作为rpc时,注册到etcd的地址,单机默认即可,如果是集群部署,需要修改(具体使用内网地址还是外网地址,要依情况而定,目的是api/gateway能访问到) -rpcRegisterIP: 127.0.0.1 +rpcRegisterIP: #默认即可 listenIP: 0.0.0.0 @@ -158,7 +158,8 @@ rpcport: #rpc服务端口 默认即可 openImOfficePort: [ 10210 ] openImOrganizationPort: [ 10220 ] openImConversationPort: [ 10230 ] - openImCachePort: [10240] + openImCachePort: [ 10240 ] + openImRealTimeCommPort: [ 11300 ] c2c: callbackBeforeSendMsg: switch: false diff --git a/internal/api/auth/auth.go b/internal/api/auth/auth.go index 7fcd82684..f1a0551a6 100644 --- a/internal/api/auth/auth.go +++ b/internal/api/auth/auth.go @@ -49,9 +49,9 @@ func UserRegister(c *gin.Context) { //copier.Copy(req.UserInfo, ¶ms) req.OperationID = params.OperationID log.NewInfo(req.OperationID, "UserRegister args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + " getcdv3.GetConn == nil" + errMsg := req.OperationID + " getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -120,9 +120,9 @@ func UserToken(c *gin.Context) { } req := &rpc.UserTokenReq{Platform: params.Platform, FromUserID: params.UserID, OperationID: params.OperationID, LoginIp: params.LoginIp} log.NewInfo(req.OperationID, "UserToken args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + " getcdv3.GetConn == nil" + errMsg := req.OperationID + " getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -214,9 +214,9 @@ func ForceLogout(c *gin.Context) { } log.NewInfo(req.OperationID, "ForceLogout args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + " getcdv3.GetConn == nil" + errMsg := req.OperationID + " getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return diff --git a/internal/api/client_init/init_config.go b/internal/api/client_init/init_config.go new file mode 100644 index 000000000..de08fc90c --- /dev/null +++ b/internal/api/client_init/init_config.go @@ -0,0 +1,75 @@ +package clientInit + +import ( + api "Open_IM/pkg/base_info" + imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" + "Open_IM/pkg/common/token_verify" + "Open_IM/pkg/utils" + "net/http" + + "github.com/gin-gonic/gin" + "github.com/jinzhu/gorm" +) + +func SetClientInitConfig(c *gin.Context) { + var req api.SetClientInitConfigReq + var resp api.SetClientInitConfigResp + if err := c.BindJSON(&req); err != nil { + log.NewError("0", utils.GetSelfFuncName(), err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req) + err, _ := token_verify.ParseTokenGetUserID(c.Request.Header.Get("token"), req.OperationID) + if err != nil { + errMsg := "ParseTokenGetUserID failed " + err.Error() + c.Request.Header.Get("token") + log.NewError(req.OperationID, errMsg, errMsg) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) + return + } + m := make(map[string]interface{}) + if req.DiscoverPageURL != nil { + m["discover_page_url"] = *req.DiscoverPageURL + } + if len(m) > 0 { + err := imdb.SetClientInitConfig(m) + if err != nil { + log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) + return + } + } + log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp) + c.JSON(http.StatusOK, resp) +} + +func GetClientInitConfig(c *gin.Context) { + var req api.GetClientInitConfigReq + var resp api.GetClientInitConfigResp + if err := c.BindJSON(&req); err != nil { + log.NewError("0", utils.GetSelfFuncName(), err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req) + err, _ := token_verify.ParseTokenGetUserID(c.Request.Header.Get("token"), req.OperationID) + if err != nil { + errMsg := "ParseTokenGetUserID failed " + err.Error() + c.Request.Header.Get("token") + log.NewError(req.OperationID, errMsg, errMsg) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) + return + } + config, err := imdb.GetClientInitConfig() + if err != nil { + if !gorm.IsRecordNotFoundError(err) { + log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) + return + } + } + resp.Data.DiscoverPageURL = config.DiscoverPageURL + log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp ", resp) + c.JSON(http.StatusOK, resp) + +} diff --git a/internal/api/conversation/conversation.go b/internal/api/conversation/conversation.go index 2c26d4f0e..cfda0abb8 100644 --- a/internal/api/conversation/conversation.go +++ b/internal/api/conversation/conversation.go @@ -26,15 +26,15 @@ func SetConversation(c *gin.Context) { return } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req) - reqPb.Conversation = &pbUser.Conversation{} + reqPb.Conversation = &pbConversation.Conversation{} err := utils.CopyStructFields(&reqPb, req) err = utils.CopyStructFields(reqPb.Conversation, req.Conversation) if err != nil { log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -69,9 +69,9 @@ func ModifyConversationField(c *gin.Context) { if err != nil { log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -104,9 +104,9 @@ func BatchSetConversations(c *gin.Context) { if err := utils.CopyStructFields(&reqPb, req); err != nil { log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -154,9 +154,9 @@ func GetAllConversations(c *gin.Context) { if err := utils.CopyStructFields(&reqPb, req); err != nil { log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -204,9 +204,9 @@ func GetConversation(c *gin.Context) { if err := utils.CopyStructFields(&reqPb, req); err != nil { log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -254,9 +254,9 @@ func GetConversations(c *gin.Context) { if err := utils.CopyStructFields(&reqPb, req); err != nil { log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -292,9 +292,9 @@ func SetRecvMsgOpt(c *gin.Context) { if err := utils.CopyStructFields(&reqPb, req); err != nil { log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return diff --git a/internal/api/friend/friend.go b/internal/api/friend/friend.go index ac637275f..2e896ea4e 100644 --- a/internal/api/friend/friend.go +++ b/internal/api/friend/friend.go @@ -48,7 +48,7 @@ func AddBlack(c *gin.Context) { } log.NewInfo(params.OperationID, "AddBlacklist args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) client := rpc.NewFriendClient(etcdConn) RpcResp, err := client.AddBlacklist(context.Background(), req) if err != nil { @@ -93,9 +93,9 @@ func ImportFriend(c *gin.Context) { } log.NewInfo(req.OperationID, "ImportFriend args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -156,9 +156,9 @@ func AddFriend(c *gin.Context) { log.NewInfo(req.CommID.OperationID, "AddFriend args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil" + errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.CommID.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -213,9 +213,9 @@ func AddFriendResponse(c *gin.Context) { utils.CopyStructFields(req, ¶ms) log.NewInfo(req.CommID.OperationID, "AddFriendResponse args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil" + errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.CommID.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -268,9 +268,9 @@ func DeleteFriend(c *gin.Context) { log.NewInfo(req.CommID.OperationID, "DeleteFriend args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil" + errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.CommID.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -322,9 +322,9 @@ func GetBlacklist(c *gin.Context) { log.NewInfo(req.CommID.OperationID, "GetBlacklist args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil" + errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.CommID.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -383,9 +383,9 @@ func SetFriendRemark(c *gin.Context) { log.NewInfo(req.CommID.OperationID, "SetFriendComment args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil" + errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.CommID.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -436,9 +436,9 @@ func RemoveBlack(c *gin.Context) { } log.NewInfo(req.CommID.OperationID, "RemoveBlacklist args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil" + errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.CommID.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -490,9 +490,9 @@ func IsFriend(c *gin.Context) { log.NewInfo(req.CommID.OperationID, "IsFriend args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil" + errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.CommID.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -545,9 +545,9 @@ func GetFriendList(c *gin.Context) { log.NewInfo(req.CommID.OperationID, "GetFriendList args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil" + errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.CommID.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -601,9 +601,9 @@ func GetFriendApplyList(c *gin.Context) { log.NewInfo(req.CommID.OperationID, "GetFriendApplyList args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil" + errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.CommID.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -657,9 +657,9 @@ func GetSelfFriendApplyList(c *gin.Context) { log.NewInfo(req.CommID.OperationID, "GetSelfApplyList args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.CommID.OperationID) if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil" + errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.CommID.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return diff --git a/internal/api/group/group.go b/internal/api/group/group.go index f14046b3d..bdb4edc69 100644 --- a/internal/api/group/group.go +++ b/internal/api/group/group.go @@ -57,9 +57,9 @@ func KickGroupMember(c *gin.Context) { log.NewInfo(req.OperationID, "KickGroupMember args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -120,9 +120,9 @@ func GetGroupMembersInfo(c *gin.Context) { log.NewInfo(req.OperationID, "GetGroupMembersInfo args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -164,9 +164,9 @@ func GetGroupMemberList(c *gin.Context) { log.NewInfo(req.OperationID, "GetGroupMemberList args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -221,9 +221,9 @@ func GetGroupAllMemberList(c *gin.Context) { log.NewInfo(req.OperationID, "GetGroupAllMember args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -277,9 +277,9 @@ func GetJoinedGroupList(c *gin.Context) { log.NewInfo(req.OperationID, "GetJoinedGroupList args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -337,9 +337,9 @@ func InviteUserToGroup(c *gin.Context) { log.NewInfo(req.OperationID, "InviteUserToGroup args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -407,9 +407,9 @@ func CreateGroup(c *gin.Context) { log.NewInfo(req.OperationID, "CreateGroup args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -463,9 +463,9 @@ func GetRecvGroupApplicationList(c *gin.Context) { } log.NewInfo(req.OperationID, "GetGroupApplicationList args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -515,9 +515,9 @@ func GetUserReqGroupApplicationList(c *gin.Context) { return } log.NewInfo(req.OperationID, "GetGroupsInfo args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -569,9 +569,9 @@ func GetGroupsInfo(c *gin.Context) { } log.NewInfo(req.OperationID, "GetGroupsInfo args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -639,9 +639,9 @@ func ApplicationGroupResponse(c *gin.Context) { log.NewInfo(req.OperationID, "ApplicationGroupResponse args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -692,9 +692,9 @@ func JoinGroup(c *gin.Context) { } log.NewInfo(req.OperationID, "JoinGroup args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -746,9 +746,9 @@ func QuitGroup(c *gin.Context) { log.NewInfo(req.OperationID, "QuitGroup args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -800,9 +800,9 @@ func SetGroupInfo(c *gin.Context) { log.NewInfo(req.OperationID, "SetGroupInfo args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -867,9 +867,9 @@ func TransferGroupOwner(c *gin.Context) { log.NewInfo(req.OperationID, "TransferGroupOwner args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -921,9 +921,9 @@ func DismissGroup(c *gin.Context) { log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -975,9 +975,9 @@ func MuteGroupMember(c *gin.Context) { log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -1029,9 +1029,9 @@ func CancelMuteGroupMember(c *gin.Context) { log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -1083,9 +1083,9 @@ func MuteGroup(c *gin.Context) { log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -1137,9 +1137,9 @@ func CancelMuteGroup(c *gin.Context) { log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -1181,9 +1181,9 @@ func SetGroupMemberNickname(c *gin.Context) { log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -1252,9 +1252,9 @@ func SetGroupMemberInfo(c *gin.Context) { reqPb.RoleLevel = &wrappers.Int32Value{Value: *req.RoleLevel} } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", reqPb.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -1291,9 +1291,9 @@ func GetGroupAbstractInfo(c *gin.Context) { return } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return diff --git a/internal/api/group/super_group.go b/internal/api/group/super_group.go index 27a0aa841..9911ee7b4 100644 --- a/internal/api/group/super_group.go +++ b/internal/api/group/super_group.go @@ -31,9 +31,9 @@ func GetJoinedSuperGroupList(c *gin.Context) { return } reqPb := rpc.GetJoinedSuperGroupListReq{OperationID: req.OperationID, OpUserID: opUserID, UserID: req.FromUserID} - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -67,9 +67,9 @@ func GetSuperGroupsInfo(c *gin.Context) { return } reqPb := rpc.GetSuperGroupsInfoReq{OperationID: req.OperationID, OpUserID: opUserID, GroupIDList: req.GroupIDList} - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return diff --git a/internal/api/manage/management_chat.go b/internal/api/manage/management_chat.go index 7d0efcc32..b65294379 100644 --- a/internal/api/manage/management_chat.go +++ b/internal/api/manage/management_chat.go @@ -10,20 +10,21 @@ import ( api "Open_IM/pkg/base_info" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" "Open_IM/pkg/common/log" "Open_IM/pkg/common/token_verify" "Open_IM/pkg/grpc-etcdv3/getcdv3" pbChat "Open_IM/pkg/proto/msg" - "Open_IM/pkg/proto/sdk_ws" open_im_sdk "Open_IM/pkg/proto/sdk_ws" "Open_IM/pkg/utils" "context" + "net/http" + "strings" + "github.com/gin-gonic/gin" "github.com/go-playground/validator/v10" "github.com/golang/protobuf/proto" "github.com/mitchellh/mapstructure" - "net/http" - "strings" ) var validate *validator.Validate @@ -206,9 +207,9 @@ func ManagementSendMsg(c *gin.Context) { pbData := newUserSendMsgReq(¶ms) log.Info(params.OperationID, "", "api ManagementSendMsg call start..., [data: %s]", pbData.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, params.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, params.OperationID) if etcdConn == nil { - errMsg := params.OperationID + "getcdv3.GetConn == nil" + errMsg := params.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(params.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -231,7 +232,7 @@ func ManagementSendMsg(c *gin.Context) { } } log.Info(params.OperationID, "", "api ManagementSendMsg call end..., [data: %s] [reply: %s]", pbData.String(), RpcResp.String()) - resp := api.ManagementSendMsgResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, ResultList: server_api_params.UserSendMsgResp{ServerMsgID: RpcResp.ServerMsgID, ClientMsgID: RpcResp.ClientMsgID, SendTime: RpcResp.SendTime}} + resp := api.ManagementSendMsgResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, ResultList: open_im_sdk.UserSendMsgResp{ServerMsgID: RpcResp.ServerMsgID, ClientMsgID: RpcResp.ClientMsgID, SendTime: RpcResp.SendTime}} log.Info(params.OperationID, "ManagementSendMsg return", resp) c.JSON(http.StatusOK, resp) } @@ -319,9 +320,9 @@ func ManagementBatchSendMsg(c *gin.Context) { log.NewInfo(params.OperationID, "Ws call success to ManagementSendMsgReq", params) var msgSendFailedFlag bool - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, params.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, params.OperationID) if etcdConn == nil { - errMsg := params.OperationID + "getcdv3.GetConn == nil" + errMsg := params.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(params.OperationID, errMsg) //resp.Data.FailedIDList = params.RecvIDList c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": "rpc server error: etcdConn == nil"}) @@ -332,7 +333,17 @@ func ManagementBatchSendMsg(c *gin.Context) { ManagementSendMsg: params.ManagementSendMsg, } pbData := newUserSendMsgReq(req) - for _, recvID := range params.RecvIDList { + var recvList []string + if params.IsSendAll { + recvList, err = im_mysql_model.SelectAllUserID() + if err != nil { + log.NewError(params.OperationID, utils.GetSelfFuncName(), err.Error()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) + } + } else { + recvList = params.RecvIDList + } + for _, recvID := range recvList { pbData.MsgData.RecvID = recvID log.Info(params.OperationID, "", "api ManagementSendMsg call start..., ", pbData.String()) @@ -378,9 +389,9 @@ func CheckMsgIsSendSuccess(c *gin.Context) { log.Error(c.PostForm("operationID"), "json unmarshal err", err.Error(), c.PostForm("content")) return } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return diff --git a/internal/api/manage/management_user.go b/internal/api/manage/management_user.go index eb2985258..bbbfb2f2c 100644 --- a/internal/api/manage/management_user.go +++ b/internal/api/manage/management_user.go @@ -17,9 +17,10 @@ import ( rpc "Open_IM/pkg/proto/user" "Open_IM/pkg/utils" "context" - "github.com/gin-gonic/gin" "net/http" "strings" + + "github.com/gin-gonic/gin" ) func DeleteUser(c *gin.Context) { @@ -42,9 +43,9 @@ func DeleteUser(c *gin.Context) { } log.NewInfo(params.OperationID, "DeleteUser args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -97,9 +98,9 @@ func GetAllUsersUid(c *gin.Context) { } log.NewInfo(params.OperationID, "GetAllUsersUid args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -152,9 +153,9 @@ func AccountCheck(c *gin.Context) { } log.NewInfo(params.OperationID, "AccountCheck args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -198,7 +199,7 @@ func GetUsersOnlineStatus(c *gin.Context) { var wsResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult var respResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult flag := false - grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImRelayName) + grpcCons := getcdv3.GetDefaultGatewayConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), params.OperationID) for _, v := range grpcCons { client := pbRelay.NewRelayClient(v) reply, err := client.GetUsersOnlineStatus(context.Background(), req) diff --git a/internal/api/msg/del_msg.go b/internal/api/msg/del_msg.go index 3fefd0c11..07322f8d9 100644 --- a/internal/api/msg/del_msg.go +++ b/internal/api/msg/del_msg.go @@ -54,9 +54,9 @@ func DelMsg(c *gin.Context) { return } - grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, req.OperationID) + grpcConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, req.OperationID) if grpcConn == nil { - errMsg := req.OperationID + " getcdv3.GetConn == nil" + errMsg := req.OperationID + " getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -130,9 +130,9 @@ func DelSuperGroupMsg(c *gin.Context) { c.JSON(http.StatusOK, resp) } log.Info(req.OperationID, "", "api DelSuperGroupMsg call start..., [data: %s]", pbData.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -203,9 +203,9 @@ func ClearMsg(c *gin.Context) { log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + " getcdv3.GetConn == nil" + errMsg := req.OperationID + " getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -251,9 +251,9 @@ func SetMsgMinSeq(c *gin.Context) { return } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + " getcdv3.GetConn == nil" + errMsg := req.OperationID + " getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return diff --git a/internal/api/msg/get_max_min_seq.go b/internal/api/msg/get_max_min_seq.go index 193fc9322..5b5a7a551 100644 --- a/internal/api/msg/get_max_min_seq.go +++ b/internal/api/msg/get_max_min_seq.go @@ -35,9 +35,9 @@ func GetSeq(c *gin.Context) { pbData := sdk_ws.GetMaxAndMinSeqReq{} pbData.UserID = params.SendID pbData.OperationID = params.OperationID - grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, pbData.OperationID) + grpcConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, pbData.OperationID) if grpcConn == nil { - errMsg := pbData.OperationID + " getcdv3.GetConn == nil" + errMsg := pbData.OperationID + " getcdv3.GetDefaultConn == nil" log.NewError(pbData.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return diff --git a/internal/api/msg/pull_msg.go b/internal/api/msg/pull_msg.go index 418c3b708..9e27619bd 100644 --- a/internal/api/msg/pull_msg.go +++ b/internal/api/msg/pull_msg.go @@ -51,9 +51,9 @@ func PullMsgBySeqList(c *gin.Context) { pbData.OperationID = params.OperationID pbData.SeqList = params.SeqList - grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, pbData.OperationID) + grpcConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, pbData.OperationID) if grpcConn == nil { - errMsg := pbData.OperationID + "getcdv3.GetConn == nil" + errMsg := pbData.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(pbData.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return diff --git a/internal/api/msg/send_msg.go b/internal/api/msg/send_msg.go index 7b41d0866..93502fe33 100644 --- a/internal/api/msg/send_msg.go +++ b/internal/api/msg/send_msg.go @@ -71,9 +71,9 @@ func SendMsg(c *gin.Context) { pbData := newUserSendMsgReq(token, ¶ms) log.Info(params.OperationID, "", "api SendMsg call start..., [data: %s]", pbData.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, params.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, params.OperationID) if etcdConn == nil { - errMsg := params.OperationID + "getcdv3.GetConn == nil" + errMsg := params.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(params.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return diff --git a/internal/api/office/tag.go b/internal/api/office/tag.go index c64e736cd..d16d514e0 100644 --- a/internal/api/office/tag.go +++ b/internal/api/office/tag.go @@ -54,9 +54,9 @@ func GetUserTags(c *gin.Context) { reqPb.UserID = userID reqPb.OperationID = req.OperationID - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -119,9 +119,9 @@ func CreateTag(c *gin.Context) { } reqPb.UserID = userID - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -179,9 +179,9 @@ func DeleteTag(c *gin.Context) { } reqPb.UserID = userID - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -239,9 +239,9 @@ func SetTag(c *gin.Context) { } reqPb.UserID = userID - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -299,9 +299,9 @@ func SendMsg2Tag(c *gin.Context) { } reqPb.SendID = userID - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -361,9 +361,9 @@ func GetTagSendLogs(c *gin.Context) { PageNumber: req.PageNumber, ShowNumber: req.ShowNumber, } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -428,9 +428,9 @@ func GetUserTagByID(c *gin.Context) { reqPb.UserID = userID reqPb.OperationID = req.OperationID reqPb.TagID = req.TagID - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return diff --git a/internal/api/office/work_moments.go b/internal/api/office/work_moments.go index 0c37f5b1d..7a8a8d7d7 100644 --- a/internal/api/office/work_moments.go +++ b/internal/api/office/work_moments.go @@ -56,9 +56,9 @@ func CreateOneWorkMoment(c *gin.Context) { log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) } reqPb.WorkMoment.UserID = userID - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -120,9 +120,9 @@ func DeleteOneWorkMoment(c *gin.Context) { log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) } reqPb.UserID = userID - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -183,9 +183,9 @@ func LikeOneWorkMoment(c *gin.Context) { log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) } reqPb.UserID = userID - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -245,9 +245,9 @@ func CommentOneWorkMoment(c *gin.Context) { log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) } reqPb.UserID = userID - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -305,9 +305,9 @@ func DeleteComment(c *gin.Context) { return } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -366,9 +366,9 @@ func GetWorkMomentByID(c *gin.Context) { reqPb.OperationID = req.OperationID reqPb.OpUserID = userID reqPb.WorkMomentID = req.WorkMomentID - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -436,9 +436,9 @@ func GetUserWorkMoments(c *gin.Context) { } reqPb.OpUserID = opUserID reqPb.UserID = req.UserID - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -548,9 +548,9 @@ func GetUserFriendWorkMoments(c *gin.Context) { ShowNumber: req.ShowNumber, } reqPb.UserID = userID - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -649,9 +649,9 @@ func SetUserWorkMomentsLevel(c *gin.Context) { log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) } reqPb.UserID = userID - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfficeName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return diff --git a/internal/api/organization/organization.go b/internal/api/organization/organization.go index 1d6542306..42b6a9de7 100644 --- a/internal/api/organization/organization.go +++ b/internal/api/organization/organization.go @@ -48,9 +48,9 @@ func CreateDepartment(c *gin.Context) { } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -103,9 +103,9 @@ func UpdateDepartment(c *gin.Context) { } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -156,9 +156,9 @@ func GetSubDepartment(c *gin.Context) { } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -212,9 +212,9 @@ func DeleteDepartment(c *gin.Context) { return } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -266,9 +266,9 @@ func CreateOrganizationUser(c *gin.Context) { return } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -319,9 +319,9 @@ func UpdateOrganizationUser(c *gin.Context) { return } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -372,9 +372,9 @@ func CreateDepartmentMember(c *gin.Context) { return } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -425,9 +425,9 @@ func GetUserInDepartment(c *gin.Context) { return } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -479,9 +479,9 @@ func UpdateUserInDepartment(c *gin.Context) { return } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -532,9 +532,9 @@ func DeleteOrganizationUser(c *gin.Context) { return } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -584,9 +584,9 @@ func GetDepartmentMember(c *gin.Context) { return } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -637,9 +637,9 @@ func DeleteUserInDepartment(c *gin.Context) { return } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "api args ", req.String(), "params", params) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return diff --git a/internal/api/user/user.go b/internal/api/user/user.go index f3f1db720..bef11c3a9 100644 --- a/internal/api/user/user.go +++ b/internal/api/user/user.go @@ -14,9 +14,10 @@ import ( rpc "Open_IM/pkg/proto/user" "Open_IM/pkg/utils" "context" - "github.com/gin-gonic/gin" "net/http" "strings" + + "github.com/gin-gonic/gin" ) func GetUsersInfoFromCache(c *gin.Context) { @@ -38,9 +39,9 @@ func GetUsersInfoFromCache(c *gin.Context) { c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": errMsg}) return } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -86,9 +87,9 @@ func GetFriendIDListFromCache(c *gin.Context) { c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -128,9 +129,9 @@ func GetBlackIDListFromCache(c *gin.Context) { c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -181,9 +182,9 @@ func GetUsersInfo(c *gin.Context) { log.NewInfo(params.OperationID, "GetUserInfo args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -239,9 +240,9 @@ func UpdateUserInfo(c *gin.Context) { return } log.NewInfo(params.OperationID, "UpdateUserInfo args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -290,9 +291,9 @@ func SetGlobalRecvMessageOpt(c *gin.Context) { return } log.NewInfo(params.OperationID, "SetGlobalRecvMessageOpt args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -346,9 +347,9 @@ func GetSelfUserInfo(c *gin.Context) { req.UserIDList = append(req.UserIDList, params.UserID) log.NewInfo(params.OperationID, "GetUserInfo args ", req.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -414,7 +415,7 @@ func GetUsersOnlineStatus(c *gin.Context) { var wsResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult var respResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult flag := false - grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImRelayName) + grpcCons := getcdv3.GetDefaultGatewayConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), params.OperationID) for _, v := range grpcCons { log.Debug(params.OperationID, "get node ", *v, v.Target()) client := pbRelay.NewRelayClient(v) diff --git a/internal/cms_api/admin/admin.go b/internal/cms_api/admin/admin.go index 4583afd2c..c71689c57 100644 --- a/internal/cms_api/admin/admin.go +++ b/internal/cms_api/admin/admin.go @@ -11,13 +11,15 @@ import ( pbCommon "Open_IM/pkg/proto/sdk_ws" "Open_IM/pkg/utils" "context" - "github.com/minio/minio-go/v7" - "github.com/minio/minio-go/v7/pkg/credentials" "net/http" "strings" - "github.com/gin-gonic/gin" + "github.com/minio/minio-go/v7" + "github.com/minio/minio-go/v7/pkg/credentials" + url2 "net/url" + + "github.com/gin-gonic/gin" ) var ( @@ -71,9 +73,9 @@ func AdminLogin(c *gin.Context) { reqPb.Secret = req.Secret reqPb.AdminID = req.AdminName reqPb.OperationID = utils.OperationIDGenerator() - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAdminCMSName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAdminCMSName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -100,7 +102,7 @@ func AddUserRegisterAddFriendIDList(c *gin.Context) { return } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAdminCMSName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAdminCMSName, req.OperationID) if etcdConn == nil { errMsg := req.OperationID + "getcdv3.GetConn == nil" log.NewError(req.OperationID, errMsg) @@ -128,7 +130,7 @@ func ReduceUserRegisterAddFriendIDList(c *gin.Context) { return } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAdminCMSName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAdminCMSName, req.OperationID) if etcdConn == nil { errMsg := req.OperationID + "getcdv3.GetConn == nil" log.NewError(req.OperationID, errMsg) @@ -156,7 +158,7 @@ func GetUserRegisterAddFriendIDList(c *gin.Context) { return } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAdminCMSName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAdminCMSName, req.OperationID) if etcdConn == nil { errMsg := req.OperationID + "getcdv3.GetConn == nil" log.NewError(req.OperationID, errMsg) diff --git a/internal/cms_api/group/group.go b/internal/cms_api/group/group.go index 9e7f75a34..a3e58a645 100644 --- a/internal/cms_api/group/group.go +++ b/internal/cms_api/group/group.go @@ -32,9 +32,9 @@ func GetGroupByID(c *gin.Context) { reqPb.OperationID = utils.OperationIDGenerator() log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req) reqPb.GroupID = req.GroupID - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -69,9 +69,9 @@ func GetGroups(c *gin.Context) { log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req) reqPb.Pagination = &commonPb.RequestPagination{} utils.CopyStructFields(&reqPb.Pagination, req) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -113,9 +113,9 @@ func GetGroupByName(c *gin.Context) { reqPb.GroupName = req.GroupName reqPb.Pagination = &commonPb.RequestPagination{} utils.CopyStructFields(&reqPb.Pagination, req) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -165,9 +165,9 @@ func CreateGroup(c *gin.Context) { RoleLevel: 1, }) } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -201,9 +201,9 @@ func GetGroupMembers(c *gin.Context) { } reqPb.GroupID = req.GroupID reqPb.UserName = req.UserName - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -244,9 +244,9 @@ func AddGroupMembers(c *gin.Context) { log.NewInfo("", utils.GetSelfFuncName(), "req: ", req) reqPb.UserIDList = req.Members reqPb.GroupID = req.GroupId - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -279,9 +279,9 @@ func RemoveGroupMembers(c *gin.Context) { log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req) reqPb.UserIDList = req.Members reqPb.GroupID = req.GroupId - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -315,9 +315,9 @@ func SetGroupOwner(c *gin.Context) { reqPb.GroupID = req.GroupId reqPb.UserID = req.UserId reqPb.RoleLevel = constant.GroupOwner - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -348,9 +348,9 @@ func SetGroupOrdinaryUsers(c *gin.Context) { reqPb.GroupID = req.GroupId reqPb.UserID = req.UserId reqPb.RoleLevel = constant.GroupOrdinaryUsers - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -386,9 +386,9 @@ func AlterGroupInfo(c *gin.Context) { Notification: req.Notification, FaceURL: req.ProfilePhoto, } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return diff --git a/internal/cms_api/message_cms/message.go b/internal/cms_api/message_cms/message.go index bd5949771..6cfda0ebc 100644 --- a/internal/cms_api/message_cms/message.go +++ b/internal/cms_api/message_cms/message.go @@ -23,9 +23,9 @@ func BroadcastMessage(c *gin.Context) { reqPb pbMessage.BoradcastMessageReq ) reqPb.OperationID = utils.OperationIDGenerator() - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMessageCMSName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMessageCMSName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -45,9 +45,9 @@ func MassSendMassage(c *gin.Context) { reqPb pbMessage.MassSendMessageReq ) reqPb.OperationID = utils.OperationIDGenerator() - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMessageCMSName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMessageCMSName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -67,9 +67,9 @@ func WithdrawMessage(c *gin.Context) { reqPb pbMessage.WithdrawMessageReq ) reqPb.OperationID = utils.OperationIDGenerator() - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMessageCMSName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMessageCMSName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -101,9 +101,9 @@ func GetChatLogs(c *gin.Context) { } utils.CopyStructFields(&reqPb, &req) log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMessageCMSName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMessageCMSName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return diff --git a/internal/cms_api/statistics/statistics.go b/internal/cms_api/statistics/statistics.go index b33bdee12..4afdf5673 100644 --- a/internal/cms_api/statistics/statistics.go +++ b/internal/cms_api/statistics/statistics.go @@ -31,9 +31,9 @@ func GetMessagesStatistics(c *gin.Context) { reqPb.OperationID = utils.OperationIDGenerator() log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req) utils.CopyStructFields(&reqPb.StatisticsReq, &req) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImStatisticsName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImStatisticsName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -85,9 +85,9 @@ func GetUserStatistics(c *gin.Context) { reqPb.OperationID = utils.OperationIDGenerator() log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req) utils.CopyStructFields(&reqPb.StatisticsReq, &req) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImStatisticsName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImStatisticsName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -149,9 +149,9 @@ func GetGroupStatistics(c *gin.Context) { reqPb.OperationID = utils.OperationIDGenerator() log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req) utils.CopyStructFields(&reqPb.StatisticsReq, &req) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImStatisticsName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImStatisticsName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -206,9 +206,9 @@ func GetActiveUser(c *gin.Context) { reqPb.OperationID = utils.OperationIDGenerator() log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req) utils.CopyStructFields(&reqPb.StatisticsReq, req) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImStatisticsName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImStatisticsName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -240,9 +240,9 @@ func GetActiveGroup(c *gin.Context) { reqPb.OperationID = utils.OperationIDGenerator() log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req) utils.CopyStructFields(&reqPb.StatisticsReq, req) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImStatisticsName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImStatisticsName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return diff --git a/internal/cms_api/user/user.go b/internal/cms_api/user/user.go index cf23dd3bc..f6d2071ad 100644 --- a/internal/cms_api/user/user.go +++ b/internal/cms_api/user/user.go @@ -32,9 +32,9 @@ func GetUserById(c *gin.Context) { reqPb.OperationID = utils.OperationIDGenerator() log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req) utils.CopyStructFields(&reqPb, &req) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -74,9 +74,9 @@ func GetUsersByName(c *gin.Context) { PageNumber: int32(req.PageNumber), ShowNumber: int32(req.ShowNumber), } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -111,9 +111,9 @@ func GetUsers(c *gin.Context) { reqPb.OperationID = utils.OperationIDGenerator() log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req) utils.CopyStructFields(&reqPb.Pagination, &req) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -147,9 +147,9 @@ func ResignUser(c *gin.Context) { reqPb.OperationID = utils.OperationIDGenerator() log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req) utils.CopyStructFields(&reqPb, &req) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -177,9 +177,9 @@ func AlterUser(c *gin.Context) { reqPb.OperationID = utils.OperationIDGenerator() log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req) utils.CopyStructFields(&reqPb, &req) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -206,7 +206,7 @@ func AddUser(c *gin.Context) { reqPb.OperationID = utils.OperationIDGenerator() log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req) utils.CopyStructFields(&reqPb, &req) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID) if etcdConn == nil { errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" log.NewError(reqPb.OperationID, errMsg) @@ -237,9 +237,9 @@ func BlockUser(c *gin.Context) { reqPb.OperationID = utils.OperationIDGenerator() log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req) utils.CopyStructFields(&reqPb, &req) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -268,9 +268,9 @@ func UnblockUser(c *gin.Context) { reqPb.OperationID = utils.OperationIDGenerator() log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req) utils.CopyStructFields(&reqPb, &req) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -302,9 +302,9 @@ func GetBlockUsers(c *gin.Context) { log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req) utils.CopyStructFields(&reqPb.Pagination, &req) log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "blockUsers", reqPb.Pagination, req) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -354,9 +354,9 @@ func GetBlockUserById(c *gin.Context) { reqPb.OperationID = utils.OperationIDGenerator() log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req) reqPb.UserId = req.UserId - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return @@ -388,9 +388,9 @@ func DeleteUser(c *gin.Context) { reqPb.OperationID = utils.OperationIDGenerator() log.NewInfo(reqPb.OperationID, utils.GetSelfFuncName(), "req: ", req) reqPb.UserId = req.UserId - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, reqPb.OperationID) if etcdConn == nil { - errMsg := reqPb.OperationID + "getcdv3.GetConn == nil" + errMsg := reqPb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(reqPb.OperationID, errMsg) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) return diff --git a/internal/demo/register/onboarding_process.go b/internal/demo/register/onboarding_process.go index 53ae1f28b..bac5a244c 100644 --- a/internal/demo/register/onboarding_process.go +++ b/internal/demo/register/onboarding_process.go @@ -90,9 +90,9 @@ func createOrganizationUser(operationID, userID, userName, phoneNumber, email st log.NewInfo(operationID, utils.GetSelfFuncName(), userID) }() log.NewInfo(operationID, utils.GetSelfFuncName(), "start createOrganizationUser") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, operationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, operationID) if etcdConn == nil { - errMsg := operationID + "getcdv3.GetConn == nil" + errMsg := operationID + "getcdv3.GetDefaultConn == nil" log.NewError(operationID, errMsg) return errors.New(errMsg) } @@ -129,9 +129,9 @@ func joinTestDepartment(operationID, userID, departmentID string) error { defer func() { log.NewInfo(operationID, utils.GetSelfFuncName(), userID) }() - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, operationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, operationID) if etcdConn == nil { - errMsg := operationID + "getcdv3.GetConn == nil" + errMsg := operationID + "getcdv3.GetDefaultConn == nil" log.NewError(operationID, errMsg) return errors.New(errMsg) } @@ -161,9 +161,9 @@ func GetDepartmentGroupIDList(operationID, departmentID string) ([]string, error defer func() { log.NewInfo(operationID, utils.GetSelfFuncName(), departmentID) }() - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, operationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, operationID) if etcdConn == nil { - errMsg := operationID + "getcdv3.GetConn == nil" + errMsg := operationID + "getcdv3.GetDefaultConn == nil" log.NewError(operationID, errMsg) return nil, errors.New(errMsg) } @@ -200,9 +200,9 @@ func joinGroups(operationID, userID, userName, faceURL string, groupIDList []str defer func() { log.NewInfo(operationID, utils.GetSelfFuncName(), userID, groupIDList) }() - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, operationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, operationID) if etcdConn == nil { - errMsg := operationID + "getcdv3.GetConn == nil" + errMsg := operationID + "getcdv3.GetDefaultConn == nil" log.NewError(operationID, errMsg) return } diff --git a/internal/demo/register/register_import_friend.go b/internal/demo/register/register_import_friend.go index 01e3e7d16..8475ec78c 100644 --- a/internal/demo/register/register_import_friend.go +++ b/internal/demo/register/register_import_friend.go @@ -32,7 +32,7 @@ func ImportFriendRoutine() { return } req.FriendUserIDList = friendUserIDList - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.OperationID) if etcdConn == nil { errMsg := req.OperationID + "getcdv3.GetConn == nil" log.NewError(req.OperationID, errMsg) diff --git a/internal/msg_gateway/gate/batch_push.go b/internal/msg_gateway/gate/batch_push.go index d0154c260..4ea7b5658 100644 --- a/internal/msg_gateway/gate/batch_push.go +++ b/internal/msg_gateway/gate/batch_push.go @@ -89,9 +89,9 @@ func (r *RPCServer) GetSingleUserMsg(operationID string, currentMsgSeq uint32, u rpcReq.SeqList = seqList rpcReq.UserID = userID rpcReq.OperationID = operationID - grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, rpcReq.OperationID) + grpcConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, rpcReq.OperationID) if grpcConn == nil { - errMsg := "getcdv3.GetConn == nil" + errMsg := "getcdv3.GetDefaultConn == nil" log.NewError(rpcReq.OperationID, errMsg) return nil } diff --git a/internal/msg_gateway/gate/logic.go b/internal/msg_gateway/gate/logic.go index b9d132cd1..a6f3a1974 100644 --- a/internal/msg_gateway/gate/logic.go +++ b/internal/msg_gateway/gate/logic.go @@ -72,9 +72,9 @@ func (ws *WServer) getSeqReq(conn *UserConn, m *Req) { rpcReq.UserID = m.SendID rpcReq.OperationID = m.OperationID log.Debug(m.OperationID, "Ws call success to getMaxAndMinSeq", m.SendID, m.ReqIdentifier, m.MsgIncr, data.(sdk_ws.GetMaxAndMinSeqReq).GroupIDList) - grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, rpcReq.OperationID) + grpcConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, rpcReq.OperationID) if grpcConn == nil { - errMsg := rpcReq.OperationID + "getcdv3.GetConn == nil" + errMsg := rpcReq.OperationID + "getcdv3.GetDefaultConn == nil" nReply.ErrCode = 500 nReply.ErrMsg = errMsg log.NewError(rpcReq.OperationID, errMsg) @@ -127,9 +127,9 @@ func (ws *WServer) pullMsgBySeqListReq(conn *UserConn, m *Req) { rpcReq.OperationID = m.OperationID rpcReq.GroupSeqList = data.(sdk_ws.PullMessageBySeqListReq).GroupSeqList log.NewInfo(m.OperationID, "Ws call success to pullMsgBySeqListReq middle", m.SendID, m.ReqIdentifier, m.MsgIncr, data.(sdk_ws.PullMessageBySeqListReq).SeqList) - grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, m.OperationID) + grpcConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, m.OperationID) if grpcConn == nil { - errMsg := rpcReq.OperationID + "getcdv3.GetConn == nil" + errMsg := rpcReq.OperationID + "getcdv3.GetDefaultConn == nil" nReply.ErrCode = 500 nReply.ErrMsg = errMsg log.NewError(rpcReq.OperationID, errMsg) @@ -186,9 +186,9 @@ func (ws *WServer) sendMsgReq(conn *UserConn, m *Req) { MsgData: &data, } log.NewInfo(m.OperationID, "Ws call success to sendMsgReq middle", m.ReqIdentifier, m.SendID, m.MsgIncr, data.String()) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, m.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, m.OperationID) if etcdConn == nil { - errMsg := m.OperationID + "getcdv3.GetConn == nil" + errMsg := m.OperationID + "getcdv3.GetDefaultConn == nil" nReply.ErrCode = 500 nReply.ErrMsg = errMsg log.NewError(m.OperationID, errMsg) @@ -237,9 +237,9 @@ func (ws *WServer) sendSignalMsgReq(conn *UserConn, m *Req) { isPass, errCode, errMsg, pData := ws.argsValidate(m, constant.WSSendSignalMsg, m.OperationID) if isPass { signalResp := pbRtc.SignalResp{} - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImRealTimeCommName, m.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImRealTimeCommName, m.OperationID) if etcdConn == nil { - errMsg := m.OperationID + "getcdv3.GetConn == nil" + errMsg := m.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(m.OperationID, errMsg) ws.sendSignalMsgResp(conn, 204, errMsg, m, &signalResp) return @@ -267,9 +267,9 @@ func (ws *WServer) sendSignalMsgReq(conn *UserConn, m *Req) { } log.NewInfo(m.OperationID, utils.GetSelfFuncName(), "pbData: ", pbData) log.NewInfo(m.OperationID, "Ws call success to sendSignalMsgReq middle", m.ReqIdentifier, m.SendID, m.MsgIncr, msgData) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, m.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, m.OperationID) if etcdConn == nil { - errMsg := m.OperationID + "getcdv3.GetConn == nil" + errMsg := m.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(m.OperationID, errMsg) ws.sendSignalMsgResp(conn, 200, errMsg, m, &signalResp) return diff --git a/internal/msg_gateway/gate/ws_server.go b/internal/msg_gateway/gate/ws_server.go index b2ea4c6eb..2ed590bce 100644 --- a/internal/msg_gateway/gate/ws_server.go +++ b/internal/msg_gateway/gate/ws_server.go @@ -120,7 +120,7 @@ func (ws *WServer) SetWriteTimeoutWriteMsg(conn *UserConn, a int, msg []byte, ti } func (ws *WServer) MultiTerminalLoginRemoteChecker(userID string, platformID int32, token string, operationID string) { - grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImRelayName) + grpcCons := getcdv3.GetDefaultGatewayConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), operationID) log.NewInfo(operationID, utils.GetSelfFuncName(), "args grpcCons: ", userID, platformID, grpcCons) for _, v := range grpcCons { if v.Target() == rpcSvr.target { @@ -147,6 +147,11 @@ func (ws *WServer) MultiTerminalLoginCheckerWithLock(uid string, platformID int, defer rwLock.Unlock() log.NewInfo(operationID, utils.GetSelfFuncName(), " rpc args: ", uid, platformID, token) switch config.Config.MultiLoginPolicy { + case constant.PCAndOther: + if constant.PlatformNameToClass(constant.PlatformIDToName(platformID)) == constant.TerminalPC { + return + } + fallthrough case constant.AllLoginButSameTermKick: if oldConnMap, ok := ws.wsUserToConn[uid]; ok { // user->map[platform->conn] if oldConn, ok := oldConnMap[platformID]; ok { @@ -197,6 +202,11 @@ func (ws *WServer) MultiTerminalLoginCheckerWithLock(uid string, platformID int, func (ws *WServer) MultiTerminalLoginChecker(uid string, platformID int, newConn *UserConn, token string, operationID string) { switch config.Config.MultiLoginPolicy { + case constant.PCAndOther: + if constant.PlatformNameToClass(constant.PlatformIDToName(platformID)) == constant.TerminalPC { + return + } + fallthrough case constant.AllLoginButSameTermKick: if oldConnMap, ok := ws.wsUserToConn[uid]; ok { // user->map[platform->conn] if oldConn, ok := oldConnMap[platformID]; ok { diff --git a/internal/msg_transfer/logic/online_history_msg_handler.go b/internal/msg_transfer/logic/online_history_msg_handler.go index a8d23c916..537138dae 100644 --- a/internal/msg_transfer/logic/online_history_msg_handler.go +++ b/internal/msg_transfer/logic/online_history_msg_handler.go @@ -518,7 +518,7 @@ func sendMessageToPush(message *pbMsg.MsgDataToMQ, pushToUserID string) { log.Info(message.OperationID, "msg_transfer send message to push", "message", message.String()) rpcPushMsg := pbPush.PushMsgReq{OperationID: message.OperationID, MsgData: message.MsgData, PushToUserID: pushToUserID} mqPushMsg := pbMsg.PushMsgDataToMQ{OperationID: message.OperationID, MsgData: message.MsgData, PushToUserID: pushToUserID} - grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImPushName, message.OperationID) + grpcConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImPushName, message.OperationID) if grpcConn == nil { log.Error(rpcPushMsg.OperationID, "rpc dial failed", "push data", rpcPushMsg.String()) pid, offset, err := producer.SendMessage(&mqPushMsg, mqPushMsg.PushToUserID, rpcPushMsg.OperationID) diff --git a/internal/push/logic/push_to_client.go b/internal/push/logic/push_to_client.go index c398de5fb..766704e1b 100644 --- a/internal/push/logic/push_to_client.go +++ b/internal/push/logic/push_to_client.go @@ -21,8 +21,9 @@ import ( "Open_IM/pkg/utils" "context" "encoding/json" - "github.com/golang/protobuf/proto" "strings" + + "github.com/golang/protobuf/proto" ) type OpenIMContent struct { @@ -43,7 +44,7 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) { var wsResult []*pbRelay.SingelMsgToUserResultList isOfflinePush := utils.GetSwitchFromOptions(pushMsg.MsgData.Options, constant.IsOfflinePush) log.Debug(pushMsg.OperationID, "Get msg from msg_transfer And push msg", pushMsg.String()) - grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImRelayName) + grpcCons := getcdv3.GetDefaultGatewayConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), pushMsg.OperationID) var UIDList = []string{pushMsg.PushToUserID} callbackResp := callbackOnlinePush(pushMsg.OperationID, UIDList, pushMsg.MsgData) @@ -96,8 +97,8 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) { if pushMsg.MsgData.OfflinePushInfo != nil { content = pushMsg.MsgData.OfflinePushInfo.Title jsonCustomContent = pushMsg.MsgData.OfflinePushInfo.Desc - - } else { + } + if content == "" { switch pushMsg.MsgData.ContentType { case constant.Text: content = constant.ContentType2PushContent[constant.Text] @@ -176,9 +177,9 @@ func MsgToSuperGroupUser(pushMsg *pbPush.PushMsgReq) { } if len(pushToUserIDList) == 0 { getGroupMemberIDListFromCacheReq := &pbCache.GetGroupMemberIDListFromCacheReq{OperationID: pushMsg.OperationID, GroupID: pushMsg.MsgData.GroupID} - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, pushMsg.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, pushMsg.OperationID) if etcdConn == nil { - errMsg := pushMsg.OperationID + "getcdv3.GetConn == nil" + errMsg := pushMsg.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(pushMsg.OperationID, errMsg) return } @@ -195,7 +196,7 @@ func MsgToSuperGroupUser(pushMsg *pbPush.PushMsgReq) { pushToUserIDList = cacheResp.UserIDList } - grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImRelayName) + grpcCons := getcdv3.GetDefaultGatewayConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), pushMsg.OperationID) //Online push message log.Debug(pushMsg.OperationID, "len grpc", len(grpcCons), "data", pushMsg.String()) @@ -330,7 +331,7 @@ func GetOfflinePushOpts(pushMsg *pbPush.PushMsgReq) (opts push.PushOpts, err err // 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) +// etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) // client := pbGroup.NewGroupClient(etcdConn) // req := &pbGroup.Req{ // GroupID: m.RecvID, diff --git a/internal/rpc/auth/auth.go b/internal/rpc/auth/auth.go index 6bdedd091..a460a9033 100644 --- a/internal/rpc/auth/auth.go +++ b/internal/rpc/auth/auth.go @@ -15,7 +15,6 @@ import ( "net" "strconv" "strings" - "time" "Open_IM/pkg/common/config" @@ -30,6 +29,13 @@ func (rpc *rpcAuth) UserRegister(_ context.Context, req *pbAuth.UserRegisterReq) user.Birth = utils.UnixSecondToTime(int64(req.UserInfo.Birth)) } log.Debug(req.OperationID, "copy ", user, req.UserInfo) + Limited, LimitError := imdb.IsLimitRegisterIp(req.UserInfo.CreateIp) + if LimitError != nil { + return &pbAuth.UserRegisterResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: LimitError.Error()}}, nil + } + if Limited { + return &pbAuth.UserRegisterResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.RegisterLimit, ErrMsg: "Register Limit"}}, nil + } err := imdb.UserRegister(user) if err != nil { if err == constant.InvitationMsg { @@ -46,43 +52,20 @@ func (rpc *rpcAuth) UserRegister(_ context.Context, req *pbAuth.UserRegisterReq) func (rpc *rpcAuth) UserToken(_ context.Context, req *pbAuth.UserTokenReq) (*pbAuth.UserTokenResp, error) { log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " rpc args ", req.String()) - user, err := imdb.GetUserByUserID(req.FromUserID) + _, err := imdb.GetUserByUserID(req.FromUserID) if err != nil { errMsg := req.OperationID + " imdb.GetUserByUserID failed " + err.Error() + req.FromUserID log.NewError(req.OperationID, errMsg) return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}}, nil } - var Limited bool - var LimitError error - if user.LoginLimit == 0 { - Limited, LimitError = imdb.IsLimitLoginIp(req.LoginIp) - } else if user.LoginLimit == 1 { - Limited, LimitError = imdb.IsLimitUserLoginIp(user.UserID, req.LoginIp) - } else if user.LoginLimit == 2 { - Limited, LimitError = imdb.UserIsBlock(user.UserID) - } - if LimitError != nil { - return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: LimitError.Error()}}, nil - } - if Limited { - return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.LoginLimit, ErrMsg: "用户被限制"}}, nil - } + tokens, expTime, err := token_verify.CreateToken(req.FromUserID, int(req.Platform)) if err != nil { errMsg := req.OperationID + " token_verify.CreateToken failed " + err.Error() + req.FromUserID + utils.Int32ToString(req.Platform) log.NewError(req.OperationID, errMsg) return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}}, nil } - //增加用户登录信息 - user.LoginTimes = user.LoginTimes + 1 - user.LastLoginIp = req.LoginIp - user.LastLoginTime = time.Now() - err = imdb.UpdateUserInfo(*user) - if err != nil { - errMsg := req.OperationID + " imdb.UpdateUserInfo failed " + err.Error() + req.FromUserID - log.NewError(req.OperationID, errMsg) - return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}}, nil - } + log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " rpc return ", pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{}, Token: tokens, ExpiredTime: expTime}) return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{}, Token: tokens, ExpiredTime: expTime}, nil } @@ -110,7 +93,7 @@ func (rpc *rpcAuth) ForceLogout(_ context.Context, req *pbAuth.ForceLogoutReq) ( func (rpc *rpcAuth) forceKickOff(userID string, platformID int32, operationID string) error { log.NewInfo(operationID, utils.GetSelfFuncName(), " args ", userID, platformID) - grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImRelayName) + grpcCons := getcdv3.GetDefaultGatewayConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), operationID) for _, v := range grpcCons { client := pbRelay.NewRelayClient(v) kickReq := &pbRelay.KickUserOfflineReq{OperationID: operationID, KickUserIDList: []string{userID}, PlatformID: platformID} diff --git a/internal/rpc/conversation/conversaion.go b/internal/rpc/conversation/conversaion.go index fc9702ebc..023169a6b 100644 --- a/internal/rpc/conversation/conversaion.go +++ b/internal/rpc/conversation/conversaion.go @@ -5,6 +5,7 @@ import ( "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db" imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + rocksCache "Open_IM/pkg/common/db/rocks_cache" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" pbConversation "Open_IM/pkg/proto/conversation" @@ -73,6 +74,7 @@ func (rpc *rpcConversation) ModifyConversationField(c context.Context, req *pbCo err = imdb.UpdateColumnsConversations(haveUserID, req.Conversation.ConversationID, map[string]interface{}{"attached_info": conversation.AttachedInfo}) case constant.FieldUnread: isSyncConversation = false + err = imdb.UpdateColumnsConversations(haveUserID, req.Conversation.ConversationID, map[string]interface{}{"update_unread_count_time": utils.GetCurrentTimestampByMill()}) } if err != nil { log.NewError(req.OperationID, utils.GetSelfFuncName(), "UpdateColumnsConversations error", err.Error()) @@ -81,6 +83,7 @@ func (rpc *rpcConversation) ModifyConversationField(c context.Context, req *pbCo } for _, v := range utils.DifferenceString(haveUserID, req.UserIDList) { conversation.OwnerUserID = v + conversation.UpdateUnreadCountTime = utils.GetCurrentTimestampByMill() err := imdb.SetOneConversation(conversation) if err != nil { log.NewError(req.OperationID, utils.GetSelfFuncName(), "SetConversation error", err.Error()) @@ -88,6 +91,7 @@ func (rpc *rpcConversation) ModifyConversationField(c context.Context, req *pbCo return resp, nil } } + // notification if req.Conversation.ConversationType == constant.SingleChatType && req.FieldType == constant.FieldIsPrivateChat { //sync peer user conversation if conversation is singleChatType @@ -96,13 +100,20 @@ func (rpc *rpcConversation) ModifyConversationField(c context.Context, req *pbCo resp.CommonResp = &pbConversation.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg} return resp, nil } + } else { if isSyncConversation { for _, v := range req.UserIDList { + if err = rocksCache.DelConversationFromCache(v, req.Conversation.ConversationID); err != nil { + log.NewError(req.OperationID, utils.GetSelfFuncName(), v, req.Conversation.ConversationID, err.Error()) + } chat.ConversationChangeNotification(req.OperationID, v) } } else { for _, v := range req.UserIDList { + if err = rocksCache.DelConversationFromCache(v, req.Conversation.ConversationID); err != nil { + log.NewError(req.OperationID, utils.GetSelfFuncName(), v, req.Conversation.ConversationID, err.Error()) + } chat.ConversationUnreadChangeNotification(req.OperationID, v, req.Conversation.ConversationID) } } @@ -132,6 +143,10 @@ func syncPeerUserConversation(conversation *pbConversation.Conversation, operati log.NewError(operationID, utils.GetSelfFuncName(), "SetConversation error", err.Error()) return err } + err = rocksCache.DelConversationFromCache(conversation.UserID, utils.GetConversationIDBySessionType(conversation.OwnerUserID, constant.SingleChatType)) + if err != nil { + log.NewError(operationID, utils.GetSelfFuncName(), "DelConversationFromCache failed", err.Error()) + } chat.ConversationSetPrivateNotification(operationID, conversation.OwnerUserID, conversation.UserID, conversation.IsPrivateChat) return nil } diff --git a/internal/rpc/friend/friend.go b/internal/rpc/friend/friend.go index 6ce4d62da..6a699d278 100644 --- a/internal/rpc/friend/friend.go +++ b/internal/rpc/friend/friend.go @@ -100,9 +100,9 @@ func (s *friendServer) AddBlacklist(ctx context.Context, req *pbFriend.AddBlackl } log.NewInfo(req.CommID.OperationID, "AddBlacklist rpc ok ", req.CommID.FromUserID, req.CommID.ToUserID) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.CommID.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.CommID.OperationID) if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil" + errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.CommID.OperationID, errMsg) return &pbFriend.AddBlacklistResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, nil } @@ -211,9 +211,9 @@ func (s *friendServer) ImportFriend(ctx context.Context, req *pbFriend.ImportFri } } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) resp.CommonResp.ErrMsg = errMsg resp.CommonResp.ErrCode = 500 @@ -315,9 +315,9 @@ func (s *friendServer) AddFriendResponse(ctx context.Context, req *pbFriend.AddF } // cache rpc delFriendIDListFromCacheReq := &pbCache.DelFriendIDListFromCacheReq{OperationID: req.CommID.OperationID} - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.CommID.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.CommID.OperationID) if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil" + errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.CommID.OperationID, errMsg) return &pbFriend.AddFriendResponseResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, nil } @@ -378,9 +378,9 @@ func (s *friendServer) DeleteFriend(ctx context.Context, req *pbFriend.DeleteFri } log.NewInfo(req.CommID.OperationID, "DeleteFriend rpc ok") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.CommID.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.CommID.OperationID) if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil" + errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.CommID.OperationID, errMsg) return &pbFriend.DeleteFriendResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, nil } @@ -473,9 +473,9 @@ func (s *friendServer) RemoveBlacklist(ctx context.Context, req *pbFriend.Remove } log.NewInfo(req.CommID.OperationID, "rpc RemoveBlacklist ok ") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.CommID.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.CommID.OperationID) if etcdConn == nil { - errMsg := req.CommID.OperationID + "getcdv3.GetConn == nil" + errMsg := req.CommID.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.CommID.OperationID, errMsg) return &pbFriend.RemoveBlacklistResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, nil } diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index a8bb41dc2..beff56072 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -384,7 +384,7 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite haveConUserID = append(haveConUserID, v.OwnerUserID) } var reqPb pbUser.SetConversationReq - var c pbUser.Conversation + var c pbConversation.Conversation for _, v := range conversations { reqPb.OperationID = req.OperationID c.OwnerUserID = v.OwnerUserID @@ -399,9 +399,9 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite c.IsNotInGroup = false c.Ex = v.Ex reqPb.Conversation = &c - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) return &pbGroup.InviteUserToGroupResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}, nil } @@ -421,9 +421,9 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite c.GroupID = req.GroupID c.IsNotInGroup = false reqPb.Conversation = &c - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) return &pbGroup.InviteUserToGroupResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}, nil } @@ -443,9 +443,9 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite } } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) return &pbGroup.InviteUserToGroupResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}, nil } @@ -637,7 +637,7 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou } } var reqPb pbUser.SetConversationReq - var c pbUser.Conversation + var c pbConversation.Conversation for _, v := range okUserIDList { reqPb.OperationID = req.OperationID c.OwnerUserID = v @@ -646,9 +646,9 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou c.GroupID = req.GroupID c.IsNotInGroup = true reqPb.Conversation = &c - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) resp.ErrCode = constant.ErrInternal.ErrCode resp.ErrMsg = errMsg @@ -672,9 +672,9 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou } } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) return &pbGroup.KickGroupMemberResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}, nil } @@ -870,7 +870,7 @@ func (s *groupServer) GroupApplicationResponse(_ context.Context, req *pbGroup.G } var reqPb pbUser.SetConversationReq reqPb.OperationID = req.OperationID - var c pbUser.Conversation + var c pbConversation.Conversation conversation, err := imdb.GetConversation(req.FromUserID, utils.GetConversationIDBySessionType(req.GroupID, constant.GroupChatType)) if err != nil { c.OwnerUserID = req.FromUserID @@ -892,9 +892,9 @@ func (s *groupServer) GroupApplicationResponse(_ context.Context, req *pbGroup.G c.Ex = conversation.Ex } reqPb.Conversation = &c - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) return &pbGroup.GroupApplicationResponseResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, nil } @@ -906,9 +906,9 @@ func (s *groupServer) GroupApplicationResponse(_ context.Context, req *pbGroup.G log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "SetConversation success", respPb.String()) } - etcdCacheConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) + etcdCacheConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) if etcdCacheConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) return &pbGroup.GroupApplicationResponseResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, nil } @@ -977,9 +977,9 @@ func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) log.NewError(req.OperationID, "InsertIntoGroupMember failed ", err.Error(), groupMember) return &pbGroup.JoinGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) return &pbGroup.JoinGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: constant.ErrInternal.ErrMsg}}, nil } @@ -1064,7 +1064,7 @@ func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq) } //modify quitter conversation info var reqPb pbUser.SetConversationReq - var c pbUser.Conversation + var c pbConversation.Conversation reqPb.OperationID = req.OperationID c.OwnerUserID = req.OpUserID c.ConversationID = utils.GetConversationIDBySessionType(req.GroupID, constant.GroupChatType) @@ -1072,9 +1072,9 @@ func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq) c.GroupID = req.GroupID c.IsNotInGroup = true reqPb.Conversation = &c - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) return &pbGroup.QuitGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, nil } @@ -1093,9 +1093,9 @@ func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq) } } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) return &pbGroup.QuitGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: constant.ErrInternal.ErrMsg}}, nil } @@ -1248,9 +1248,9 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf if req.GroupInfoForSet.Notification != "" { //get group member user id getGroupMemberIDListFromCacheReq := &pbCache.GetGroupMemberIDListFromCacheReq{OperationID: req.OperationID, GroupID: req.GroupInfoForSet.GroupID} - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) return &pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, http.WrapError(constant.ErrInternal) } @@ -1277,9 +1277,9 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf conversationReq.FieldType = constant.FieldGroupAtType conversation.GroupAtType = constant.GroupNotification conversationReq.UserIDList = cacheResp.UserIDList - nEtcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName, req.OperationID) + nEtcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) return &pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, http.WrapError(constant.ErrInternal) } @@ -1449,9 +1449,9 @@ func (s *groupServer) OperateUserRole(_ context.Context, req *pbGroup.OperateUse log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetGroupMaster failed", err.Error()) return resp, http.WrapError(constant.ErrDB) } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) return resp, http.WrapError(constant.ErrInternal) } @@ -1522,7 +1522,7 @@ func (s *groupServer) RemoveGroupMembersCMS(_ context.Context, req *pbGroup.Remo OpUserID: req.OpUserID, } var reqPb pbUser.SetConversationReq - var c pbUser.Conversation + var c pbConversation.Conversation for _, v := range resp.Success { reqPb.OperationID = req.OperationID c.OwnerUserID = v @@ -1531,9 +1531,9 @@ func (s *groupServer) RemoveGroupMembersCMS(_ context.Context, req *pbGroup.Remo c.GroupID = req.GroupID c.IsNotInGroup = true reqPb.Conversation = &c - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) return resp, http.WrapError(constant.ErrInternal) } @@ -1546,9 +1546,9 @@ func (s *groupServer) RemoveGroupMembersCMS(_ context.Context, req *pbGroup.Remo } } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) return resp, http.WrapError(constant.ErrDB) } @@ -1617,9 +1617,9 @@ func (s *groupServer) AddGroupMembersCMS(_ context.Context, req *pbGroup.AddGrou } } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) return resp, http.WrapError(constant.ErrDB) } @@ -1707,7 +1707,7 @@ func (s *groupServer) DismissGroup(ctx context.Context, req *pbGroup.DismissGrou } //modify quitter conversation info var reqPb pbUser.SetConversationReq - var c pbUser.Conversation + var c pbConversation.Conversation for _, v := range memberList { reqPb.OperationID = req.OperationID c.OwnerUserID = v.UserID @@ -1716,9 +1716,9 @@ func (s *groupServer) DismissGroup(ctx context.Context, req *pbGroup.DismissGrou c.GroupID = req.GroupID c.IsNotInGroup = true reqPb.Conversation = &c - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) return &pbGroup.DismissGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, nil } @@ -1744,9 +1744,9 @@ func (s *groupServer) DismissGroup(ctx context.Context, req *pbGroup.DismissGrou } } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) return &pbGroup.DismissGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: 500, ErrMsg: errMsg}}, nil } diff --git a/internal/rpc/msg/send_msg.go b/internal/rpc/msg/send_msg.go index b3cf8e5d7..ab39a3662 100644 --- a/internal/rpc/msg/send_msg.go +++ b/internal/rpc/msg/send_msg.go @@ -17,13 +17,14 @@ import ( "Open_IM/pkg/utils" "context" "errors" - go_redis "github.com/go-redis/redis/v8" - "github.com/golang/protobuf/proto" "math/rand" "strconv" "strings" "sync" "time" + + go_redis "github.com/go-redis/redis/v8" + "github.com/golang/protobuf/proto" ) //When the number of group members is greater than this value,Online users will be sent first,Guaranteed service availability @@ -82,9 +83,9 @@ func messageVerification(data *pbChat.SendMsgReq) (bool, int32, string, []string } log.NewDebug(data.OperationID, config.Config.MessageVerify.FriendVerify) reqGetBlackIDListFromCache := &cacheRpc.GetBlackIDListFromCacheReq{UserID: data.MsgData.RecvID, OperationID: data.OperationID} - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID) if etcdConn == nil { - errMsg := data.OperationID + "getcdv3.GetConn == nil" + errMsg := data.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(data.OperationID, errMsg) return true, 0, "", nil } @@ -105,9 +106,9 @@ func messageVerification(data *pbChat.SendMsgReq) (bool, int32, string, []string log.NewDebug(data.OperationID, config.Config.MessageVerify.FriendVerify) if config.Config.MessageVerify.FriendVerify { reqGetFriendIDListFromCache := &cacheRpc.GetFriendIDListFromCacheReq{UserID: data.MsgData.RecvID, OperationID: data.OperationID} - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID) if etcdConn == nil { - errMsg := data.OperationID + "getcdv3.GetConn == nil" + errMsg := data.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(data.OperationID, errMsg) return true, 0, "", nil } @@ -139,9 +140,9 @@ func messageVerification(data *pbChat.SendMsgReq) (bool, int32, string, []string return true, 0, "", nil } else { getGroupMemberIDListFromCacheReq := &pbCache.GetGroupMemberIDListFromCacheReq{OperationID: data.OperationID, GroupID: data.MsgData.GroupID} - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID) if etcdConn == nil { - errMsg := data.OperationID + "getcdv3.GetConn == nil" + errMsg := data.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(data.OperationID, errMsg) //return returnMsg(&replay, pb, 201, errMsg, "", 0) return false, 201, errMsg, nil @@ -414,9 +415,9 @@ func (rpc *rpcChat) SendMsg(_ context.Context, pb *pbChat.SendMsgReq) (*pbChat.S conversationReq.UserIDList = pb.MsgData.AtUserIDList conversation.GroupAtType = constant.AtMe } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName, pb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName, pb.OperationID) if etcdConn == nil { - errMsg := pb.OperationID + "getcdv3.GetConn == nil" + errMsg := pb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(pb.OperationID, errMsg) return } @@ -430,9 +431,9 @@ func (rpc *rpcChat) SendMsg(_ context.Context, pb *pbChat.SendMsgReq) (*pbChat.S if tag { conversationReq.UserIDList = utils.DifferenceString(atUserID, memberUserIDList) conversation.GroupAtType = constant.AtAll - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName, pb.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName, pb.OperationID) if etcdConn == nil { - errMsg := pb.OperationID + "getcdv3.GetConn == nil" + errMsg := pb.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(pb.OperationID, errMsg) return } @@ -876,9 +877,9 @@ func Notification(n *NotificationMsg) { offlineInfo.Ex = ex msg.OfflinePushInfo = &offlineInfo req.MsgData = &msg - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) return } @@ -899,7 +900,7 @@ func getOnlineAndOfflineUserIDList(memberList []string, m map[string][]string, o req.OperationID = operationID req.OpUserID = config.Config.Manager.AppManagerUid[0] flag := false - grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImRelayName) + grpcCons := getcdv3.GetDefaultGatewayConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), operationID) for _, v := range grpcCons { client := pbRelay.NewRelayClient(v) reply, err := client.GetUsersOnlineStatus(context.Background(), req) diff --git a/internal/rpc/msg/tag_send_msg.go b/internal/rpc/msg/tag_send_msg.go index eb3a60695..0783d740e 100644 --- a/internal/rpc/msg/tag_send_msg.go +++ b/internal/rpc/msg/tag_send_msg.go @@ -33,9 +33,9 @@ func TagSendMessage(operationID string, user *db.User, recvID, content string, s msgData.SenderPlatformID = senderPlatformID req.MsgData = &msgData req.OperationID = operationID - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, operationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImMsgName, operationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) return } diff --git a/internal/rpc/office/office.go b/internal/rpc/office/office.go index ace207322..828d8b58c 100644 --- a/internal/rpc/office/office.go +++ b/internal/rpc/office/office.go @@ -205,9 +205,9 @@ func (s *officeServer) SendMsg2Tag(_ context.Context, req *pbOffice.SendMsg2TagR } var groupUserIDList []string for _, groupID := range req.GroupList { - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) resp.CommonResp.ErrCode = constant.ErrInternal.ErrCode resp.CommonResp.ErrMsg = errMsg diff --git a/internal/rpc/organization/organization.go b/internal/rpc/organization/organization.go index 076748d36..95f3233ef 100644 --- a/internal/rpc/organization/organization.go +++ b/internal/rpc/organization/organization.go @@ -119,9 +119,9 @@ func (s *organizationServer) CreateDepartment(ctx context.Context, req *rpc.Crea return &rpc.CreateDepartmentResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}, nil } chat.OrganizationNotificationToAll(req.OpUserID, req.OperationID) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) resp.ErrCode = constant.ErrInternal.ErrCode resp.ErrMsg = errMsg @@ -262,9 +262,9 @@ func (s *organizationServer) CreateOrganizationUser(ctx context.Context, req *rp utils.CopyStructFields(authReq.UserInfo, req.OrganizationUser) authReq.OperationID = req.OperationID if req.IsRegister { - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) return &rpc.CreateOrganizationUserResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}, nil } diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go index 0ad2e6d13..9bf06b8fc 100644 --- a/internal/rpc/user/user.go +++ b/internal/rpc/user/user.go @@ -11,6 +11,7 @@ import ( "Open_IM/pkg/common/log" "Open_IM/pkg/common/token_verify" "Open_IM/pkg/grpc-etcdv3/getcdv3" + pbConversation "Open_IM/pkg/proto/conversation" pbFriend "Open_IM/pkg/proto/friend" pbOrganization "Open_IM/pkg/proto/organization" sdkws "Open_IM/pkg/proto/sdk_ws" @@ -85,7 +86,7 @@ func (s *userServer) Run() { log.NewInfo("0", "rpc user success") } -func syncPeerUserConversation(conversation *pbUser.Conversation, operationID string) error { +func syncPeerUserConversation(conversation *pbConversation.Conversation, operationID string) error { peerUserConversation := db.Conversation{ OwnerUserID: conversation.UserID, ConversationID: utils.GetConversationIDBySessionType(conversation.OwnerUserID, constant.SingleChatType), @@ -149,11 +150,21 @@ func (s *userServer) BatchSetConversations(ctx context.Context, req *pbUser.Batc resp.CommonResp = &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg} return resp, nil } - if err := imdb.SetConversation(conversation); err != nil { + + isUpdate, err := imdb.SetConversation(conversation) + if err != nil { log.NewError(req.OperationID, utils.GetSelfFuncName(), "SetConversation error", err.Error()) resp.Failed = append(resp.Failed, v.ConversationID) continue } + if isUpdate { + err = rocksCache.DelConversationFromCache(v.OwnerUserID, v.ConversationID) + } else { + err = rocksCache.DelUserConversationIDListFromCache(v.OwnerUserID) + } + if err != nil { + log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), v.ConversationID, v.OwnerUserID) + } resp.Success = append(resp.Success, v.ConversationID) // if is set private msg operation,then peer user need to sync and set tips\ if v.ConversationType == constant.SingleChatType && req.NotificationType == constant.ConversationPrivateChatNotification { @@ -170,8 +181,8 @@ func (s *userServer) BatchSetConversations(ctx context.Context, req *pbUser.Batc func (s *userServer) GetAllConversations(ctx context.Context, req *pbUser.GetAllConversationsReq) (*pbUser.GetAllConversationsResp, error) { log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String()) - resp := &pbUser.GetAllConversationsResp{Conversations: []*pbUser.Conversation{}} - conversations, err := imdb.GetUserAllConversations(req.OwnerUserID) + resp := &pbUser.GetAllConversationsResp{Conversations: []*pbConversation.Conversation{}} + conversations, err := rocksCache.GetUserAllConversationList(req.OwnerUserID) log.NewDebug(req.OperationID, "conversations: ", conversations) if err != nil { log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetConversations error", err.Error()) @@ -188,8 +199,8 @@ func (s *userServer) GetAllConversations(ctx context.Context, req *pbUser.GetAll func (s *userServer) GetConversation(ctx context.Context, req *pbUser.GetConversationReq) (*pbUser.GetConversationResp, error) { log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String()) - resp := &pbUser.GetConversationResp{Conversation: &pbUser.Conversation{}} - conversation, err := imdb.GetConversation(req.OwnerUserID, req.ConversationID) + resp := &pbUser.GetConversationResp{Conversation: &pbConversation.Conversation{}} + conversation, err := rocksCache.GetConversationFromCache(req.OwnerUserID, req.ConversationID) log.NewDebug("", utils.GetSelfFuncName(), "conversation", conversation) if err != nil { log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetConversation error", err.Error()) @@ -206,8 +217,8 @@ func (s *userServer) GetConversation(ctx context.Context, req *pbUser.GetConvers func (s *userServer) GetConversations(ctx context.Context, req *pbUser.GetConversationsReq) (*pbUser.GetConversationsResp, error) { log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String()) - resp := &pbUser.GetConversationsResp{Conversations: []*pbUser.Conversation{}} - conversations, err := imdb.GetConversations(req.OwnerUserID, req.ConversationIDs) + resp := &pbUser.GetConversationsResp{Conversations: []*pbConversation.Conversation{}} + conversations, err := rocksCache.GetConversationsFromCache(req.OwnerUserID, req.ConversationIDs) log.NewDebug("", utils.GetSelfFuncName(), "conversations", conversations) if err != nil { log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetConversations error", err.Error()) @@ -251,12 +262,21 @@ func (s *userServer) SetConversation(ctx context.Context, req *pbUser.SetConvers resp.CommonResp = &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg} return resp, nil } - err := imdb.SetConversation(conversation) + isUpdate, err := imdb.SetConversation(conversation) if err != nil { log.NewError(req.OperationID, utils.GetSelfFuncName(), "SetConversation error", err.Error()) resp.CommonResp = &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg} return resp, nil } + if isUpdate { + err = rocksCache.DelConversationFromCache(req.Conversation.OwnerUserID, req.Conversation.ConversationID) + } else { + err = rocksCache.DelUserConversationIDListFromCache(req.Conversation.OwnerUserID) + } + if err != nil { + log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.Conversation.ConversationID, req.Conversation.OwnerUserID) + } + // notification if req.Conversation.ConversationType == constant.SingleChatType && req.NotificationType == constant.ConversationPrivateChatNotification { //sync peer user conversation if conversation is singleChatType @@ -302,6 +322,9 @@ func (s *userServer) SetRecvMsgOpt(ctx context.Context, req *pbUser.SetRecvMsgOp resp.CommonResp = &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg} return resp, nil } + if err = rocksCache.DelConversationFromCache(conversation.OwnerUserID, conversation.ConversationID); err != nil { + log.NewError(req.OperationID, utils.GetSelfFuncName(), conversation.ConversationID, err.Error()) + } chat.ConversationChangeNotification(req.OperationID, req.OwnerUserID) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String()) resp.CommonResp = &pbUser.CommonResp{} @@ -400,9 +423,9 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserI log.NewError(req.OperationID, "UpdateUserInfo failed ", err.Error(), user) return &pbUser.UpdateUserInfoResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.OperationID) + etcdConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.OperationID) if etcdConn == nil { - errMsg := req.OperationID + "getcdv3.GetConn == nil" + errMsg := req.OperationID + "getcdv3.GetDefaultConn == nil" log.NewError(req.OperationID, errMsg) return &pbUser.UpdateUserInfoResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrInternal.ErrCode, ErrMsg: errMsg}}, nil } @@ -433,8 +456,7 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserI if req.UserInfo.Nickname != "" { go s.SyncJoinedGroupMemberNickname(req.UserInfo.UserID, req.UserInfo.Nickname, oldNickname, req.OperationID, req.OpUserID) } - - etcdConn = getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) + etcdConn = getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOrganizationName, req.OperationID) clientOrg := pbOrganization.NewOrganizationClient(etcdConn) out, err := clientOrg.UpdateOrganizationUser(context.Background(), &pbOrganization.UpdateOrganizationUserReq{ OrganizationUser: &sdkws.OrganizationUser{ @@ -459,7 +481,6 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserI log.NewError(req.OperationID, utils.GetSelfFuncName(), "grpc resp: ", out) } } - return &pbUser.UpdateUserInfoResp{CommonResp: &pbUser.CommonResp{}}, nil } func (s *userServer) SetGlobalRecvMessageOpt(ctx context.Context, req *pbUser.SetGlobalRecvMessageOptReq) (*pbUser.SetGlobalRecvMessageOptResp, error) { diff --git a/pkg/base_info/auth_api_struct.go b/pkg/base_info/auth_api_struct.go index 4f26084f5..85aa2301e 100644 --- a/pkg/base_info/auth_api_struct.go +++ b/pkg/base_info/auth_api_struct.go @@ -28,7 +28,7 @@ type UserRegisterResp struct { type UserTokenReq struct { Secret string `json:"secret" binding:"required,max=32"` - Platform int32 `json:"platform" binding:"required,min=1,max=8"` + Platform int32 `json:"platform" binding:"required,min=1,max=9"` UserID string `json:"userID" binding:"required,min=1,max=64"` LoginIp string `json:"loginIp"` OperationID string `json:"operationID" binding:"required"` @@ -40,7 +40,7 @@ type UserTokenResp struct { } type ForceLogoutReq struct { - Platform int32 `json:"platform" binding:"required,min=1,max=8"` + Platform int32 `json:"platform" binding:"required,min=1,max=9"` FromUserID string `json:"fromUserID" binding:"required,min=1,max=64"` OperationID string `json:"operationID" binding:"required"` } diff --git a/pkg/base_info/client_init.go b/pkg/base_info/client_init.go new file mode 100644 index 000000000..47cfdcdea --- /dev/null +++ b/pkg/base_info/client_init.go @@ -0,0 +1,21 @@ +package base_info + +type SetClientInitConfigReq struct { + OperationID string `json:"operationID" binding:"required"` + DiscoverPageURL *string `json:"discoverPageURL"` +} + +type SetClientInitConfigResp struct { + CommResp +} + +type GetClientInitConfigReq struct { + OperationID string `json:"operationID" binding:"required"` +} + +type GetClientInitConfigResp struct { + CommResp + Data struct { + DiscoverPageURL string `json:"discoverPageURL"` + } `json:"data"` +} diff --git a/pkg/base_info/conversation_api_struct.go b/pkg/base_info/conversation_api_struct.go index 30890f7eb..c0cb9fccf 100644 --- a/pkg/base_info/conversation_api_struct.go +++ b/pkg/base_info/conversation_api_struct.go @@ -33,20 +33,21 @@ type SetReceiveMessageOptResp struct { } type Conversation struct { - OwnerUserID string `json:"ownerUserID" binding:"required"` - ConversationID string `json:"conversationID" binding:"required"` - ConversationType int32 `json:"conversationType" binding:"required"` - UserID string `json:"userID"` - GroupID string `json:"groupID"` - RecvMsgOpt int32 `json:"recvMsgOpt" binding:"omitempty,oneof=0 1 2"` - UnreadCount int32 `json:"unreadCount" binding:"omitempty"` - DraftTextTime int64 `json:"draftTextTime"` - IsPinned bool `json:"isPinned" binding:"omitempty"` - IsPrivateChat bool `json:"isPrivateChat"` - GroupAtType int32 `json:"groupAtType"` - IsNotInGroup bool `json:"isNotInGroup"` - AttachedInfo string `json:"attachedInfo"` - Ex string `json:"ex"` + OwnerUserID string `json:"ownerUserID" binding:"required"` + ConversationID string `json:"conversationID" binding:"required"` + ConversationType int32 `json:"conversationType" binding:"required"` + UserID string `json:"userID"` + GroupID string `json:"groupID"` + RecvMsgOpt int32 `json:"recvMsgOpt" binding:"omitempty,oneof=0 1 2"` + UnreadCount int32 `json:"unreadCount" binding:"omitempty"` + DraftTextTime int64 `json:"draftTextTime"` + IsPinned bool `json:"isPinned" binding:"omitempty"` + IsPrivateChat bool `json:"isPrivateChat"` + GroupAtType int32 `json:"groupAtType"` + IsNotInGroup bool `json:"isNotInGroup"` + UpdateUnreadCountTime int64 ` json:"updateUnreadCountTime"` + AttachedInfo string `json:"attachedInfo"` + Ex string `json:"ex"` } type SetConversationReq struct { diff --git a/pkg/base_info/manage_api_struct.go b/pkg/base_info/manage_api_struct.go index 7d9f43653..cc7ba5129 100644 --- a/pkg/base_info/manage_api_struct.go +++ b/pkg/base_info/manage_api_struct.go @@ -2,8 +2,7 @@ package base_info import ( pbRelay "Open_IM/pkg/proto/relay" - "Open_IM/pkg/proto/sdk_ws" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" + server_api_params "Open_IM/pkg/proto/sdk_ws" pbUser "Open_IM/pkg/proto/user" ) @@ -48,12 +47,12 @@ type ManagementSendMsg struct { SenderFaceURL string `json:"senderFaceURL" ` SenderPlatformID int32 `json:"senderPlatformID"` //ForceList []string `json:"forceList" ` - Content map[string]interface{} `json:"content" binding:"required" swaggerignore:"true"` - ContentType int32 `json:"contentType" binding:"required"` - SessionType int32 `json:"sessionType" binding:"required"` - IsOnlineOnly bool `json:"isOnlineOnly"` - NotOfflinePush bool `json:"notOfflinePush"` - OfflinePushInfo *open_im_sdk.OfflinePushInfo `json:"offlinePushInfo"` + Content map[string]interface{} `json:"content" binding:"required" swaggerignore:"true"` + ContentType int32 `json:"contentType" binding:"required"` + SessionType int32 `json:"sessionType" binding:"required"` + IsOnlineOnly bool `json:"isOnlineOnly"` + NotOfflinePush bool `json:"notOfflinePush"` + OfflinePushInfo *server_api_params.OfflinePushInfo `json:"offlinePushInfo"` } type ManagementSendMsgReq struct { @@ -68,6 +67,7 @@ type ManagementSendMsgResp struct { type ManagementBatchSendMsgReq struct { ManagementSendMsg + IsSendAll bool `json:"isSendAll"` RecvIDList []string `json:"recvIDList"` } diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go index 0542ea7fa..ba8b25fa2 100644 --- a/pkg/common/config/config.go +++ b/pkg/common/config/config.go @@ -138,6 +138,7 @@ type config struct { OpenImOrganizationPort []int `yaml:"openImOrganizationPort"` OpenImConversationPort []int `yaml:"openImConversationPort"` OpenImCachePort []int `yaml:"openImCachePort"` + OpenImRealTimeCommPort []int `yaml:"openImRealTimeCommPort"` } RpcRegisterName struct { OpenImStatisticsName string `yaml:"openImStatisticsName"` diff --git a/pkg/common/constant/constant.go b/pkg/common/constant/constant.go index 846b07a14..c8f9986b4 100644 --- a/pkg/common/constant/constant.go +++ b/pkg/common/constant/constant.go @@ -140,6 +140,8 @@ const ( WebAndOther = 3 //The PC side is mutually exclusive, and the mobile side is mutually exclusive, but the web side can be online at the same time PcMobileAndWeb = 4 + //The PC terminal can be online at the same time,but other terminal only one of the endpoints can login + PCAndOther = 5 OnlineStatus = "online" OfflineStatus = "offline" diff --git a/pkg/common/db/RedisModel.go b/pkg/common/db/RedisModel.go index 8c11279ef..b211739e1 100644 --- a/pkg/common/db/RedisModel.go +++ b/pkg/common/db/RedisModel.go @@ -11,11 +11,12 @@ import ( "context" "errors" "fmt" + "strconv" + "time" + go_redis "github.com/go-redis/redis/v8" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" - "strconv" - "time" ) const ( @@ -230,16 +231,14 @@ func (d *DataBases) SetMessageToCache(msgList []*pbChat.MsgDataToMQ, uid string, } func (d *DataBases) DeleteMessageFromCache(msgList []*pbChat.MsgDataToMQ, uid string, operationID string) error { ctx := context.Background() - var keys []string for _, msg := range msgList { key := messageCache + uid + "_" + strconv.Itoa(int(msg.MsgData.Seq)) - keys = append(keys, key) + err := d.RDB.Del(ctx, key).Err() + if err != nil { + log2.NewWarn(operationID, utils.GetSelfFuncName(), "redis failed", "args:", key, uid, err.Error(), msgList) + } } - err := d.RDB.Del(ctx, keys...).Err() - if err != nil { - log2.NewWarn(operationID, utils.GetSelfFuncName(), "redis failed", "args:", keys, uid, err.Error(), msgList) - } - return err + return nil } func (d *DataBases) CleanUpOneUserAllMsgFromRedis(userID string, operationID string) error { diff --git a/pkg/common/db/model_struct.go b/pkg/common/db/model_struct.go index 560dc29d5..a58899607 100644 --- a/pkg/common/db/model_struct.go +++ b/pkg/common/db/model_struct.go @@ -339,3 +339,11 @@ type RegisterAddFriend struct { func (RegisterAddFriend) TableName() string { return "register_add_friend" } + +type ClientInitConfig struct { + DiscoverPageURL string `gorm:"column:discover_page_url;size:64" json:"version"` +} + +func (ClientInitConfig) TableName() string { + return "client_init_config" +} diff --git a/pkg/common/db/mysql.go b/pkg/common/db/mysql.go index d238c7794..f28be8dc1 100644 --- a/pkg/common/db/mysql.go +++ b/pkg/common/db/mysql.go @@ -78,7 +78,8 @@ func initMysqlDB() { &GroupMember{}, &GroupRequest{}, &User{}, - &Black{}, &ChatLog{}, &Register{}, &Conversation{}, &AppVersion{}, &Department{}, &BlackList{}, &IpLimit{}, &UserIpLimit{}, &Invitation{}, &RegisterAddFriend{}) + &Black{}, &ChatLog{}, &Register{}, &Conversation{}, &AppVersion{}, &Department{}, &BlackList{}, &IpLimit{}, &UserIpLimit{}, &Invitation{}, &RegisterAddFriend{}, + &ClientInitConfig{}) db.Set("gorm:table_options", "CHARSET=utf8") db.Set("gorm:table_options", "collation=utf8_unicode_ci") @@ -163,6 +164,12 @@ func initMysqlDB() { fmt.Println("CreateTable Invitation") db.Migrator().CreateTable(&Invitation{}) } + + if !db.Migrator().HasTable(&ClientInitConfig{}) { + fmt.Println("CreateTable ClientInitConfig") + db.Migrator().CreateTable(&ClientInitConfig{}) + } + DB.MysqlDB.db = db return } diff --git a/pkg/common/db/mysql_model/im_mysql_model/client_config.go b/pkg/common/db/mysql_model/im_mysql_model/client_config.go new file mode 100644 index 000000000..ae932ed92 --- /dev/null +++ b/pkg/common/db/mysql_model/im_mysql_model/client_config.go @@ -0,0 +1,22 @@ +package im_mysql_model + +import "Open_IM/pkg/common/db" + +func SetClientInitConfig(m map[string]interface{}) error { + result := db.DB.MysqlDB.DefaultGormDB().Model(&db.ClientInitConfig{}).Where("1=1").Updates(m) + if result.Error != nil { + return result.Error + } + if result.RowsAffected == 0 { + err := db.DB.MysqlDB.DefaultGormDB().Model(&db.ClientInitConfig{}).Create(m).Error + return err + } + + return nil +} + +func GetClientInitConfig() (db.ClientInitConfig, error) { + var config db.ClientInitConfig + err := db.DB.MysqlDB.DefaultGormDB().Model((&db.ClientInitConfig{})).First(&config).Error + return config, err +} diff --git a/pkg/common/db/mysql_model/im_mysql_model/conversation_model.go b/pkg/common/db/mysql_model/im_mysql_model/conversation_model.go index 5588ba912..2a645d54f 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/conversation_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/conversation_model.go @@ -6,16 +6,18 @@ import ( "Open_IM/pkg/utils" ) -func SetConversation(conversation db.Conversation) error { +func SetConversation(conversation db.Conversation) (bool, error) { + var isUpdate bool newConversation := conversation if db.DB.MysqlDB.DefaultGormDB().Model(&db.Conversation{}).Find(&newConversation).RowsAffected == 0 { log.NewDebug("", utils.GetSelfFuncName(), "conversation", conversation, "not exist in db, create") - return db.DB.MysqlDB.DefaultGormDB().Model(&db.Conversation{}).Create(conversation).Error + return isUpdate, db.DB.MysqlDB.DefaultGormDB().Model(&db.Conversation{}).Create(conversation).Error // if exist, then update record } else { log.NewDebug("", utils.GetSelfFuncName(), "conversation", conversation, "exist in db, update") //force update - return db.DB.MysqlDB.DefaultGormDB().Model(conversation).Where("owner_user_id = ? and conversation_id = ?", conversation.OwnerUserID, conversation.ConversationID). + isUpdate = true + return isUpdate, db.DB.MysqlDB.DefaultGormDB().Model(conversation).Where("owner_user_id = ? and conversation_id = ?", conversation.OwnerUserID, conversation.ConversationID). Updates(map[string]interface{}{"recv_msg_opt": conversation.RecvMsgOpt, "is_pinned": conversation.IsPinned, "is_private_chat": conversation.IsPrivateChat, "group_at_type": conversation.GroupAtType, "is_not_in_group": conversation.IsNotInGroup}).Error } @@ -83,12 +85,20 @@ func GetConversations(OwnerUserID string, conversationIDs []string) ([]db.Conver err := db.DB.MysqlDB.DefaultGormDB().Model(&db.Conversation{}).Where("conversation_id IN (?) and owner_user_id=?", conversationIDs, OwnerUserID).Find(&conversations).Error return conversations, err } + func GetConversationsByConversationIDMultipleOwner(OwnerUserIDList []string, conversationID string) ([]db.Conversation, error) { var conversations []db.Conversation err := db.DB.MysqlDB.DefaultGormDB().Model(&db.Conversation{}).Where("owner_user_id IN (?) and conversation_id=?", OwnerUserIDList, conversationID).Find(&conversations).Error return conversations, err } + func UpdateColumnsConversations(ownerUserIDList []string, conversationID string, args map[string]interface{}) error { return db.DB.MysqlDB.DefaultGormDB().Model(&db.Conversation{}).Where("owner_user_id IN (?) and conversation_id=?", ownerUserIDList, conversationID).Updates(args).Error } + +func GetConversationIDListByUserID(userID string) ([]string, error) { + var IDList []string + err := db.DB.MysqlDB.DefaultGormDB().Model(&db.Conversation{}).Where("owner_user_id=?", userID).Pluck("conversation_id", &IDList).Error + return IDList, err +} diff --git a/pkg/common/db/rocks_cache/rocks_cache.go b/pkg/common/db/rocks_cache/rocks_cache.go index 80f18db6a..0cb41a8b5 100644 --- a/pkg/common/db/rocks_cache/rocks_cache.go +++ b/pkg/common/db/rocks_cache/rocks_cache.go @@ -32,6 +32,8 @@ const ( joinedSuperGroupListCache = "JOINED_SUPER_GROUP_LIST_CACHE:" groupMemberListHashCache = "GROUP_MEMBER_LIST_HASH_CACHE:" groupMemberNumCache = "GROUP_MEMBER_NUM_CACHE:" + conversationCache = "CONVERSATION_CACHE:" + conversationIDListCache = "CONVERSATION_ID_LIST_CACHE:" ) func init() { @@ -431,3 +433,83 @@ func GetGroupMemberNumFromCache(groupID string) (int64, error) { func DelGroupMemberNumFromCache(groupID string) error { return db.DB.Rc.TagAsDeleted(groupMemberNumCache + groupID) } + +func GetUserConversationIDListFromCache(userID string) ([]string, error) { + getConversationIDList := func() (string, error) { + conversationIDList, err := imdb.GetConversationIDListByUserID(userID) + if err != nil { + return "", utils.Wrap(err, "getConversationIDList failed") + } + log.NewDebug("", utils.GetSelfFuncName(), conversationIDList) + bytes, err := json.Marshal(conversationIDList) + return string(bytes), utils.Wrap(err, "") + } + conversationIDListStr, err := db.DB.Rc.Fetch(conversationIDListCache+userID, time.Second*30*60, getConversationIDList) + var conversationIDList []string + err = json.Unmarshal([]byte(conversationIDListStr), &conversationIDList) + if err != nil { + return nil, utils.Wrap(err, "") + } + return conversationIDList, nil +} + +func DelUserConversationIDListFromCache(userID string) error { + return db.DB.Rc.TagAsDeleted(conversationIDListCache + userID) +} + +func GetConversationFromCache(ownerUserID, conversationID string) (*db.Conversation, error) { + getConversation := func() (string, error) { + conversation, err := imdb.GetConversation(ownerUserID, conversationID) + if err != nil { + return "", utils.Wrap(err, "get failed") + } + bytes, err := json.Marshal(conversation) + if err != nil { + return "", utils.Wrap(err, "Marshal failed") + } + return string(bytes), nil + } + conversationStr, err := db.DB.Rc.Fetch(conversationCache+ownerUserID+":"+conversationID, time.Second*30*60, getConversation) + if err != nil { + return nil, utils.Wrap(err, "Fetch failed") + } + conversation := db.Conversation{} + err = json.Unmarshal([]byte(conversationStr), &conversation) + if err != nil { + return nil, utils.Wrap(err, "Unmarshal failed") + } + return &conversation, nil +} + +func GetConversationsFromCache(ownerUserID string, conversationIDList []string) ([]db.Conversation, error) { + var conversationList []db.Conversation + for _, conversationID := range conversationIDList { + conversation, err := GetConversationFromCache(ownerUserID, conversationID) + if err != nil { + return nil, utils.Wrap(err, "GetConversationFromCache failed") + } + conversationList = append(conversationList, *conversation) + } + return conversationList, nil +} + +func GetUserAllConversationList(ownerUserID string) ([]db.Conversation, error) { + IDList, err := GetUserConversationIDListFromCache(ownerUserID) + if err != nil { + return nil, err + } + var conversationList []db.Conversation + log.NewDebug("", utils.GetSelfFuncName(), IDList) + for _, conversationID := range IDList { + conversation, err := GetConversationFromCache(ownerUserID, conversationID) + if err != nil { + return nil, utils.Wrap(err, "GetConversationFromCache failed") + } + conversationList = append(conversationList, *conversation) + } + return conversationList, nil +} + +func DelConversationFromCache(ownerUserID, conversationID string) error { + return db.DB.Rc.TagAsDeleted(conversationCache + ownerUserID + ":" + conversationID) +} diff --git a/pkg/grpc-etcdv3/getcdv3/resolver.go b/pkg/grpc-etcdv3/getcdv3/resolver.go index b72df5fc9..d95909b6d 100644 --- a/pkg/grpc-etcdv3/getcdv3/resolver.go +++ b/pkg/grpc-etcdv3/getcdv3/resolver.go @@ -1,21 +1,24 @@ package getcdv3 import ( + "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" "Open_IM/pkg/utils" "context" "fmt" + "go.etcd.io/etcd/api/v3/mvccpb" clientv3 "go.etcd.io/etcd/client/v3" //"go.etcd.io/etcd/mvcc/mvccpb" //"google.golang.org/genproto/googleapis/ads/googleads/v1/services" - "google.golang.org/grpc" - "google.golang.org/grpc/balancer/roundrobin" - "google.golang.org/grpc/resolver" "strings" "sync" "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/balancer/roundrobin" + "google.golang.org/grpc/resolver" ) type Resolver struct { @@ -66,7 +69,7 @@ func (r1 *Resolver) ResolveNow(rn resolver.ResolveNowOptions) { func (r1 *Resolver) Close() { } -func GetConn(schema, etcdaddr, serviceName string, operationID string) *grpc.ClientConn { +func getConn(schema, etcdaddr, serviceName string, operationID string) *grpc.ClientConn { rwNameResolverMutex.RLock() r, ok := nameResolver[schema+serviceName] rwNameResolverMutex.RUnlock() @@ -96,6 +99,99 @@ func GetConn(schema, etcdaddr, serviceName string, operationID string) *grpc.Cli return r.grpcClientConn } +func GetConfigConn(serviceName string, operationID string) *grpc.ClientConn { + rpcRegisterIP := config.Config.RpcRegisterIP + var err error + if config.Config.RpcRegisterIP == "" { + rpcRegisterIP, err = utils.GetLocalIP() + if err != nil { + log.Error(operationID, "GetLocalIP failed ", err.Error()) + return nil + } + } + + var configPortList []int + //1 + if config.Config.RpcRegisterName.OpenImUserName == serviceName { + configPortList = config.Config.RpcPort.OpenImUserPort + } + //2 + if config.Config.RpcRegisterName.OpenImFriendName == serviceName { + configPortList = config.Config.RpcPort.OpenImFriendPort + } + //3 + if config.Config.RpcRegisterName.OpenImMsgName == serviceName { + configPortList = config.Config.RpcPort.OpenImMessagePort + } + //4 + if config.Config.RpcRegisterName.OpenImPushName == serviceName { + configPortList = config.Config.RpcPort.OpenImPushPort + } + //5 + if config.Config.RpcRegisterName.OpenImRelayName == serviceName { + configPortList = config.Config.RpcPort.OpenImMessageGatewayPort + } + //6 + if config.Config.RpcRegisterName.OpenImGroupName == serviceName { + configPortList = config.Config.RpcPort.OpenImGroupPort + } + //7 + if config.Config.RpcRegisterName.OpenImAuthName == serviceName { + configPortList = config.Config.RpcPort.OpenImAuthPort + } + //8 + if config.Config.RpcRegisterName.OpenImMessageCMSName == serviceName { + configPortList = config.Config.RpcPort.OpenImMessageCmsPort + } + //9 + if config.Config.RpcRegisterName.OpenImAdminCMSName == serviceName { + configPortList = config.Config.RpcPort.OpenImAdminCmsPort + } + //10 + if config.Config.RpcRegisterName.OpenImOfficeName == serviceName { + configPortList = config.Config.RpcPort.OpenImOfficePort + } + //11 + if config.Config.RpcRegisterName.OpenImOrganizationName == serviceName { + configPortList = config.Config.RpcPort.OpenImOrganizationPort + } + //12 + if config.Config.RpcRegisterName.OpenImConversationName == serviceName { + configPortList = config.Config.RpcPort.OpenImConversationPort + } + //13 + if config.Config.RpcRegisterName.OpenImCacheName == serviceName { + configPortList = config.Config.RpcPort.OpenImCachePort + } + //14 + if config.Config.RpcRegisterName.OpenImRealTimeCommName == serviceName { + configPortList = config.Config.RpcPort.OpenImRealTimeCommPort + } + if len(configPortList) == 0 { + log.Error(operationID, "len(configPortList) == 0 ") + return nil + } + target := rpcRegisterIP + ":" + utils.Int32ToString(int32(configPortList[0])) + log.Info(operationID, "rpcRegisterIP ", rpcRegisterIP, " port ", configPortList, " grpc target: ", target, " serviceName: ", serviceName) + conn, err := grpc.Dial(target, grpc.WithInsecure()) + if err != nil { + log.Error(operationID, "grpc.Dail failed ", err.Error()) + return nil + } + log.NewDebug(operationID, utils.GetSelfFuncName(), serviceName, conn) + return conn +} + +func GetDefaultConn(schema, etcdaddr, serviceName string, operationID string) *grpc.ClientConn { + con := getConn(schema, etcdaddr, serviceName, operationID) + if con != nil { + return con + } + log.NewWarn(operationID, utils.GetSelfFuncName(), "conn is nil !!!!!", schema, etcdaddr, serviceName, operationID) + con = GetConfigConn(serviceName, operationID) + return con +} + func (r *Resolver) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) { if r.cli == nil { return nil, fmt.Errorf("etcd clientv3 client failed, etcd:%s", target) @@ -181,7 +277,45 @@ func (r *Resolver) watch(prefix string, addrList []resolver.Address) { } } -func GetConn4Unique(schema, etcdaddr, servicename string) []*grpc.ClientConn { +func GetDefaultGatewayConn4Unique(schema, etcdaddr, operationID string) []*grpc.ClientConn { + grpcConns := getConn4Unique(schema, etcdaddr, config.Config.RpcRegisterName.OpenImRelayName) + if len(grpcConns) > 0 { + return grpcConns + } + log.NewWarn(operationID, utils.GetSelfFuncName(), " len(grpcConns) < 0 ", schema, etcdaddr, config.Config.RpcRegisterName.OpenImRelayName) + grpcConns = GetDefaultGatewayConn4UniqueFromcfg(operationID) + log.NewDebug(operationID, utils.GetSelfFuncName(), config.Config.RpcRegisterName.OpenImRelayName, grpcConns) + return grpcConns +} + +func GetDefaultGatewayConn4UniqueFromcfg(operationID string) []*grpc.ClientConn { + rpcRegisterIP := config.Config.RpcRegisterIP + var err error + if config.Config.RpcRegisterIP == "" { + rpcRegisterIP, err = utils.GetLocalIP() + if err != nil { + log.Error("", "GetLocalIP failed ", err.Error()) + return nil + } + } + var conns []*grpc.ClientConn + configPortList := config.Config.RpcPort.OpenImMessageGatewayPort + for _, port := range configPortList { + target := rpcRegisterIP + ":" + utils.Int32ToString(int32(port)) + log.Info(operationID, "rpcRegisterIP ", rpcRegisterIP, " port ", configPortList, " grpc target: ", target, " serviceName: ", "msgGateway") + conn, err := grpc.Dial(target, grpc.WithInsecure()) + if err != nil { + log.Error(operationID, "grpc.Dail failed ", err.Error()) + continue + } + conns = append(conns, conn) + + } + return conns + +} + +func getConn4Unique(schema, etcdaddr, servicename string) []*grpc.ClientConn { gEtcdCli, err := clientv3.New(clientv3.Config{Endpoints: strings.Split(etcdaddr, ",")}) if err != nil { log.Error("clientv3.New failed", err.Error()) @@ -215,7 +349,7 @@ func GetConn4Unique(schema, etcdaddr, servicename string) []*grpc.ClientConn { allConn := make([]*grpc.ClientConn, 0) for _, v := range allService { - r := GetConn(schema, etcdaddr, v, "0") + r := getConn(schema, etcdaddr, v, "0") allConn = append(allConn, r) } @@ -228,7 +362,7 @@ var ( ) func GetconnFactory(schema, etcdaddr, servicename string) (*grpc.ClientConn, error) { - c := GetConn(schema, etcdaddr, servicename, "0") + c := getConn(schema, etcdaddr, servicename, "0") if c != nil { return c, nil } else { diff --git a/pkg/proto/conversation/conversation.pb.go b/pkg/proto/conversation/conversation.pb.go index bf76bfe67..de4d4a793 100644 --- a/pkg/proto/conversation/conversation.pb.go +++ b/pkg/proto/conversation/conversation.pb.go @@ -35,7 +35,7 @@ func (m *CommonResp) Reset() { *m = CommonResp{} } func (m *CommonResp) String() string { return proto.CompactTextString(m) } func (*CommonResp) ProtoMessage() {} func (*CommonResp) Descriptor() ([]byte, []int) { - return fileDescriptor_conversation_e6bf38f800b9bed2, []int{0} + return fileDescriptor_conversation_ac55165355a1b6e6, []int{0} } func (m *CommonResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CommonResp.Unmarshal(m, b) @@ -70,30 +70,31 @@ func (m *CommonResp) GetErrMsg() string { } type Conversation struct { - OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID" json:"ownerUserID,omitempty"` - ConversationID string `protobuf:"bytes,2,opt,name=conversationID" json:"conversationID,omitempty"` - RecvMsgOpt int32 `protobuf:"varint,3,opt,name=recvMsgOpt" json:"recvMsgOpt,omitempty"` - ConversationType int32 `protobuf:"varint,4,opt,name=conversationType" json:"conversationType,omitempty"` - UserID string `protobuf:"bytes,5,opt,name=userID" json:"userID,omitempty"` - GroupID string `protobuf:"bytes,6,opt,name=groupID" json:"groupID,omitempty"` - UnreadCount int32 `protobuf:"varint,7,opt,name=unreadCount" json:"unreadCount,omitempty"` - DraftTextTime int64 `protobuf:"varint,8,opt,name=draftTextTime" json:"draftTextTime,omitempty"` - IsPinned bool `protobuf:"varint,9,opt,name=isPinned" json:"isPinned,omitempty"` - AttachedInfo string `protobuf:"bytes,10,opt,name=attachedInfo" json:"attachedInfo,omitempty"` - IsPrivateChat bool `protobuf:"varint,11,opt,name=isPrivateChat" json:"isPrivateChat,omitempty"` - GroupAtType int32 `protobuf:"varint,12,opt,name=groupAtType" json:"groupAtType,omitempty"` - IsNotInGroup bool `protobuf:"varint,13,opt,name=isNotInGroup" json:"isNotInGroup,omitempty"` - Ex string `protobuf:"bytes,14,opt,name=ex" json:"ex,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID" json:"ownerUserID,omitempty"` + ConversationID string `protobuf:"bytes,2,opt,name=conversationID" json:"conversationID,omitempty"` + RecvMsgOpt int32 `protobuf:"varint,3,opt,name=recvMsgOpt" json:"recvMsgOpt,omitempty"` + ConversationType int32 `protobuf:"varint,4,opt,name=conversationType" json:"conversationType,omitempty"` + UserID string `protobuf:"bytes,5,opt,name=userID" json:"userID,omitempty"` + GroupID string `protobuf:"bytes,6,opt,name=groupID" json:"groupID,omitempty"` + UnreadCount int32 `protobuf:"varint,7,opt,name=unreadCount" json:"unreadCount,omitempty"` + DraftTextTime int64 `protobuf:"varint,8,opt,name=draftTextTime" json:"draftTextTime,omitempty"` + IsPinned bool `protobuf:"varint,9,opt,name=isPinned" json:"isPinned,omitempty"` + AttachedInfo string `protobuf:"bytes,10,opt,name=attachedInfo" json:"attachedInfo,omitempty"` + IsPrivateChat bool `protobuf:"varint,11,opt,name=isPrivateChat" json:"isPrivateChat,omitempty"` + GroupAtType int32 `protobuf:"varint,12,opt,name=groupAtType" json:"groupAtType,omitempty"` + IsNotInGroup bool `protobuf:"varint,13,opt,name=isNotInGroup" json:"isNotInGroup,omitempty"` + Ex string `protobuf:"bytes,14,opt,name=ex" json:"ex,omitempty"` + UpdateUnreadCountTime int64 `protobuf:"varint,15,opt,name=updateUnreadCountTime" json:"updateUnreadCountTime,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Conversation) Reset() { *m = Conversation{} } func (m *Conversation) String() string { return proto.CompactTextString(m) } func (*Conversation) ProtoMessage() {} func (*Conversation) Descriptor() ([]byte, []int) { - return fileDescriptor_conversation_e6bf38f800b9bed2, []int{1} + return fileDescriptor_conversation_ac55165355a1b6e6, []int{1} } func (m *Conversation) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Conversation.Unmarshal(m, b) @@ -211,6 +212,13 @@ func (m *Conversation) GetEx() string { return "" } +func (m *Conversation) GetUpdateUnreadCountTime() int64 { + if m != nil { + return m.UpdateUnreadCountTime + } + return 0 +} + type ModifyConversationFieldReq struct { Conversation *Conversation `protobuf:"bytes,1,opt,name=conversation" json:"conversation,omitempty"` FieldType int32 `protobuf:"varint,2,opt,name=fieldType" json:"fieldType,omitempty"` @@ -225,7 +233,7 @@ func (m *ModifyConversationFieldReq) Reset() { *m = ModifyConversationFi func (m *ModifyConversationFieldReq) String() string { return proto.CompactTextString(m) } func (*ModifyConversationFieldReq) ProtoMessage() {} func (*ModifyConversationFieldReq) Descriptor() ([]byte, []int) { - return fileDescriptor_conversation_e6bf38f800b9bed2, []int{2} + return fileDescriptor_conversation_ac55165355a1b6e6, []int{2} } func (m *ModifyConversationFieldReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ModifyConversationFieldReq.Unmarshal(m, b) @@ -284,7 +292,7 @@ func (m *ModifyConversationFieldResp) Reset() { *m = ModifyConversationF func (m *ModifyConversationFieldResp) String() string { return proto.CompactTextString(m) } func (*ModifyConversationFieldResp) ProtoMessage() {} func (*ModifyConversationFieldResp) Descriptor() ([]byte, []int) { - return fileDescriptor_conversation_e6bf38f800b9bed2, []int{3} + return fileDescriptor_conversation_ac55165355a1b6e6, []int{3} } func (m *ModifyConversationFieldResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ModifyConversationFieldResp.Unmarshal(m, b) @@ -391,39 +399,40 @@ var _Conversation_serviceDesc = grpc.ServiceDesc{ } func init() { - proto.RegisterFile("conversation/conversation.proto", fileDescriptor_conversation_e6bf38f800b9bed2) + proto.RegisterFile("conversation/conversation.proto", fileDescriptor_conversation_ac55165355a1b6e6) } -var fileDescriptor_conversation_e6bf38f800b9bed2 = []byte{ - // 475 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xdf, 0x8a, 0xd3, 0x40, - 0x14, 0x87, 0x49, 0xbb, 0xdb, 0x6d, 0x4e, 0xbb, 0x45, 0xe6, 0x42, 0x87, 0xae, 0x7f, 0x42, 0x10, - 0x89, 0x5e, 0x54, 0x58, 0x6f, 0x04, 0x61, 0x41, 0x53, 0x94, 0x80, 0xd5, 0x65, 0xa8, 0x08, 0xde, - 0xc5, 0xe6, 0xb4, 0x3b, 0x60, 0x67, 0xe2, 0xcc, 0xb4, 0x76, 0x6f, 0x7c, 0x32, 0x9f, 0xc4, 0xa7, - 0x91, 0x99, 0xb4, 0xbb, 0x33, 0x95, 0xc2, 0x5e, 0x9e, 0x2f, 0x27, 0xbf, 0xf9, 0x26, 0xe7, 0x04, - 0x9e, 0xcc, 0xa4, 0x58, 0xa3, 0xd2, 0xa5, 0xe1, 0x52, 0xbc, 0xf4, 0x8b, 0x51, 0xad, 0xa4, 0x91, - 0xa4, 0xef, 0xb3, 0xf4, 0x02, 0x20, 0x97, 0xcb, 0xa5, 0x14, 0x0c, 0x75, 0x4d, 0x28, 0x9c, 0xa0, - 0x52, 0xb9, 0xac, 0x90, 0x46, 0x49, 0x94, 0x1d, 0xb3, 0x5d, 0x49, 0xee, 0x43, 0x07, 0x95, 0x9a, - 0xe8, 0x05, 0x6d, 0x25, 0x51, 0x16, 0xb3, 0x6d, 0x95, 0xfe, 0x6d, 0x43, 0x3f, 0xf7, 0x02, 0x49, - 0x02, 0x3d, 0xf9, 0x4b, 0xa0, 0xfa, 0xa2, 0x51, 0x15, 0x63, 0x17, 0x13, 0x33, 0x1f, 0x91, 0x67, - 0x30, 0xf0, 0x15, 0x8a, 0xf1, 0x36, 0x72, 0x8f, 0x92, 0xc7, 0x00, 0x0a, 0x67, 0xeb, 0x89, 0x5e, - 0x7c, 0xae, 0x0d, 0x6d, 0x3b, 0x1f, 0x8f, 0x90, 0x17, 0x70, 0xcf, 0x7f, 0x63, 0x7a, 0x5d, 0x23, - 0x3d, 0x72, 0x5d, 0xff, 0x71, 0xab, 0xbf, 0x6a, 0x84, 0x8e, 0x1b, 0xfd, 0xa6, 0xb2, 0x17, 0x5e, - 0x28, 0xb9, 0xaa, 0x8b, 0x31, 0xed, 0xb8, 0x07, 0xbb, 0xd2, 0xde, 0x63, 0x25, 0x14, 0x96, 0x55, - 0x2e, 0x57, 0xc2, 0xd0, 0x13, 0x17, 0xec, 0x23, 0xf2, 0x14, 0x4e, 0x2b, 0x55, 0xce, 0xcd, 0x14, - 0x37, 0x66, 0xca, 0x97, 0x48, 0xbb, 0x49, 0x94, 0xb5, 0x59, 0x08, 0xc9, 0x10, 0xba, 0x5c, 0x5f, - 0x72, 0x21, 0xb0, 0xa2, 0x71, 0x12, 0x65, 0x5d, 0x76, 0x53, 0x93, 0x14, 0xfa, 0xa5, 0x31, 0xe5, - 0xec, 0x0a, 0xab, 0x42, 0xcc, 0x25, 0x05, 0xa7, 0x10, 0x30, 0x7b, 0x0a, 0xd7, 0x97, 0x8a, 0xaf, - 0x4b, 0x83, 0xf9, 0x55, 0x69, 0x68, 0xcf, 0x85, 0x84, 0xd0, 0xda, 0x3a, 0xf1, 0xb7, 0xc6, 0x7d, - 0x86, 0x7e, 0x63, 0xeb, 0x21, 0x7b, 0x16, 0xd7, 0x9f, 0xa4, 0x29, 0xc4, 0x07, 0x4b, 0xe9, 0xa9, - 0x8b, 0x09, 0x18, 0x19, 0x40, 0x0b, 0x37, 0x74, 0xe0, 0x2c, 0x5a, 0xb8, 0x49, 0xff, 0x44, 0x30, - 0x9c, 0xc8, 0x8a, 0xcf, 0xaf, 0xfd, 0x11, 0xbf, 0xe7, 0xf8, 0xa3, 0x62, 0xf8, 0x93, 0x5c, 0x40, - 0xb0, 0x4b, 0x6e, 0xd6, 0xbd, 0xf3, 0xe1, 0x28, 0x58, 0x3a, 0xff, 0x4d, 0x16, 0xf4, 0x93, 0x87, - 0x10, 0xcf, 0x6d, 0x96, 0x53, 0x6e, 0x39, 0xe5, 0x5b, 0x60, 0xc7, 0xdf, 0x0c, 0xe9, 0x23, 0xd7, - 0x76, 0xfc, 0xed, 0x2c, 0x66, 0x1e, 0x71, 0x8b, 0x56, 0xa3, 0xda, 0xed, 0xd0, 0xd1, 0x76, 0xd1, - 0x6e, 0x51, 0xfa, 0x15, 0xce, 0x0e, 0xda, 0xeb, 0x9a, 0xbc, 0x06, 0x98, 0xdd, 0xac, 0xfe, 0x56, - 0x9e, 0xee, 0xcb, 0xef, 0x9e, 0x33, 0xaf, 0xf7, 0xfc, 0x77, 0x78, 0x71, 0x22, 0xe0, 0xc1, 0x81, - 0x83, 0x48, 0x16, 0x06, 0x1e, 0xfe, 0x9a, 0xc3, 0xe7, 0x77, 0xec, 0xd4, 0xf5, 0xbb, 0x47, 0xdf, - 0xce, 0x46, 0xc1, 0xaf, 0xfd, 0xc6, 0x2f, 0xbe, 0x77, 0xdc, 0x8f, 0xfe, 0xea, 0x5f, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x8d, 0x8a, 0xf6, 0x60, 0x0b, 0x04, 0x00, 0x00, +var fileDescriptor_conversation_ac55165355a1b6e6 = []byte{ + // 494 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0x5f, 0x8b, 0x13, 0x31, + 0x14, 0xc5, 0x99, 0x6e, 0xb7, 0xdb, 0xde, 0x76, 0xab, 0x04, 0xd4, 0xd0, 0xf5, 0x4f, 0x19, 0x44, + 0x46, 0x1f, 0x2a, 0xac, 0x3e, 0x08, 0xc2, 0x82, 0x4e, 0x51, 0x06, 0xac, 0x2e, 0xa1, 0x8b, 0xe0, + 0xdb, 0xd8, 0xb9, 0xed, 0x06, 0x6c, 0x32, 0x26, 0x99, 0xda, 0x7d, 0xf1, 0x33, 0xf8, 0x81, 0xfc, + 0x70, 0x92, 0x4c, 0xbb, 0x4d, 0x56, 0x0b, 0x3e, 0xde, 0x5f, 0xee, 0x9c, 0x9c, 0x33, 0x3d, 0x1d, + 0x78, 0x34, 0x93, 0x62, 0x85, 0x4a, 0xe7, 0x86, 0x4b, 0xf1, 0xdc, 0x1f, 0x46, 0xa5, 0x92, 0x46, + 0x92, 0x9e, 0xcf, 0xe2, 0x33, 0x80, 0x54, 0x2e, 0x97, 0x52, 0x30, 0xd4, 0x25, 0xa1, 0x70, 0x84, + 0x4a, 0xa5, 0xb2, 0x40, 0x1a, 0x0d, 0xa3, 0xe4, 0x90, 0x6d, 0x47, 0x72, 0x17, 0x5a, 0xa8, 0xd4, + 0x44, 0x2f, 0x68, 0x63, 0x18, 0x25, 0x1d, 0xb6, 0x99, 0xe2, 0x5f, 0x4d, 0xe8, 0xa5, 0x9e, 0x20, + 0x19, 0x42, 0x57, 0xfe, 0x10, 0xa8, 0x2e, 0x34, 0xaa, 0x6c, 0xec, 0x64, 0x3a, 0xcc, 0x47, 0xe4, + 0x09, 0xf4, 0x7d, 0x0b, 0xd9, 0x78, 0x23, 0x79, 0x83, 0x92, 0x87, 0x00, 0x0a, 0x67, 0xab, 0x89, + 0x5e, 0x7c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xaf, 0xfc, 0x62, 0xbc, 0xe3, 0xf8, 0xad, 0x60, 0xf8, + 0x9d, 0x9c, 0x41, 0xd0, 0x40, 0xd7, 0x90, 0xee, 0xe9, 0x60, 0x14, 0x54, 0xd5, 0x7f, 0x92, 0x05, + 0xfb, 0xe4, 0x3e, 0x74, 0xe6, 0x56, 0xcb, 0x05, 0x6d, 0xb8, 0xa0, 0x3b, 0x60, 0x4b, 0x53, 0xff, + 0xb4, 0x1f, 0xb8, 0xb6, 0xa5, 0x39, 0x48, 0x3a, 0xcc, 0x23, 0xae, 0x9e, 0x25, 0xaa, 0x6d, 0xf3, + 0x9a, 0x9b, 0x7a, 0xee, 0x50, 0xfc, 0x19, 0x4e, 0xf6, 0xba, 0xd7, 0x25, 0x79, 0x05, 0x30, 0xbb, + 0xfe, 0xc3, 0x6c, 0xcc, 0xd3, 0x9b, 0xe6, 0xb7, 0xe7, 0xcc, 0xdb, 0x3d, 0xfd, 0x19, 0x06, 0x27, + 0x02, 0xee, 0xed, 0xb9, 0x88, 0x24, 0xa1, 0xe0, 0xfe, 0xb7, 0x39, 0x78, 0xfa, 0x9f, 0x9b, 0xba, + 0x7c, 0xfb, 0xe0, 0xcb, 0xc9, 0x28, 0xf8, 0x20, 0xbc, 0xf6, 0x87, 0xaf, 0x2d, 0xf7, 0x79, 0x78, + 0xf1, 0x27, 0x00, 0x00, 0xff, 0xff, 0x12, 0x56, 0xaa, 0x7b, 0x41, 0x04, 0x00, 0x00, } diff --git a/pkg/proto/conversation/conversation.proto b/pkg/proto/conversation/conversation.proto index 5ae5f1142..48973fdc1 100644 --- a/pkg/proto/conversation/conversation.proto +++ b/pkg/proto/conversation/conversation.proto @@ -21,6 +21,8 @@ message Conversation{ int32 groupAtType = 12; bool isNotInGroup = 13; string ex = 14; + int64 updateUnreadCountTime = 15; + } message ModifyConversationFieldReq{ Conversation conversation = 1; diff --git a/pkg/proto/user/user.pb.go b/pkg/proto/user/user.pb.go index df189119c..dc064a136 100644 --- a/pkg/proto/user/user.pb.go +++ b/pkg/proto/user/user.pb.go @@ -6,6 +6,7 @@ package user // import "./user" import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" +import conversation "Open_IM/pkg/proto/conversation" import sdk_ws "Open_IM/pkg/proto/sdk_ws" import ( @@ -36,7 +37,7 @@ func (m *CommonResp) Reset() { *m = CommonResp{} } func (m *CommonResp) String() string { return proto.CompactTextString(m) } func (*CommonResp) ProtoMessage() {} func (*CommonResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{0} + return fileDescriptor_user_862a17c60dc96c16, []int{0} } func (m *CommonResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CommonResp.Unmarshal(m, b) @@ -83,7 +84,7 @@ func (m *DeleteUsersReq) Reset() { *m = DeleteUsersReq{} } func (m *DeleteUsersReq) String() string { return proto.CompactTextString(m) } func (*DeleteUsersReq) ProtoMessage() {} func (*DeleteUsersReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{1} + return fileDescriptor_user_862a17c60dc96c16, []int{1} } func (m *DeleteUsersReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteUsersReq.Unmarshal(m, b) @@ -136,7 +137,7 @@ func (m *DeleteUsersResp) Reset() { *m = DeleteUsersResp{} } func (m *DeleteUsersResp) String() string { return proto.CompactTextString(m) } func (*DeleteUsersResp) ProtoMessage() {} func (*DeleteUsersResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{2} + return fileDescriptor_user_862a17c60dc96c16, []int{2} } func (m *DeleteUsersResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteUsersResp.Unmarshal(m, b) @@ -182,7 +183,7 @@ func (m *GetAllUserIDReq) Reset() { *m = GetAllUserIDReq{} } func (m *GetAllUserIDReq) String() string { return proto.CompactTextString(m) } func (*GetAllUserIDReq) ProtoMessage() {} func (*GetAllUserIDReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{3} + return fileDescriptor_user_862a17c60dc96c16, []int{3} } func (m *GetAllUserIDReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetAllUserIDReq.Unmarshal(m, b) @@ -228,7 +229,7 @@ func (m *GetAllUserIDResp) Reset() { *m = GetAllUserIDResp{} } func (m *GetAllUserIDResp) String() string { return proto.CompactTextString(m) } func (*GetAllUserIDResp) ProtoMessage() {} func (*GetAllUserIDResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{4} + return fileDescriptor_user_862a17c60dc96c16, []int{4} } func (m *GetAllUserIDResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetAllUserIDResp.Unmarshal(m, b) @@ -275,7 +276,7 @@ func (m *AccountCheckReq) Reset() { *m = AccountCheckReq{} } func (m *AccountCheckReq) String() string { return proto.CompactTextString(m) } func (*AccountCheckReq) ProtoMessage() {} func (*AccountCheckReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{5} + return fileDescriptor_user_862a17c60dc96c16, []int{5} } func (m *AccountCheckReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AccountCheckReq.Unmarshal(m, b) @@ -328,7 +329,7 @@ func (m *AccountCheckResp) Reset() { *m = AccountCheckResp{} } func (m *AccountCheckResp) String() string { return proto.CompactTextString(m) } func (*AccountCheckResp) ProtoMessage() {} func (*AccountCheckResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{6} + return fileDescriptor_user_862a17c60dc96c16, []int{6} } func (m *AccountCheckResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AccountCheckResp.Unmarshal(m, b) @@ -374,7 +375,7 @@ func (m *AccountCheckResp_SingleUserStatus) Reset() { *m = AccountCheckR func (m *AccountCheckResp_SingleUserStatus) String() string { return proto.CompactTextString(m) } func (*AccountCheckResp_SingleUserStatus) ProtoMessage() {} func (*AccountCheckResp_SingleUserStatus) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{6, 0} + return fileDescriptor_user_862a17c60dc96c16, []int{6, 0} } func (m *AccountCheckResp_SingleUserStatus) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AccountCheckResp_SingleUserStatus.Unmarshal(m, b) @@ -421,7 +422,7 @@ func (m *GetUserInfoReq) Reset() { *m = GetUserInfoReq{} } func (m *GetUserInfoReq) String() string { return proto.CompactTextString(m) } func (*GetUserInfoReq) ProtoMessage() {} func (*GetUserInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{7} + return fileDescriptor_user_862a17c60dc96c16, []int{7} } func (m *GetUserInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUserInfoReq.Unmarshal(m, b) @@ -474,7 +475,7 @@ func (m *GetUserInfoResp) Reset() { *m = GetUserInfoResp{} } func (m *GetUserInfoResp) String() string { return proto.CompactTextString(m) } func (*GetUserInfoResp) ProtoMessage() {} func (*GetUserInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{8} + return fileDescriptor_user_862a17c60dc96c16, []int{8} } func (m *GetUserInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUserInfoResp.Unmarshal(m, b) @@ -521,7 +522,7 @@ func (m *UpdateUserInfoReq) Reset() { *m = UpdateUserInfoReq{} } func (m *UpdateUserInfoReq) String() string { return proto.CompactTextString(m) } func (*UpdateUserInfoReq) ProtoMessage() {} func (*UpdateUserInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{9} + return fileDescriptor_user_862a17c60dc96c16, []int{9} } func (m *UpdateUserInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateUserInfoReq.Unmarshal(m, b) @@ -573,7 +574,7 @@ func (m *UpdateUserInfoResp) Reset() { *m = UpdateUserInfoResp{} } func (m *UpdateUserInfoResp) String() string { return proto.CompactTextString(m) } func (*UpdateUserInfoResp) ProtoMessage() {} func (*UpdateUserInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{10} + return fileDescriptor_user_862a17c60dc96c16, []int{10} } func (m *UpdateUserInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateUserInfoResp.Unmarshal(m, b) @@ -613,7 +614,7 @@ func (m *SetGlobalRecvMessageOptReq) Reset() { *m = SetGlobalRecvMessage func (m *SetGlobalRecvMessageOptReq) String() string { return proto.CompactTextString(m) } func (*SetGlobalRecvMessageOptReq) ProtoMessage() {} func (*SetGlobalRecvMessageOptReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{11} + return fileDescriptor_user_862a17c60dc96c16, []int{11} } func (m *SetGlobalRecvMessageOptReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetGlobalRecvMessageOptReq.Unmarshal(m, b) @@ -665,7 +666,7 @@ func (m *SetGlobalRecvMessageOptResp) Reset() { *m = SetGlobalRecvMessag func (m *SetGlobalRecvMessageOptResp) String() string { return proto.CompactTextString(m) } func (*SetGlobalRecvMessageOptResp) ProtoMessage() {} func (*SetGlobalRecvMessageOptResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{12} + return fileDescriptor_user_862a17c60dc96c16, []int{12} } func (m *SetGlobalRecvMessageOptResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetGlobalRecvMessageOptResp.Unmarshal(m, b) @@ -692,162 +693,20 @@ func (m *SetGlobalRecvMessageOptResp) GetCommonResp() *CommonResp { return nil } -type Conversation struct { - OwnerUserID string `protobuf:"bytes,1,opt,name=OwnerUserID" json:"OwnerUserID,omitempty"` - ConversationID string `protobuf:"bytes,2,opt,name=ConversationID" json:"ConversationID,omitempty"` - RecvMsgOpt int32 `protobuf:"varint,3,opt,name=RecvMsgOpt" json:"RecvMsgOpt,omitempty"` - ConversationType int32 `protobuf:"varint,4,opt,name=ConversationType" json:"ConversationType,omitempty"` - UserID string `protobuf:"bytes,5,opt,name=UserID" json:"UserID,omitempty"` - GroupID string `protobuf:"bytes,6,opt,name=GroupID" json:"GroupID,omitempty"` - UnreadCount int32 `protobuf:"varint,7,opt,name=UnreadCount" json:"UnreadCount,omitempty"` - DraftTextTime int64 `protobuf:"varint,8,opt,name=DraftTextTime" json:"DraftTextTime,omitempty"` - IsPinned bool `protobuf:"varint,9,opt,name=IsPinned" json:"IsPinned,omitempty"` - AttachedInfo string `protobuf:"bytes,10,opt,name=AttachedInfo" json:"AttachedInfo,omitempty"` - IsPrivateChat bool `protobuf:"varint,11,opt,name=IsPrivateChat" json:"IsPrivateChat,omitempty"` - GroupAtType int32 `protobuf:"varint,12,opt,name=GroupAtType" json:"GroupAtType,omitempty"` - IsNotInGroup bool `protobuf:"varint,13,opt,name=IsNotInGroup" json:"IsNotInGroup,omitempty"` - Ex string `protobuf:"bytes,14,opt,name=Ex" json:"Ex,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Conversation) Reset() { *m = Conversation{} } -func (m *Conversation) String() string { return proto.CompactTextString(m) } -func (*Conversation) ProtoMessage() {} -func (*Conversation) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{13} -} -func (m *Conversation) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Conversation.Unmarshal(m, b) -} -func (m *Conversation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Conversation.Marshal(b, m, deterministic) -} -func (dst *Conversation) XXX_Merge(src proto.Message) { - xxx_messageInfo_Conversation.Merge(dst, src) -} -func (m *Conversation) XXX_Size() int { - return xxx_messageInfo_Conversation.Size(m) -} -func (m *Conversation) XXX_DiscardUnknown() { - xxx_messageInfo_Conversation.DiscardUnknown(m) -} - -var xxx_messageInfo_Conversation proto.InternalMessageInfo - -func (m *Conversation) GetOwnerUserID() string { - if m != nil { - return m.OwnerUserID - } - return "" -} - -func (m *Conversation) GetConversationID() string { - if m != nil { - return m.ConversationID - } - return "" -} - -func (m *Conversation) GetRecvMsgOpt() int32 { - if m != nil { - return m.RecvMsgOpt - } - return 0 -} - -func (m *Conversation) GetConversationType() int32 { - if m != nil { - return m.ConversationType - } - return 0 -} - -func (m *Conversation) GetUserID() string { - if m != nil { - return m.UserID - } - return "" -} - -func (m *Conversation) GetGroupID() string { - if m != nil { - return m.GroupID - } - return "" -} - -func (m *Conversation) GetUnreadCount() int32 { - if m != nil { - return m.UnreadCount - } - return 0 -} - -func (m *Conversation) GetDraftTextTime() int64 { - if m != nil { - return m.DraftTextTime - } - return 0 -} - -func (m *Conversation) GetIsPinned() bool { - if m != nil { - return m.IsPinned - } - return false -} - -func (m *Conversation) GetAttachedInfo() string { - if m != nil { - return m.AttachedInfo - } - return "" -} - -func (m *Conversation) GetIsPrivateChat() bool { - if m != nil { - return m.IsPrivateChat - } - return false -} - -func (m *Conversation) GetGroupAtType() int32 { - if m != nil { - return m.GroupAtType - } - return 0 -} - -func (m *Conversation) GetIsNotInGroup() bool { - if m != nil { - return m.IsNotInGroup - } - return false -} - -func (m *Conversation) GetEx() string { - if m != nil { - return m.Ex - } - return "" -} - type SetConversationReq struct { - Conversation *Conversation `protobuf:"bytes,1,opt,name=Conversation" json:"Conversation,omitempty"` - NotificationType int32 `protobuf:"varint,2,opt,name=notificationType" json:"notificationType,omitempty"` - OperationID string `protobuf:"bytes,3,opt,name=OperationID" json:"OperationID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Conversation *conversation.Conversation `protobuf:"bytes,1,opt,name=Conversation" json:"Conversation,omitempty"` + NotificationType int32 `protobuf:"varint,2,opt,name=notificationType" json:"notificationType,omitempty"` + OperationID string `protobuf:"bytes,3,opt,name=OperationID" json:"OperationID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SetConversationReq) Reset() { *m = SetConversationReq{} } func (m *SetConversationReq) String() string { return proto.CompactTextString(m) } func (*SetConversationReq) ProtoMessage() {} func (*SetConversationReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{14} + return fileDescriptor_user_862a17c60dc96c16, []int{13} } func (m *SetConversationReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetConversationReq.Unmarshal(m, b) @@ -867,7 +726,7 @@ func (m *SetConversationReq) XXX_DiscardUnknown() { var xxx_messageInfo_SetConversationReq proto.InternalMessageInfo -func (m *SetConversationReq) GetConversation() *Conversation { +func (m *SetConversationReq) GetConversation() *conversation.Conversation { if m != nil { return m.Conversation } @@ -899,7 +758,7 @@ func (m *SetConversationResp) Reset() { *m = SetConversationResp{} } func (m *SetConversationResp) String() string { return proto.CompactTextString(m) } func (*SetConversationResp) ProtoMessage() {} func (*SetConversationResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{15} + return fileDescriptor_user_862a17c60dc96c16, []int{14} } func (m *SetConversationResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetConversationResp.Unmarshal(m, b) @@ -941,7 +800,7 @@ func (m *SetRecvMsgOptReq) Reset() { *m = SetRecvMsgOptReq{} } func (m *SetRecvMsgOptReq) String() string { return proto.CompactTextString(m) } func (*SetRecvMsgOptReq) ProtoMessage() {} func (*SetRecvMsgOptReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{16} + return fileDescriptor_user_862a17c60dc96c16, []int{15} } func (m *SetRecvMsgOptReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetRecvMsgOptReq.Unmarshal(m, b) @@ -1007,7 +866,7 @@ func (m *SetRecvMsgOptResp) Reset() { *m = SetRecvMsgOptResp{} } func (m *SetRecvMsgOptResp) String() string { return proto.CompactTextString(m) } func (*SetRecvMsgOptResp) ProtoMessage() {} func (*SetRecvMsgOptResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{17} + return fileDescriptor_user_862a17c60dc96c16, []int{16} } func (m *SetRecvMsgOptResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetRecvMsgOptResp.Unmarshal(m, b) @@ -1047,7 +906,7 @@ func (m *GetConversationReq) Reset() { *m = GetConversationReq{} } func (m *GetConversationReq) String() string { return proto.CompactTextString(m) } func (*GetConversationReq) ProtoMessage() {} func (*GetConversationReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{18} + return fileDescriptor_user_862a17c60dc96c16, []int{17} } func (m *GetConversationReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetConversationReq.Unmarshal(m, b) @@ -1089,18 +948,18 @@ func (m *GetConversationReq) GetOperationID() string { } type GetConversationResp struct { - CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` - Conversation *Conversation `protobuf:"bytes,2,opt,name=Conversation" json:"Conversation,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` + Conversation *conversation.Conversation `protobuf:"bytes,2,opt,name=Conversation" json:"Conversation,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetConversationResp) Reset() { *m = GetConversationResp{} } func (m *GetConversationResp) String() string { return proto.CompactTextString(m) } func (*GetConversationResp) ProtoMessage() {} func (*GetConversationResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{19} + return fileDescriptor_user_862a17c60dc96c16, []int{18} } func (m *GetConversationResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetConversationResp.Unmarshal(m, b) @@ -1127,7 +986,7 @@ func (m *GetConversationResp) GetCommonResp() *CommonResp { return nil } -func (m *GetConversationResp) GetConversation() *Conversation { +func (m *GetConversationResp) GetConversation() *conversation.Conversation { if m != nil { return m.Conversation } @@ -1147,7 +1006,7 @@ func (m *GetConversationsReq) Reset() { *m = GetConversationsReq{} } func (m *GetConversationsReq) String() string { return proto.CompactTextString(m) } func (*GetConversationsReq) ProtoMessage() {} func (*GetConversationsReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{20} + return fileDescriptor_user_862a17c60dc96c16, []int{19} } func (m *GetConversationsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetConversationsReq.Unmarshal(m, b) @@ -1189,18 +1048,18 @@ func (m *GetConversationsReq) GetOperationID() string { } type GetConversationsResp struct { - CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` - Conversations []*Conversation `protobuf:"bytes,2,rep,name=Conversations" json:"Conversations,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` + Conversations []*conversation.Conversation `protobuf:"bytes,2,rep,name=Conversations" json:"Conversations,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetConversationsResp) Reset() { *m = GetConversationsResp{} } func (m *GetConversationsResp) String() string { return proto.CompactTextString(m) } func (*GetConversationsResp) ProtoMessage() {} func (*GetConversationsResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{21} + return fileDescriptor_user_862a17c60dc96c16, []int{20} } func (m *GetConversationsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetConversationsResp.Unmarshal(m, b) @@ -1227,7 +1086,7 @@ func (m *GetConversationsResp) GetCommonResp() *CommonResp { return nil } -func (m *GetConversationsResp) GetConversations() []*Conversation { +func (m *GetConversationsResp) GetConversations() []*conversation.Conversation { if m != nil { return m.Conversations } @@ -1246,7 +1105,7 @@ func (m *GetAllConversationsReq) Reset() { *m = GetAllConversationsReq{} func (m *GetAllConversationsReq) String() string { return proto.CompactTextString(m) } func (*GetAllConversationsReq) ProtoMessage() {} func (*GetAllConversationsReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{22} + return fileDescriptor_user_862a17c60dc96c16, []int{21} } func (m *GetAllConversationsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetAllConversationsReq.Unmarshal(m, b) @@ -1281,18 +1140,18 @@ func (m *GetAllConversationsReq) GetOperationID() string { } type GetAllConversationsResp struct { - CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` - Conversations []*Conversation `protobuf:"bytes,2,rep,name=Conversations" json:"Conversations,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` + Conversations []*conversation.Conversation `protobuf:"bytes,2,rep,name=Conversations" json:"Conversations,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetAllConversationsResp) Reset() { *m = GetAllConversationsResp{} } func (m *GetAllConversationsResp) String() string { return proto.CompactTextString(m) } func (*GetAllConversationsResp) ProtoMessage() {} func (*GetAllConversationsResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{23} + return fileDescriptor_user_862a17c60dc96c16, []int{22} } func (m *GetAllConversationsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetAllConversationsResp.Unmarshal(m, b) @@ -1319,7 +1178,7 @@ func (m *GetAllConversationsResp) GetCommonResp() *CommonResp { return nil } -func (m *GetAllConversationsResp) GetConversations() []*Conversation { +func (m *GetAllConversationsResp) GetConversations() []*conversation.Conversation { if m != nil { return m.Conversations } @@ -1327,20 +1186,20 @@ func (m *GetAllConversationsResp) GetConversations() []*Conversation { } type BatchSetConversationsReq struct { - Conversations []*Conversation `protobuf:"bytes,1,rep,name=Conversations" json:"Conversations,omitempty"` - OwnerUserID string `protobuf:"bytes,2,opt,name=OwnerUserID" json:"OwnerUserID,omitempty"` - NotificationType int32 `protobuf:"varint,3,opt,name=notificationType" json:"notificationType,omitempty"` - OperationID string `protobuf:"bytes,4,opt,name=OperationID" json:"OperationID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Conversations []*conversation.Conversation `protobuf:"bytes,1,rep,name=Conversations" json:"Conversations,omitempty"` + OwnerUserID string `protobuf:"bytes,2,opt,name=OwnerUserID" json:"OwnerUserID,omitempty"` + NotificationType int32 `protobuf:"varint,3,opt,name=notificationType" json:"notificationType,omitempty"` + OperationID string `protobuf:"bytes,4,opt,name=OperationID" json:"OperationID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *BatchSetConversationsReq) Reset() { *m = BatchSetConversationsReq{} } func (m *BatchSetConversationsReq) String() string { return proto.CompactTextString(m) } func (*BatchSetConversationsReq) ProtoMessage() {} func (*BatchSetConversationsReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{24} + return fileDescriptor_user_862a17c60dc96c16, []int{23} } func (m *BatchSetConversationsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BatchSetConversationsReq.Unmarshal(m, b) @@ -1360,7 +1219,7 @@ func (m *BatchSetConversationsReq) XXX_DiscardUnknown() { var xxx_messageInfo_BatchSetConversationsReq proto.InternalMessageInfo -func (m *BatchSetConversationsReq) GetConversations() []*Conversation { +func (m *BatchSetConversationsReq) GetConversations() []*conversation.Conversation { if m != nil { return m.Conversations } @@ -1401,7 +1260,7 @@ func (m *BatchSetConversationsResp) Reset() { *m = BatchSetConversations func (m *BatchSetConversationsResp) String() string { return proto.CompactTextString(m) } func (*BatchSetConversationsResp) ProtoMessage() {} func (*BatchSetConversationsResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{25} + return fileDescriptor_user_862a17c60dc96c16, []int{24} } func (m *BatchSetConversationsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BatchSetConversationsResp.Unmarshal(m, b) @@ -1454,7 +1313,7 @@ func (m *ResignUserReq) Reset() { *m = ResignUserReq{} } func (m *ResignUserReq) String() string { return proto.CompactTextString(m) } func (*ResignUserReq) ProtoMessage() {} func (*ResignUserReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{26} + return fileDescriptor_user_862a17c60dc96c16, []int{25} } func (m *ResignUserReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResignUserReq.Unmarshal(m, b) @@ -1499,7 +1358,7 @@ func (m *ResignUserResp) Reset() { *m = ResignUserResp{} } func (m *ResignUserResp) String() string { return proto.CompactTextString(m) } func (*ResignUserResp) ProtoMessage() {} func (*ResignUserResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{27} + return fileDescriptor_user_862a17c60dc96c16, []int{26} } func (m *ResignUserResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResignUserResp.Unmarshal(m, b) @@ -1538,7 +1397,7 @@ func (m *GetUserByIdReq) Reset() { *m = GetUserByIdReq{} } func (m *GetUserByIdReq) String() string { return proto.CompactTextString(m) } func (*GetUserByIdReq) ProtoMessage() {} func (*GetUserByIdReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{28} + return fileDescriptor_user_862a17c60dc96c16, []int{27} } func (m *GetUserByIdReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUserByIdReq.Unmarshal(m, b) @@ -1597,7 +1456,7 @@ func (m *User) Reset() { *m = User{} } func (m *User) String() string { return proto.CompactTextString(m) } func (*User) ProtoMessage() {} func (*User) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{29} + return fileDescriptor_user_862a17c60dc96c16, []int{28} } func (m *User) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_User.Unmarshal(m, b) @@ -1734,7 +1593,7 @@ func (m *GetUserByIdResp) Reset() { *m = GetUserByIdResp{} } func (m *GetUserByIdResp) String() string { return proto.CompactTextString(m) } func (*GetUserByIdResp) ProtoMessage() {} func (*GetUserByIdResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{30} + return fileDescriptor_user_862a17c60dc96c16, []int{29} } func (m *GetUserByIdResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUserByIdResp.Unmarshal(m, b) @@ -1781,7 +1640,7 @@ func (m *GetUsersByNameReq) Reset() { *m = GetUsersByNameReq{} } func (m *GetUsersByNameReq) String() string { return proto.CompactTextString(m) } func (*GetUsersByNameReq) ProtoMessage() {} func (*GetUsersByNameReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{31} + return fileDescriptor_user_862a17c60dc96c16, []int{30} } func (m *GetUsersByNameReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUsersByNameReq.Unmarshal(m, b) @@ -1835,7 +1694,7 @@ func (m *GetUsersByNameResp) Reset() { *m = GetUsersByNameResp{} } func (m *GetUsersByNameResp) String() string { return proto.CompactTextString(m) } func (*GetUsersByNameResp) ProtoMessage() {} func (*GetUsersByNameResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{32} + return fileDescriptor_user_862a17c60dc96c16, []int{31} } func (m *GetUsersByNameResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUsersByNameResp.Unmarshal(m, b) @@ -1895,7 +1754,7 @@ func (m *AlterUserReq) Reset() { *m = AlterUserReq{} } func (m *AlterUserReq) String() string { return proto.CompactTextString(m) } func (*AlterUserReq) ProtoMessage() {} func (*AlterUserReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{33} + return fileDescriptor_user_862a17c60dc96c16, []int{32} } func (m *AlterUserReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AlterUserReq.Unmarshal(m, b) @@ -1989,7 +1848,7 @@ func (m *AlterUserResp) Reset() { *m = AlterUserResp{} } func (m *AlterUserResp) String() string { return proto.CompactTextString(m) } func (*AlterUserResp) ProtoMessage() {} func (*AlterUserResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{34} + return fileDescriptor_user_862a17c60dc96c16, []int{33} } func (m *AlterUserResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AlterUserResp.Unmarshal(m, b) @@ -2029,7 +1888,7 @@ func (m *GetUsersReq) Reset() { *m = GetUsersReq{} } func (m *GetUsersReq) String() string { return proto.CompactTextString(m) } func (*GetUsersReq) ProtoMessage() {} func (*GetUsersReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{35} + return fileDescriptor_user_862a17c60dc96c16, []int{34} } func (m *GetUsersReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUsersReq.Unmarshal(m, b) @@ -2084,7 +1943,7 @@ func (m *GetUsersResp) Reset() { *m = GetUsersResp{} } func (m *GetUsersResp) String() string { return proto.CompactTextString(m) } func (*GetUsersResp) ProtoMessage() {} func (*GetUsersResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{36} + return fileDescriptor_user_862a17c60dc96c16, []int{35} } func (m *GetUsersResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUsersResp.Unmarshal(m, b) @@ -2151,7 +2010,7 @@ func (m *AddUserReq) Reset() { *m = AddUserReq{} } func (m *AddUserReq) String() string { return proto.CompactTextString(m) } func (*AddUserReq) ProtoMessage() {} func (*AddUserReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{37} + return fileDescriptor_user_862a17c60dc96c16, []int{36} } func (m *AddUserReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddUserReq.Unmarshal(m, b) @@ -2245,7 +2104,7 @@ func (m *AddUserResp) Reset() { *m = AddUserResp{} } func (m *AddUserResp) String() string { return proto.CompactTextString(m) } func (*AddUserResp) ProtoMessage() {} func (*AddUserResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{38} + return fileDescriptor_user_862a17c60dc96c16, []int{37} } func (m *AddUserResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddUserResp.Unmarshal(m, b) @@ -2286,7 +2145,7 @@ func (m *BlockUserReq) Reset() { *m = BlockUserReq{} } func (m *BlockUserReq) String() string { return proto.CompactTextString(m) } func (*BlockUserReq) ProtoMessage() {} func (*BlockUserReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{39} + return fileDescriptor_user_862a17c60dc96c16, []int{38} } func (m *BlockUserReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BlockUserReq.Unmarshal(m, b) @@ -2345,7 +2204,7 @@ func (m *BlockUserResp) Reset() { *m = BlockUserResp{} } func (m *BlockUserResp) String() string { return proto.CompactTextString(m) } func (*BlockUserResp) ProtoMessage() {} func (*BlockUserResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{40} + return fileDescriptor_user_862a17c60dc96c16, []int{39} } func (m *BlockUserResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BlockUserResp.Unmarshal(m, b) @@ -2385,7 +2244,7 @@ func (m *UnBlockUserReq) Reset() { *m = UnBlockUserReq{} } func (m *UnBlockUserReq) String() string { return proto.CompactTextString(m) } func (*UnBlockUserReq) ProtoMessage() {} func (*UnBlockUserReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{41} + return fileDescriptor_user_862a17c60dc96c16, []int{40} } func (m *UnBlockUserReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UnBlockUserReq.Unmarshal(m, b) @@ -2437,7 +2296,7 @@ func (m *UnBlockUserResp) Reset() { *m = UnBlockUserResp{} } func (m *UnBlockUserResp) String() string { return proto.CompactTextString(m) } func (*UnBlockUserResp) ProtoMessage() {} func (*UnBlockUserResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{42} + return fileDescriptor_user_862a17c60dc96c16, []int{41} } func (m *UnBlockUserResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UnBlockUserResp.Unmarshal(m, b) @@ -2477,7 +2336,7 @@ func (m *GetBlockUsersReq) Reset() { *m = GetBlockUsersReq{} } func (m *GetBlockUsersReq) String() string { return proto.CompactTextString(m) } func (*GetBlockUsersReq) ProtoMessage() {} func (*GetBlockUsersReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{43} + return fileDescriptor_user_862a17c60dc96c16, []int{42} } func (m *GetBlockUsersReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetBlockUsersReq.Unmarshal(m, b) @@ -2531,7 +2390,7 @@ func (m *BlockUser) Reset() { *m = BlockUser{} } func (m *BlockUser) String() string { return proto.CompactTextString(m) } func (*BlockUser) ProtoMessage() {} func (*BlockUser) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{44} + return fileDescriptor_user_862a17c60dc96c16, []int{43} } func (m *BlockUser) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BlockUser.Unmarshal(m, b) @@ -2586,7 +2445,7 @@ func (m *GetBlockUsersResp) Reset() { *m = GetBlockUsersResp{} } func (m *GetBlockUsersResp) String() string { return proto.CompactTextString(m) } func (*GetBlockUsersResp) ProtoMessage() {} func (*GetBlockUsersResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{45} + return fileDescriptor_user_862a17c60dc96c16, []int{44} } func (m *GetBlockUsersResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetBlockUsersResp.Unmarshal(m, b) @@ -2646,7 +2505,7 @@ func (m *GetBlockUserByIdReq) Reset() { *m = GetBlockUserByIdReq{} } func (m *GetBlockUserByIdReq) String() string { return proto.CompactTextString(m) } func (*GetBlockUserByIdReq) ProtoMessage() {} func (*GetBlockUserByIdReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{46} + return fileDescriptor_user_862a17c60dc96c16, []int{45} } func (m *GetBlockUserByIdReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetBlockUserByIdReq.Unmarshal(m, b) @@ -2691,7 +2550,7 @@ func (m *GetBlockUserByIdResp) Reset() { *m = GetBlockUserByIdResp{} } func (m *GetBlockUserByIdResp) String() string { return proto.CompactTextString(m) } func (*GetBlockUserByIdResp) ProtoMessage() {} func (*GetBlockUserByIdResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{47} + return fileDescriptor_user_862a17c60dc96c16, []int{46} } func (m *GetBlockUserByIdResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetBlockUserByIdResp.Unmarshal(m, b) @@ -2731,7 +2590,7 @@ func (m *DeleteUserReq) Reset() { *m = DeleteUserReq{} } func (m *DeleteUserReq) String() string { return proto.CompactTextString(m) } func (*DeleteUserReq) ProtoMessage() {} func (*DeleteUserReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{48} + return fileDescriptor_user_862a17c60dc96c16, []int{47} } func (m *DeleteUserReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteUserReq.Unmarshal(m, b) @@ -2783,7 +2642,7 @@ func (m *DeleteUserResp) Reset() { *m = DeleteUserResp{} } func (m *DeleteUserResp) String() string { return proto.CompactTextString(m) } func (*DeleteUserResp) ProtoMessage() {} func (*DeleteUserResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_461ee57002abbf2b, []int{49} + return fileDescriptor_user_862a17c60dc96c16, []int{48} } func (m *DeleteUserResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteUserResp.Unmarshal(m, b) @@ -2825,7 +2684,6 @@ func init() { proto.RegisterType((*UpdateUserInfoResp)(nil), "user.UpdateUserInfoResp") proto.RegisterType((*SetGlobalRecvMessageOptReq)(nil), "user.SetGlobalRecvMessageOptReq") proto.RegisterType((*SetGlobalRecvMessageOptResp)(nil), "user.SetGlobalRecvMessageOptResp") - proto.RegisterType((*Conversation)(nil), "user.Conversation") proto.RegisterType((*SetConversationReq)(nil), "user.SetConversationReq") proto.RegisterType((*SetConversationResp)(nil), "user.SetConversationResp") proto.RegisterType((*SetRecvMsgOptReq)(nil), "user.SetRecvMsgOptReq") @@ -3662,136 +3520,127 @@ var _User_serviceDesc = grpc.ServiceDesc{ Metadata: "user/user.proto", } -func init() { proto.RegisterFile("user/user.proto", fileDescriptor_user_461ee57002abbf2b) } +func init() { proto.RegisterFile("user/user.proto", fileDescriptor_user_862a17c60dc96c16) } -var fileDescriptor_user_461ee57002abbf2b = []byte{ - // 2047 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5a, 0xcd, 0x6f, 0x23, 0x49, - 0x15, 0x57, 0xfb, 0x63, 0x12, 0x3f, 0xc7, 0x8e, 0x53, 0x93, 0x9d, 0xf4, 0xf6, 0xc2, 0x90, 0x6d, - 0x2d, 0x4b, 0x34, 0x12, 0x09, 0x0c, 0x88, 0x41, 0x8b, 0x60, 0x37, 0x76, 0x32, 0x96, 0xd1, 0x4c, - 0x12, 0xb5, 0x67, 0x24, 0x84, 0x10, 0x51, 0x8f, 0x5d, 0x71, 0x5a, 0xb1, 0xbb, 0x7b, 0xbb, 0xca, - 0xf3, 0xc1, 0x65, 0xd1, 0x00, 0x17, 0xc4, 0x85, 0x13, 0x82, 0x03, 0x7f, 0x0c, 0x70, 0xe2, 0x3f, - 0x80, 0x0b, 0xff, 0x03, 0x17, 0x2e, 0x1c, 0x50, 0x7d, 0x74, 0x77, 0x55, 0x77, 0x3b, 0x36, 0x9d, - 0x68, 0xf6, 0x92, 0xe4, 0xfd, 0xaa, 0xea, 0xf5, 0x7b, 0xaf, 0xde, 0x57, 0x55, 0x05, 0x36, 0xe7, - 0x04, 0x47, 0x07, 0xec, 0xc7, 0x7e, 0x18, 0x05, 0x34, 0x40, 0x35, 0xf6, 0xb7, 0xf5, 0xe1, 0x69, - 0x88, 0xfd, 0xf3, 0xc1, 0xd3, 0x83, 0xf0, 0x6a, 0x72, 0xc0, 0x07, 0x0e, 0xc8, 0xf8, 0xea, 0xfc, - 0x15, 0x39, 0x78, 0x45, 0xc4, 0x44, 0xfb, 0x47, 0x00, 0xbd, 0x60, 0x36, 0x0b, 0x7c, 0x07, 0x93, - 0x10, 0x99, 0xb0, 0x86, 0xa3, 0xa8, 0x17, 0x8c, 0xb1, 0x69, 0xec, 0x1a, 0x7b, 0x75, 0x27, 0x26, - 0xd1, 0x3d, 0xb8, 0x83, 0xa3, 0xe8, 0x29, 0x99, 0x98, 0x95, 0x5d, 0x63, 0xaf, 0xe1, 0x48, 0xca, - 0xfe, 0x05, 0xb4, 0x8f, 0xf0, 0x14, 0x53, 0xfc, 0x9c, 0xe0, 0x88, 0x38, 0xf8, 0x73, 0xf4, 0x00, - 0x3a, 0x29, 0x32, 0x38, 0x7a, 0xe2, 0x11, 0x6a, 0x56, 0x76, 0xab, 0x7b, 0x0d, 0x27, 0x87, 0x23, - 0x0b, 0xd6, 0x4f, 0x43, 0x41, 0x9b, 0x55, 0xce, 0x37, 0xa1, 0xd1, 0x2e, 0x34, 0x4f, 0x43, 0x1c, - 0xb9, 0xd4, 0x0b, 0xfc, 0xc1, 0x91, 0x59, 0xe3, 0xc3, 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, 0xca, - 0x3b, 0x07, 0x74, 0x57, 0xcc, 0xd3, 0x2e, 0x34, 0xac, 0xed, 0x3c, 0x48, 0x42, 0xf4, 0x5d, 0x68, - 0x24, 0xdd, 0x3b, 0x92, 0x17, 0x43, 0xea, 0x61, 0xc6, 0xba, 0x9b, 0xc3, 0x48, 0x88, 0xbe, 0x0d, - 0xeb, 0xb1, 0x10, 0x68, 0x4b, 0x17, 0x8a, 0xad, 0x41, 0x59, 0x88, 0x84, 0x68, 0x1f, 0xd6, 0x64, - 0x53, 0x86, 0x64, 0xea, 0x4a, 0xfb, 0x52, 0x6b, 0x2b, 0x83, 0x08, 0xc1, 0xd2, 0x1a, 0x8b, 0xb2, - 0x69, 0x39, 0x15, 0x4c, 0x6f, 0x36, 0x3e, 0x81, 0xa6, 0xd2, 0x7f, 0xc4, 0x1b, 0xa1, 0xb7, 0x3e, - 0xf1, 0x46, 0x64, 0x1b, 0x95, 0xcf, 0xa0, 0xa5, 0xd5, 0x54, 0x94, 0xc6, 0xbd, 0xd6, 0x8a, 0x58, - 0x3b, 0x85, 0x78, 0x12, 0x35, 0x5a, 0xa1, 0x51, 0xa2, 0x26, 0x5b, 0xd2, 0x94, 0xa8, 0xc9, 0xd7, - 0xa6, 0x47, 0x00, 0x69, 0xb6, 0x8a, 0x37, 0x54, 0x2b, 0x3f, 0xd6, 0x76, 0x1e, 0x24, 0x61, 0xb7, - 0xf5, 0xd3, 0xe6, 0x3e, 0xff, 0xc7, 0x87, 0x1f, 0xb0, 0x1f, 0x2f, 0xee, 0xf0, 0xff, 0x6a, 0xf8, - 0xce, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xa5, 0x63, 0x75, 0x08, 0x11, 0x21, 0x00, 0x00, +var fileDescriptor_user_862a17c60dc96c16 = []byte{ + // 1900 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0xcb, 0x6f, 0x23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 0xdb, 0x9c, 0xe1, 0x68, + 0x05, 0x86, 0x59, 0x1f, 0xd4, 0x07, 0x70, 0x30, 0x99, 0x4f, 0xe3, 0x94, 0x61, 0xfd, 0xf1, 0x77, + 0xf8, 0x88, 0xfc, 0xec, 0x9d, 0xa1, 0xe7, 0x4f, 0xa6, 0xcc, 0x25, 0x86, 0xb1, 0x1b, 0xcf, 0x89, + 0x23, 0x0d, 0xb5, 0x4e, 0xa1, 0x9d, 0x6f, 0xa7, 0xae, 0x3d, 0x97, 0x17, 0x50, 0x48, 0xe8, 0x23, + 0x68, 0xb8, 0x7c, 0x72, 0xde, 0x51, 0xd0, 0x57, 0x41, 0xdb, 0x87, 0x66, 0x1f, 0xc7, 0xcc, 0x20, + 0xfe, 0x45, 0x40, 0x6d, 0xfb, 0x10, 0x60, 0x9e, 0x37, 0xab, 0x84, 0xdc, 0xd2, 0xa2, 0xbf, 0x31, + 0x98, 0x13, 0x66, 0x1f, 0x2c, 0x65, 0xd0, 0xcf, 0x61, 0x2b, 0x99, 0x81, 0x69, 0x59, 0x61, 0x26, + 0xfd, 0xa0, 0x43, 0x70, 0xf4, 0x1a, 0x47, 0x67, 0x6e, 0xe8, 0x9d, 0x85, 0x6e, 0xe4, 0xce, 0x48, + 0x27, 0xfd, 0x90, 0x32, 0xc0, 0xfe, 0xda, 0x80, 0xed, 0x57, 0xe1, 0xd8, 0x15, 0xe1, 0x2c, 0xa8, + 0x3f, 0x81, 0x8d, 0x44, 0x14, 0x6a, 0xdc, 0x38, 0x65, 0xda, 0x79, 0x99, 0x4d, 0x02, 0xdd, 0x26, + 0x72, 0x18, 0x3d, 0x03, 0x94, 0xd7, 0xa5, 0x8c, 0x55, 0xec, 0x5f, 0x19, 0x60, 0x0d, 0x71, 0xdc, + 0x9f, 0x06, 0xe7, 0xee, 0xd4, 0xc1, 0xa3, 0xd7, 0x2f, 0x30, 0x21, 0xee, 0x04, 0x9f, 0x84, 0x31, + 0x65, 0xb7, 0xc8, 0x51, 0x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9b, 0xb5, 0xa8, 0x89, 0x84, 0xe8, 0x27, + 0xf0, 0x5e, 0xe1, 0xd1, 0x1e, 0x3d, 0x14, 0xb1, 0xb6, 0xe0, 0x16, 0xc3, 0xfa, 0xd6, 0x8d, 0xed, + 0xdc, 0x80, 0xc3, 0x62, 0x03, 0x0e, 0x17, 0x1a, 0xb0, 0xe8, 0x7e, 0xf6, 0x29, 0x34, 0x94, 0x0b, + 0x4a, 0xf4, 0x20, 0xed, 0xab, 0xdc, 0xc0, 0x5a, 0xbb, 0x85, 0x38, 0x77, 0x42, 0xe9, 0x74, 0x96, + 0x8b, 0x32, 0x91, 0xc1, 0x72, 0x51, 0x96, 0x66, 0xa1, 0x5e, 0x7a, 0xd4, 0x17, 0x27, 0x9b, 0x24, + 0xca, 0xb4, 0x93, 0x98, 0x65, 0x16, 0x37, 0x90, 0x10, 0x3d, 0x61, 0x6f, 0x4b, 0xe2, 0xce, 0x01, + 0xdd, 0xe7, 0xfd, 0x94, 0x0b, 0x0d, 0x6b, 0x47, 0x07, 0x49, 0x88, 0x7e, 0x00, 0x9b, 0xe9, 0xee, + 0x1d, 0x21, 0xe1, 0xa9, 0xd2, 0x61, 0xc6, 0xba, 0xaf, 0x61, 0x24, 0x44, 0x9f, 0xc0, 0x46, 0xa2, + 0x04, 0xda, 0x56, 0x95, 0xa2, 0x63, 0x50, 0x1e, 0x22, 0x21, 0xea, 0xc0, 0xba, 0xd8, 0x94, 0x21, + 0x91, 0xba, 0xb2, 0x7d, 0xa9, 0xb5, 0x9d, 0x43, 0xb8, 0x62, 0x59, 0x8d, 0x45, 0xf9, 0xb4, 0x9c, + 0x29, 0xa6, 0x6e, 0x36, 0x3e, 0x85, 0xba, 0xb4, 0xff, 0x48, 0x16, 0x42, 0xdd, 0xfa, 0x24, 0x0b, + 0x91, 0xdf, 0xa8, 0x3c, 0x85, 0x86, 0x52, 0x53, 0x51, 0x16, 0xf7, 0xca, 0x56, 0xc4, 0xda, 0x2d, + 0xc4, 0xd3, 0xa8, 0x51, 0x0a, 0x8d, 0x14, 0x35, 0xf9, 0x92, 0x26, 0x45, 0x8d, 0x5e, 0x9b, 0x9e, + 0x00, 0x64, 0xd9, 0x2a, 0x59, 0x50, 0xa5, 0xfc, 0x58, 0x3b, 0x3a, 0x48, 0xc2, 0x6e, 0xe3, 0xa7, + 0xf5, 0x0e, 0x7b, 0x77, 0xff, 0x21, 0xfd, 0x73, 0x7e, 0x8f, 0xbd, 0x90, 0x7f, 0xff, 0x7f, 0x01, + 0x00, 0x00, 0xff, 0xff, 0xb3, 0xba, 0x11, 0x76, 0x90, 0x1f, 0x00, 0x00, } diff --git a/pkg/proto/user/user.proto b/pkg/proto/user/user.proto index dc2751c21..a404a0c9e 100644 --- a/pkg/proto/user/user.proto +++ b/pkg/proto/user/user.proto @@ -1,5 +1,6 @@ syntax = "proto3"; import "Open_IM/pkg/proto/sdk_ws/ws.proto"; +import "Open_IM/pkg/proto/conversation/conversation.proto"; option go_package = "./user;user"; package user; @@ -75,25 +76,8 @@ message SetGlobalRecvMessageOptResp{ CommonResp commonResp = 1; } -message Conversation{ - string OwnerUserID = 1; - string ConversationID = 2; - int32 RecvMsgOpt = 3; - int32 ConversationType = 4; - string UserID = 5; - string GroupID = 6; - int32 UnreadCount = 7; - int64 DraftTextTime = 8; - bool IsPinned = 9; - string AttachedInfo = 10; - bool IsPrivateChat = 11; - int32 GroupAtType = 12; - bool IsNotInGroup = 13; - string Ex = 14; -} - message SetConversationReq{ - Conversation Conversation = 1; + conversation.Conversation Conversation = 1; int32 notificationType = 2; string OperationID = 3; } @@ -122,7 +106,7 @@ message GetConversationReq{ message GetConversationResp{ CommonResp commonResp = 1; - Conversation Conversation = 2; + conversation.Conversation Conversation = 2; } message GetConversationsReq{ @@ -133,7 +117,7 @@ message GetConversationsReq{ message GetConversationsResp{ CommonResp commonResp = 1; - repeated Conversation Conversations = 2; + repeated conversation.Conversation Conversations = 2; } message GetAllConversationsReq{ @@ -143,11 +127,11 @@ message GetAllConversationsReq{ message GetAllConversationsResp{ CommonResp commonResp = 1; - repeated Conversation Conversations = 2; + repeated conversation.Conversation Conversations = 2; } message BatchSetConversationsReq{ - repeated Conversation Conversations = 1; + repeated conversation.Conversation Conversations = 1; string OwnerUserID = 2; int32 notificationType = 3; string OperationID = 4;