From e439ef4ddd76301b73f983125797b99ff66e76e7 Mon Sep 17 00:00:00 2001 From: wenxu12345 <44203734@qq.com> Date: Mon, 27 Dec 2021 16:48:05 +0800 Subject: [PATCH] tidy code --- internal/api/user/get_user_info.go | 142 --- internal/api/user/update_user_info.go | 61 - internal/api/user/user.go | 164 +++ internal/rpc/auth/auth.go | 100 ++ internal/rpc/auth/rpcAuth.go | 62 - internal/rpc/auth/user_register.go | 20 - internal/rpc/auth/user_token.go | 29 - internal/rpc/group/group.go | 80 +- internal/rpc/msg/send_msg.go | 23 +- internal/rpc/user/conversation.go | 59 - internal/rpc/user/get_user_info.go | 90 -- .../get_user_info_to_client.go | 16 - internal/rpc/user/management_user.go | 96 -- internal/rpc/user/update_user_info.go | 85 -- internal/rpc/user/user.go | 238 ++++ pkg/base_info/friend_api_struct.go | 35 +- pkg/base_info/user_api_struct.go | 29 + .../mysql_model/im_mysql_model/group_model.go | 227 +--- .../im_mysql_model/group_request_model.go | 150 ++- .../im_mysql_model/model_struct.go | 6 +- .../im_mysql_model/user_black_list_model.go | 32 +- .../mysql_model/im_mysql_model/user_model.go | 166 +-- pkg/proto/auth/auth.pb.go | 233 ++-- pkg/proto/auth/auth.proto | 37 +- pkg/proto/user/user.pb.go | 1002 +++++++---------- pkg/proto/user/user.proto | 138 +-- 26 files changed, 1421 insertions(+), 1899 deletions(-) delete mode 100644 internal/api/user/get_user_info.go create mode 100644 internal/api/user/user.go create mode 100644 internal/rpc/auth/auth.go delete mode 100644 internal/rpc/auth/rpcAuth.go delete mode 100644 internal/rpc/auth/user_register.go delete mode 100644 internal/rpc/auth/user_token.go delete mode 100644 internal/rpc/user/conversation.go delete mode 100644 internal/rpc/user/get_user_info.go delete mode 100644 internal/rpc/user/internal_service/get_user_info_to_client.go delete mode 100644 internal/rpc/user/management_user.go delete mode 100644 internal/rpc/user/update_user_info.go create mode 100644 internal/rpc/user/user.go create mode 100644 pkg/base_info/user_api_struct.go diff --git a/internal/api/user/get_user_info.go b/internal/api/user/get_user_info.go deleted file mode 100644 index db8a6d77d..000000000 --- a/internal/api/user/get_user_info.go +++ /dev/null @@ -1,142 +0,0 @@ -package user - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pbRelay "Open_IM/pkg/proto/relay" - pbUser "Open_IM/pkg/proto/user" - "context" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -type userInfo struct { - UID string `json:"uid"` - Name string `json:"name"` - Icon string `json:"icon"` - Gender int32 `json:"gender"` - Mobile string `json:"mobile"` - Birth string `json:"birth"` - Email string `json:"email"` - Ex string `json:"ex"` -} - -type paramsGetUsersOnlineStatus struct { - OperationID string `json:"operationID" binding:"required"` - UserIDList []string `json:"userIDList" binding:"required,lte=200"` - Secret string `json:"secret" binding:"required,max=32"` -} - -func GetUsersOnlineStatus(c *gin.Context) { - params := paramsGetUsersOnlineStatus{} - if err := c.BindJSON(¶ms); err != nil { - log.NewError(params.OperationID, "bind json failed ", err.Error(), c) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - - if params.Secret != config.Config.Secret { - log.NewError(params.OperationID, "parse token failed ", params.Secret, config.Config.Secret) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "secret failed"}) - return - } - - req := &pbRelay.GetUsersOnlineStatusReq{ - OperationID: params.OperationID, - UserIDList: params.UserIDList, - } - var wsResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult - var respResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult - flag := false - log.NewDebug(params.OperationID, "GetUsersOnlineStatus req come here", params.UserIDList) - - grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName) - for _, v := range grpcCons { - client := pbRelay.NewOnlineMessageRelayServiceClient(v) - reply, err := client.GetUsersOnlineStatus(context.Background(), req) - if err != nil { - log.NewError(params.OperationID, "GetUsersOnlineStatus rpc err", req.String(), err.Error()) - continue - } else { - if reply.ErrCode == 0 { - wsResult = append(wsResult, reply.SuccessResult...) - } - } - } - log.NewDebug(params.OperationID, "call GetUsersOnlineStatus rpc server is success", wsResult) - //Online data merge of each node - for _, v1 := range params.UserIDList { - flag = false - temp := new(pbRelay.GetUsersOnlineStatusResp_SuccessResult) - for _, v2 := range wsResult { - if v2.UserID == v1 { - flag = true - temp.UserID = v1 - temp.Status = constant.OnlineStatus - temp.DetailPlatformStatus = append(temp.DetailPlatformStatus, v2.DetailPlatformStatus...) - } - } - if !flag { - temp.UserID = v1 - temp.Status = constant.OfflineStatus - } - respResult = append(respResult, temp) - } - log.NewDebug(params.OperationID, "Finished merged data", respResult) - resp := gin.H{"errCode": 0, "errMsg": "", "successResult": respResult} - c.JSON(http.StatusOK, resp) -} - -func GetUserInfo(c *gin.Context) { - log.InfoByKv("api get userinfo init...", "") - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) - client := pbUser.NewUserClient(etcdConn) - //defer etcdConn.Close() - - params := paramsStruct{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &pbUser.GetUserInfoReq{ - UserIDList: params.UIDList, - OperationID: params.OperationID, - Token: c.Request.Header.Get("token"), - } - log.InfoByKv("api get user info is server", c.PostForm("OperationID"), c.Request.Header.Get("token")) - RpcResp, err := client.GetUserInfo(context.Background(), req) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,call get user info rpc server failed", err) - c.JSON(http.StatusInternalServerError, gin.H{ - "errorCode": 500, - "errorMsg": "call rpc server failed", - }) - return - } - log.InfoByKv("call get user info rpc server success", params.OperationID) - if RpcResp.ErrorCode == 0 { - userInfoList := make([]userInfo, 0) - for _, user := range RpcResp.Data { - var ui userInfo - ui.UID = user.Uid - ui.Name = user.Name - ui.Icon = user.Icon - ui.Gender = user.Gender - ui.Mobile = user.Mobile - ui.Birth = user.Birth - ui.Email = user.Email - ui.Ex = user.Ex - userInfoList = append(userInfoList, ui) - } - resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg, "data": userInfoList} - c.JSON(http.StatusOK, resp) - } else { - resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg} - c.JSON(http.StatusOK, resp) - } - log.InfoByKv("api get user info return success", params.OperationID, "args=%s", RpcResp.String()) -} diff --git a/internal/api/user/update_user_info.go b/internal/api/user/update_user_info.go index 89628ded4..a00006b65 100644 --- a/internal/api/user/update_user_info.go +++ b/internal/api/user/update_user_info.go @@ -1,62 +1 @@ package user - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pbUser "Open_IM/pkg/proto/user" - "context" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -type paramsStruct struct { - OperationID string `json:"operationID" binding:"required"` - UIDList []string `json:"uidList"` - Platform int32 `json:"platform"` - Name string `json:"name"` - Icon string `json:"icon"` - Gender int32 `json:"gender"` - Mobile string `json:"mobile"` - Birth string `json:"birth"` - Email string `json:"email"` - Ex string `json:"ex"` - Uid string `json:"uid"` -} - -func UpdateUserInfo(c *gin.Context) { - log.InfoByKv("api update userinfo init...", "") - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) - client := pbUser.NewUserClient(etcdConn) - //defer etcdConn.Close() - - params := paramsStruct{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &pbUser.UpdateUserInfoReq{ - OperationID: params.OperationID, - Token: c.Request.Header.Get("token"), - Name: params.Name, - Icon: params.Icon, - Gender: params.Gender, - Mobile: params.Mobile, - Birth: params.Birth, - Email: params.Email, - Ex: params.Ex, - Uid: params.Uid, - } - log.InfoByKv("api update user info is server", req.OperationID, req.Token) - RpcResp, err := client.UpdateUserInfo(context.Background(), req) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,call get user info rpc server failed", err) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"}) - return - } - log.InfoByKv("call update user info rpc server success", params.OperationID) - c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg}) - log.InfoByKv("api update user info return success", params.OperationID, "args=%s", RpcResp.String()) -} diff --git a/internal/api/user/user.go b/internal/api/user/user.go new file mode 100644 index 000000000..a3d311649 --- /dev/null +++ b/internal/api/user/user.go @@ -0,0 +1,164 @@ +package user + +import ( + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/common/token_verify" + "Open_IM/pkg/grpc-etcdv3/getcdv3" + "Open_IM/pkg/utils" + + // rpc "Open_IM/pkg/proto/relay" + api "Open_IM/pkg/base_info" + rpc "Open_IM/pkg/proto/user" + "context" + "github.com/gin-gonic/gin" + "net/http" + "strings" +) + +// +//func GetUsersOnlineStatus(c *gin.Context) { +// params := api.GetUsersOnlineStatusReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError(params.OperationID, "bind json failed ", err.Error(), c) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// +// if params.Secret != config.Config.Secret { +// log.NewError(params.OperationID, "parse token failed ", params.Secret, config.Config.Secret) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "secret failed"}) +// return +// } +// +// req := &pbRelay.GetUsersOnlineStatusReq{ +// OperationID: params.OperationID, +// UserIDList: params.UserIDList, +// } +// var wsResult []*rpc.GetUsersOnlineStatusResp_SuccessResult +// var respResult []*rpc.GetUsersOnlineStatusResp_SuccessResult +// flag := false +// log.NewDebug(params.OperationID, "GetUsersOnlineStatus req come here", params.UserIDList) +// +// grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName) +// for _, v := range grpcCons { +// client := rpc.NewOnlineMessageRelayServiceClient(v) +// reply, err := client.GetUsersOnlineStatus(context.Background(), req) +// if err != nil { +// log.NewError(params.OperationID, "GetUsersOnlineStatus rpc err", req.String(), err.Error()) +// continue +// } else { +// if reply.ErrCode == 0 { +// wsResult = append(wsResult, reply.SuccessResult...) +// } +// } +// } +// log.NewDebug(params.OperationID, "call GetUsersOnlineStatus rpc server is success", wsResult) +// //Online data merge of each node +// for _, v1 := range params.UserIDList { +// flag = false +// temp := new(pbRelay.GetUsersOnlineStatusResp_SuccessResult) +// for _, v2 := range wsResult { +// if v2.UserID == v1 { +// flag = true +// temp.UserID = v1 +// temp.Status = constant.OnlineStatus +// temp.DetailPlatformStatus = append(temp.DetailPlatformStatus, v2.DetailPlatformStatus...) +// } +// } +// if !flag { +// temp.UserID = v1 +// temp.Status = constant.OfflineStatus +// } +// respResult = append(respResult, temp) +// } +// log.NewDebug(params.OperationID, "Finished merged data", respResult) +// resp := gin.H{"errCode": 0, "errMsg": "", "data": respResult} +// +// c.JSON(http.StatusOK, resp) +//} +//params := api.AddBlacklistReq{} +// if err := c.BindJSON(¶ms); err != nil { +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// log.NewError("0", "BindJSON failed ", err.Error()) +// return +// } +// req := &rpc.AddBlacklistReq{} +// utils.CopyStructFields(req.CommID, params) +// var ok bool +// ok, req.CommID.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token")) +// if !ok { +// log.NewError(req.CommID.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token")) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"}) +// return +// } +// log.NewInfo(params.OperationID, "AddBlacklist args ", req.String()) + +func GetUserInfo(c *gin.Context) { + params := api.GetUserInfoReq{} + if err := c.BindJSON(¶ms); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"errCode": http.StatusBadRequest, "errMsg": err.Error()}) + return + } + req := &rpc.GetUserInfoReq{} + utils.CopyStructFields(&req, params) + var ok bool + ok, req.OpUserID = token_verify.GetUserIDFromToken(c.Request.Header.Get("token")) + if !ok { + log.NewError(req.OperationID, "GetUserIDFromToken false ", c.Request.Header.Get("token")) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "GetUserIDFromToken failed"}) + return + } + 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) + client := rpc.NewUserClient(etcdConn) + RpcResp, err := client.GetUserInfo(context.Background(), req) + if err != nil { + log.NewError(req.OperationID, "GetUserInfo failed ", err.Error(), req.String()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"}) + return + } + + resp := api.GetUserInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} + resp.UserInfoList = RpcResp.UserInfoList + c.JSON(http.StatusOK, resp) + + log.NewInfo(req.OperationID, "GetUserInfo api return ", resp) +} + +func UpdateUserInfo(c *gin.Context) { + log.InfoByKv("api update userinfo init...", "") + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) + client := pbUser.NewUserClient(etcdConn) + //defer etcdConn.Close() + + params := paramsStruct{} + if err := c.BindJSON(¶ms); err != nil { + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + req := &pbUser.UpdateUserInfoReq{ + OperationID: params.OperationID, + Token: c.Request.Header.Get("token"), + Name: params.Name, + Icon: params.Icon, + Gender: params.Gender, + Mobile: params.Mobile, + Birth: params.Birth, + Email: params.Email, + Ex: params.Ex, + Uid: params.Uid, + } + log.InfoByKv("api update user info is server", req.OperationID, req.Token) + RpcResp, err := client.UpdateUserInfo(context.Background(), req) + if err != nil { + log.Error(req.Token, req.OperationID, "err=%s,call get user info rpc server failed", err) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"}) + return + } + log.InfoByKv("call update user info rpc server success", params.OperationID) + c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg}) + log.InfoByKv("api update user info return success", params.OperationID, "args=%s", RpcResp.String()) +} diff --git a/internal/rpc/auth/auth.go b/internal/rpc/auth/auth.go new file mode 100644 index 000000000..166df967a --- /dev/null +++ b/internal/rpc/auth/auth.go @@ -0,0 +1,100 @@ +package auth + +import ( + "Open_IM/pkg/common/constant" + 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/grpc-etcdv3/getcdv3" + pbAuth "Open_IM/pkg/proto/auth" + "Open_IM/pkg/utils" + "context" + "net" + "strconv" + "strings" + + "Open_IM/pkg/common/config" + + "google.golang.org/grpc" +) + +func (rpc *rpcAuth) UserRegister(_ context.Context, req *pbAuth.UserRegisterReq) (*pbAuth.UserRegisterResp, error) { + log.NewInfo(req.OperationID, "UserRegister args ", req.String()) + var user imdb.User + utils.CopyStructFields(&user, req.UserInfo) + err := imdb.UserRegister(user) + if err != nil { + log.NewError(req.OperationID, "UserRegister failed ", err.Error(), user) + return &pbAuth.UserRegisterResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + + log.NewInfo(req.OperationID, "rpc UserRegister return") + return &pbAuth.UserRegisterResp{CommonResp: &pbAuth.CommonResp{}}, nil +} + +func (rpc *rpcAuth) UserToken(_ context.Context, req *pbAuth.UserTokenReq) (*pbAuth.UserTokenResp, error) { + log.NewInfo(req.OperationID, "UserToken args ", req.String()) + + _, err := imdb.GetUserByUserID(req.FromUserID) + if err != nil { + log.NewError(req.OperationID, "GetUserByUserID failed ", err.Error(), req.FromUserID) + return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + + tokens, expTime, err := token_verify.CreateToken(req.FromUserID, req.Platform) + if err != nil { + log.NewError(req.OperationID, "CreateToken failed ", err.Error(), req.FromUserID, req.Platform) + return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + + log.NewInfo(req.OperationID, "rpc UserToken return ") + return &pbAuth.UserTokenResp{Token: tokens, ExpiredTime: expTime}, nil +} + +type rpcAuth struct { + rpcPort int + rpcRegisterName string + etcdSchema string + etcdAddr []string +} + +func NewRpcAuthServer(port int) *rpcAuth { + log.NewPrivateLog("auth") + return &rpcAuth{ + rpcPort: port, + rpcRegisterName: config.Config.RpcRegisterName.OpenImAuthName, + etcdSchema: config.Config.Etcd.EtcdSchema, + etcdAddr: config.Config.Etcd.EtcdAddr, + } +} + +func (rpc *rpcAuth) Run() { + log.NewInfo("0", "rpc auth start...") + + address := utils.ServerIP + ":" + strconv.Itoa(rpc.rpcPort) + listener, err := net.Listen("tcp", address) + if err != nil { + log.NewError("0", "listen network failed ", err.Error(), address) + return + } + log.NewInfo("0", "listen network success, ", address, listener) + //grpc server + srv := grpc.NewServer() + defer srv.GracefulStop() + + //service registers with etcd + pbAuth.RegisterAuthServer(srv, rpc) + err = getcdv3.RegisterEtcd(rpc.etcdSchema, strings.Join(rpc.etcdAddr, ","), utils.ServerIP, rpc.rpcPort, rpc.rpcRegisterName, 10) + if err != nil { + log.NewError("0", "RegisterEtcd failed ", err.Error(), + rpc.etcdSchema, strings.Join(rpc.etcdAddr, ","), utils.ServerIP, rpc.rpcPort, rpc.rpcRegisterName) + return + } + log.NewInfo("0", "RegisterAuthServer ok ", rpc.etcdSchema, strings.Join(rpc.etcdAddr, ","), utils.ServerIP, rpc.rpcPort, rpc.rpcRegisterName) + err = srv.Serve(listener) + if err != nil { + log.NewError("0", "Serve failed ", err.Error()) + return + } + log.NewInfo("0", "rpc auth ok") +} diff --git a/internal/rpc/auth/rpcAuth.go b/internal/rpc/auth/rpcAuth.go deleted file mode 100644 index 162f04fd5..000000000 --- a/internal/rpc/auth/rpcAuth.go +++ /dev/null @@ -1,62 +0,0 @@ -package auth - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pbAuth "Open_IM/pkg/proto/auth" - "Open_IM/pkg/utils" - "google.golang.org/grpc" - "net" - "strconv" - "strings" -) - -type rpcAuth struct { - rpcPort int - rpcRegisterName string - etcdSchema string - etcdAddr []string -} - -func NewRpcAuthServer(port int) *rpcAuth { - log.NewPrivateLog("auth") - return &rpcAuth{ - rpcPort: port, - rpcRegisterName: config.Config.RpcRegisterName.OpenImAuthName, - etcdSchema: config.Config.Etcd.EtcdSchema, - etcdAddr: config.Config.Etcd.EtcdAddr, - } -} - -func (rpc *rpcAuth) Run() { - log.Info("", "", "rpc get_token init...") - - address := utils.ServerIP + ":" + strconv.Itoa(rpc.rpcPort) - listener, err := net.Listen("tcp", address) - if err != nil { - log.Error("", "", "listen network failed, err = %s, address = %s", err.Error(), address) - return - } - log.Info("", "", "listen network success, address = %s", address) - - //grpc server - srv := grpc.NewServer() - defer srv.GracefulStop() - - //service registers with etcd - - pbAuth.RegisterAuthServer(srv, rpc) - err = getcdv3.RegisterEtcd(rpc.etcdSchema, strings.Join(rpc.etcdAddr, ","), utils.ServerIP, rpc.rpcPort, rpc.rpcRegisterName, 10) - if err != nil { - log.Error("", "", "register rpc get_token to etcd failed, err = %s", err.Error()) - return - } - - err = srv.Serve(listener) - if err != nil { - log.Info("", "", "rpc get_token fail, err = %s", err.Error()) - return - } - log.Info("", "", "rpc get_token init success") -} diff --git a/internal/rpc/auth/user_register.go b/internal/rpc/auth/user_register.go deleted file mode 100644 index 3f5de7032..000000000 --- a/internal/rpc/auth/user_register.go +++ /dev/null @@ -1,20 +0,0 @@ -package auth - -import ( - "Open_IM/pkg/common/db/mysql_model/im_mysql_model" - "Open_IM/pkg/common/log" - pbAuth "Open_IM/pkg/proto/auth" - "context" -) - -func (rpc *rpcAuth) UserRegister(_ context.Context, pb *pbAuth.UserRegisterReq) (*pbAuth.UserRegisterResp, error) { - log.Info("", "", "rpc user_register start, [data: %s]", pb.String()) - - if err := im_mysql_model.UserRegister(pb); err != nil { - log.Error("", "", "rpc user_register error, [data: %s] [err: %s]", pb.String(), err.Error()) - return &pbAuth.UserRegisterResp{Success: false}, err - } - log.Info("", "", "rpc user_register success return") - - return &pbAuth.UserRegisterResp{Success: true}, nil -} diff --git a/internal/rpc/auth/user_token.go b/internal/rpc/auth/user_token.go deleted file mode 100644 index a1455b237..000000000 --- a/internal/rpc/auth/user_token.go +++ /dev/null @@ -1,29 +0,0 @@ -package auth - -import ( - "Open_IM/pkg/common/db/mysql_model/im_mysql_model" - "Open_IM/pkg/common/log" - "Open_IM/pkg/common/token_verify" - pbAuth "Open_IM/pkg/proto/auth" - "context" -) - -func (rpc *rpcAuth) UserToken(_ context.Context, pb *pbAuth.UserTokenReq) (*pbAuth.UserTokenResp, error) { - log.Info("", "", "rpc user_token call start..., [pbTokenReq: %s]", pb.String()) - - _, err := im_mysql_model.FindUserByUID(pb.UID) - if err != nil { - log.Error("", "", "rpc user_token call..., im_mysql_model.AppServerFindFromUserByUserID fail [uid: %s] [err: %s]", pb.UID, err.Error()) - return &pbAuth.UserTokenResp{ErrCode: 500, ErrMsg: err.Error()}, err - } - log.Info("", "", "rpc user_token call..., im_mysql_model.AppServerFindFromUserByUserID") - - tokens, expTime, err := token_verify.CreateToken(pb.UID, pb.Platform) - if err != nil { - log.Error("", "", "rpc user_token call..., utils.CreateToken fail [uid: %s] [err: %s]", pb.UID, err.Error()) - return &pbAuth.UserTokenResp{ErrCode: 500, ErrMsg: err.Error()}, err - } - log.Info("", "", "rpc user_token success return, [uid: %s] [tokens: %s]", pb.UID, tokens) - - return &pbAuth.UserTokenResp{Token: tokens, ExpiredTime: expTime}, nil -} diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index db04d91f7..da9f82709 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -423,51 +423,37 @@ func (s *groupServer) GetGroupsInfo(ctx context.Context, req *pbGroup.GetGroupsI func (s *groupServer) GroupApplicationResponse(_ context.Context, req *pbGroup.GroupApplicationResponseReq) (*pbGroup.GroupApplicationResponseResp, error) { log.NewInfo(req.OperationID, "GroupApplicationResponse args ", req.String()) - reply, err := imdb.GroupApplicationResponse(req) + + groupRequest := imdb.GroupRequest{} + groupRequest.UserID = req.FromUserID + groupRequest.GroupID = req.GroupID + groupRequest.HandledTime = time.Now() + groupRequest.HandleResult = req.HandleResult + groupRequest.HandleUserID = req.OpUserID + groupRequest.HandledMsg = req.HandledMsg + err := imdb.UpdateGroupRequest(groupRequest) if err != nil { log.NewError(req.OperationID, "GroupApplicationResponse failed ", err.Error(), req.String()) - return &pbGroup.GroupApplicationResponseResp{CommonResp: &pbGroup.CommonResp{ErrCode: 702, ErrMsg: err.Error()}}, nil + return &pbGroup.GroupApplicationResponseResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil } - + chat.ApplicationProcessedNotification(req) if req.HandleResult == 1 { - if req.ToUserID == "0" { - err = db.DB.AddGroupMember(req.GroupID, req.FromUserID) - if err != nil { - log.NewError(req.OperationID, "AddGroupMember failed ", err.Error(), req.GroupID, req.FromUserID) - } - } else { - err = db.DB.AddGroupMember(req.GroupID, req.ToUserID) - if err != nil { - log.NewError(req.OperationID, "AddGroupMember failed ", err.Error(), req.GroupID, req.ToUserID) - } - } - } - if req.ToUserID == "0" { - //group, err := imdb.FindGroupInfoByGroupId(req.GroupID) - //if err != nil { - // log.NewError(req.OperationID, "FindGroupInfoByGroupId failed ", req.GroupID) - // return reply, nil + chat.MemberEnterNotification(req) + //if req.ToUserID == "0" { + // err = db.DB.AddGroupMember(req.GroupID, req.FromUserID) + // if err != nil { + // log.NewError(req.OperationID, "AddGroupMember failed ", err.Error(), req.GroupID, req.FromUserID) + // } + //} else { + // err = db.DB.AddGroupMember(req.GroupID, req.ToUserID) + // if err != nil { + // log.NewError(req.OperationID, "AddGroupMember failed ", err.Error(), req.GroupID, req.ToUserID) + // } //} - //member, err := imdb.FindGroupMemberInfoByGroupIdAndUserId(req.GroupID, req.OpUserID) - //if err != nil { - // log.NewError(req.OperationID, "FindGroupMemberInfoByGroupIdAndUserId failed ", req.GroupID, req.OpUserID) - // return reply, nil - //} - chat.ApplicationProcessedNotification(req) - if req.HandleResult == 1 { - // entrantUser, err := imdb.FindGroupMemberInfoByGroupIdAndUserId(req.GroupID, req.FromUserID) - // if err != nil { - // log.NewError(req.OperationID, "FindGroupMemberInfoByGroupIdAndUserId failed ", err.Error(), req.GroupID, req.FromUserID) - // return reply, nil - // } - chat.MemberEnterNotification(req) - } - } else { - log.NewError(req.OperationID, "args failed ", req.String()) } - log.NewInfo(req.OperationID, "rpc GroupApplicationResponse return ", reply) - return reply, nil + log.NewInfo(req.OperationID, "rpc GroupApplicationResponse return ") + return &pbGroup.GroupApplicationResponseResp{CommonResp: &pbGroup.CommonResp{}}, nil } func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) (*pbGroup.JoinGroupResp, error) { @@ -584,13 +570,23 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf func (s *groupServer) TransferGroupOwner(_ context.Context, req *pbGroup.TransferGroupOwnerReq) (*pbGroup.TransferGroupOwnerResp, error) { log.NewInfo(req.OperationID, "TransferGroupOwner ", req.String()) - reply, err := im_mysql_model.TransferGroupOwner(req) + if req.OldOwnerUserID == req.NewOwnerUserID { + log.NewError(req.OperationID, "same owner ", req.String()) + return &pbGroup.TransferGroupOwnerResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrArgs.ErrCode, ErrMsg: constant.ErrArgs.ErrMsg}}, nil + } + groupMemberInfo := imdb.GroupMember{GroupID: req.GroupID, UserID: req.OldOwnerUserID, RoleLevel: 0} + err := imdb.UpdateGroupMemberInfo(groupMemberInfo) + if err != nil { + return &pbGroup.TransferGroupOwnerResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + groupMemberInfo = imdb.GroupMember{GroupID: req.GroupID, UserID: req.NewOwnerUserID, RoleLevel: 1} + err = imdb.UpdateGroupMemberInfo(groupMemberInfo) if err != nil { - log.NewError("TransferGroupOwner ", req.String()) return &pbGroup.TransferGroupOwnerResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil } changedType := int32(1) << 4 chat.GroupInfoChangedNotification(req.OperationID, req.OpUserID, req.GroupID, changedType) - log.NewInfo("TransferGroupOwner rpc return ", reply.String()) - return reply, nil + + return &pbGroup.TransferGroupOwnerResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}}, nil + } diff --git a/internal/rpc/msg/send_msg.go b/internal/rpc/msg/send_msg.go index 293abe06b..61fa147cf 100644 --- a/internal/rpc/msg/send_msg.go +++ b/internal/rpc/msg/send_msg.go @@ -792,19 +792,19 @@ func FriendDeletedNotification(req *pbFriend.DeleteFriendReq) { // PublicUserInfo OpUser = 2; // uint64 OperationTime = 3; //} -func FriendInfoChangedNotification(req *pbFriend.SetFriendCommentReq) { +func FriendInfoChangedNotification(operationID, opUserID, fromUserID, toUserID string) { var n NotificationMsg - n.SendID = req.CommID.FromUserID - n.RecvID = req.CommID.ToUserID + n.SendID = fromUserID + n.RecvID = toUserID n.ContentType = constant.FriendInfoChangedNotification n.SessionType = constant.SingleChatType n.MsgFrom = constant.SysMsgType - n.OperationID = req.CommID.OperationID + n.OperationID = operationID var FriendInfoChangedTips open_im_sdk.FriendInfoChangedTips - FriendInfoChangedTips.FromToUserID.FromUserID = req.CommID.FromUserID - FriendInfoChangedTips.FromToUserID.ToUserID = req.CommID.ToUserID - fromUserNickname, toUserNickname := getFromToUserNickname(req.CommID.OperationID, req.CommID.FromUserID, req.CommID.ToUserID) + FriendInfoChangedTips.FromToUserID.FromUserID = fromUserID + FriendInfoChangedTips.FromToUserID.ToUserID = toUserID + fromUserNickname, toUserNickname := getFromToUserNickname(operationID, fromUserID, toUserID) var tips open_im_sdk.TipsComm tips.Detail, _ = json.Marshal(FriendInfoChangedTips) tips.DefaultTips = fromUserNickname + " FriendDeletedNotification " + toUserNickname @@ -812,15 +812,6 @@ func FriendInfoChangedNotification(req *pbFriend.SetFriendCommentReq) { Notification(&n, true) } -//message BlackAddedTips{ -// BlackInfo Black = 1; -//} -//message BlackInfo{ -// PublicUserInfo OwnerUser = 1; -// string Remark = 2; -// uint64 CreateTime = 3; -// PublicUserInfo BlackUser = 4; -//} func BlackAddedNotification(req *pbFriend.AddBlacklistReq) { var n NotificationMsg n.SendID = req.CommID.FromUserID diff --git a/internal/rpc/user/conversation.go b/internal/rpc/user/conversation.go deleted file mode 100644 index 1f87c1cd4..000000000 --- a/internal/rpc/user/conversation.go +++ /dev/null @@ -1,59 +0,0 @@ -package user - -import ( - "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/db" - "Open_IM/pkg/common/log" - pbUser "Open_IM/pkg/proto/user" - "context" -) - -func (s *userServer) SetReceiveMessageOpt(ctx context.Context, req *pbUser.SetReceiveMessageOptReq) (*pbUser.SetReceiveMessageOptResp, error) { - m := make(map[string]int, len(req.ConversationId)) - for _, v := range req.ConversationId { - m[v] = int(req.Opt) - } - err := db.DB.SetMultiConversationMsgOpt(req.UId, m) - if err != nil { - log.NewError(req.OperationID, "SetMultiConversationMsgOpt failed ", err.Error(), req) - return &pbUser.SetReceiveMessageOptResp{ErrCode: constant.DatabaseError, ErrMsg: err.Error()}, nil - } - var resp pbUser.SetReceiveMessageOptResp - resp.ErrCode = 0 - - for _, v := range req.ConversationId { - resp.OptResult = append(resp.OptResult, &pbUser.OptResult{ConversationId: v, Result: 0}) - } - log.NewInfo(req.OperationID, "SetReceiveMessageOpt req, resp ", req, resp) - return &resp, nil -} - -func (s *userServer) GetReceiveMessageOpt(ctx context.Context, req *pbUser.GetReceiveMessageOptReq) (*pbUser.GetReceiveMessageOptResp, error) { - m, err := db.DB.GetMultiConversationMsgOpt(req.UId, req.ConversationId) - if err != nil { - log.NewError(req.OperationID, "GetMultiConversationMsgOpt failed ", err.Error(), req) - return &pbUser.GetReceiveMessageOptResp{ErrCode: constant.DatabaseError, ErrMsg: err.Error()}, nil - } - var resp pbUser.GetReceiveMessageOptResp - resp.ErrCode = 0 - for k, v := range m { - resp.ConversationOptResult = append(resp.ConversationOptResult, &pbUser.OptResult{ConversationId: k, Result: int32(v)}) - } - log.NewInfo(req.OperationID, "GetReceiveMessageOpt, req, resp", req, resp) - return &resp, nil -} - -func (s *userServer) GetAllConversationMsgOpt(ctx context.Context, req *pbUser.GetAllConversationMsgOptReq) (*pbUser.GetAllConversationMsgOptResp, error) { - m, err := db.DB.GetAllConversationMsgOpt(req.UId) - if err != nil { - log.NewError(req.OperationID, "GetAllConversationMsgOpt failed ", err.Error(), req) - return &pbUser.GetAllConversationMsgOptResp{ErrCode: constant.DatabaseError, ErrMsg: err.Error()}, nil - } - var resp pbUser.GetAllConversationMsgOptResp - resp.ErrCode = 0 - for k, v := range m { - resp.ConversationOptResult = append(resp.ConversationOptResult, &pbUser.OptResult{ConversationId: k, Result: int32(v)}) - } - log.NewInfo(req.OperationID, "GetAllConversationMsgOpt, req, resp", req, resp) - return &resp, nil -} diff --git a/internal/rpc/user/get_user_info.go b/internal/rpc/user/get_user_info.go deleted file mode 100644 index eca8afbd5..000000000 --- a/internal/rpc/user/get_user_info.go +++ /dev/null @@ -1,90 +0,0 @@ -package user - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/db/mysql_model/im_mysql_model" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pbUser "Open_IM/pkg/proto/user" - "Open_IM/pkg/utils" - "context" - "google.golang.org/grpc" - "net" - "strconv" - "strings" -) - -type userServer struct { - rpcPort int - rpcRegisterName string - etcdSchema string - etcdAddr []string -} - -func NewUserServer(port int) *userServer { - log.NewPrivateLog("user") - return &userServer{ - rpcPort: port, - rpcRegisterName: config.Config.RpcRegisterName.OpenImUserName, - etcdSchema: config.Config.Etcd.EtcdSchema, - etcdAddr: config.Config.Etcd.EtcdAddr, - } -} - -func (s *userServer) Run() { - log.Info("", "", "rpc user init....") - - ip := utils.ServerIP - registerAddress := ip + ":" + strconv.Itoa(s.rpcPort) - //listener network - listener, err := net.Listen("tcp", registerAddress) - if err != nil { - log.InfoByArgs("listen network failed,err=%s", err.Error()) - return - } - log.Info("", "", "listen network success, address = %s", registerAddress) - defer listener.Close() - //grpc server - srv := grpc.NewServer() - defer srv.GracefulStop() - //Service registers with etcd - pbUser.RegisterUserServer(srv, s) - err = getcdv3.RegisterEtcd(s.etcdSchema, strings.Join(s.etcdAddr, ","), ip, s.rpcPort, s.rpcRegisterName, 10) - if err != nil { - log.ErrorByArgs("register rpc token to etcd failed,err=%s", err.Error()) - return - } - err = srv.Serve(listener) - if err != nil { - log.ErrorByArgs("listen token failed,err=%s", err.Error()) - return - } - log.Info("", "", "rpc token init success") -} - -func (s *userServer) GetUserInfo(ctx context.Context, req *pbUser.GetUserInfoReq) (*pbUser.GetUserInfoResp, error) { - log.InfoByKv("rpc get_user_info is server", req.OperationID) - - var userInfoList []*pbUser.UserInfo - //Obtain user information according to userID - if len(req.UserIDList) > 0 { - for _, userID := range req.UserIDList { - var userInfo pbUser.UserInfo - user, err := im_mysql_model.FindUserByUID(userID) - if err != nil { - log.ErrorByKv("search userinfo failed", req.OperationID, "userID", userID, "err=%s", err.Error()) - continue - } - utils.CopyStructFields(&userInfo, user) - userInfoList = append(userInfoList, &userInfo) - } - } else { - return &pbUser.GetUserInfoResp{ErrorCode: 999, ErrorMsg: "uidList is nil"}, nil - } - log.InfoByKv("rpc get userInfo return success", req.OperationID, "token", req.Token) - return &pbUser.GetUserInfoResp{ - ErrorCode: 0, - ErrorMsg: "", - Data: userInfoList, - }, nil -} diff --git a/internal/rpc/user/internal_service/get_user_info_to_client.go b/internal/rpc/user/internal_service/get_user_info_to_client.go deleted file mode 100644 index e7281419f..000000000 --- a/internal/rpc/user/internal_service/get_user_info_to_client.go +++ /dev/null @@ -1,16 +0,0 @@ -package internal_service - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pbUser "Open_IM/pkg/proto/user" - "context" - "strings" -) - -func GetUserInfoClient(req *pbUser.GetUserInfoReq) (*pbUser.GetUserInfoResp, error) { - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) - client := pbUser.NewUserClient(etcdConn) - RpcResp, err := client.GetUserInfo(context.Background(), req) - return RpcResp, err -} diff --git a/internal/rpc/user/management_user.go b/internal/rpc/user/management_user.go deleted file mode 100644 index 4c797d9b4..000000000 --- a/internal/rpc/user/management_user.go +++ /dev/null @@ -1,96 +0,0 @@ -/* -** description(""). -** copyright('open-im,www.open-im.io'). -** author("fg,Gordon@tuoyun.net"). -** time(2021/9/15 10:28). - */ -package user - -import ( - "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" - pbUser "Open_IM/pkg/proto/user" - "Open_IM/pkg/utils" - "context" -) - -func (s *userServer) DeleteUsers(_ context.Context, req *pbUser.DeleteUsersReq) (*pbUser.DeleteUsersResp, error) { - log.InfoByKv("rpc DeleteUsers arrived server", req.OperationID, "args", req.String()) - var resp pbUser.DeleteUsersResp - var common pbUser.CommonResp - c, err := token_verify.ParseToken(req.Token) - if err != nil { - log.ErrorByKv("parse token failed", req.OperationID, "err", err.Error()) - return &pbUser.DeleteUsersResp{CommonResp: &pbUser.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: err.Error()}, FailedUidList: req.DeleteUidList}, nil - } - if !utils.IsContain(c.UID, config.Config.Manager.AppManagerUid) { - log.ErrorByKv(" Authentication failed", req.OperationID, "args", c) - return &pbUser.DeleteUsersResp{CommonResp: &pbUser.CommonResp{ErrorCode: 401, ErrorMsg: "not authorized"}, FailedUidList: req.DeleteUidList}, nil - } - for _, uid := range req.DeleteUidList { - err = im_mysql_model.UserDelete(uid) - if err != nil { - common.ErrorCode = 201 - common.ErrorMsg = "some uid deleted failed" - resp.FailedUidList = append(resp.FailedUidList, uid) - } - } - resp.CommonResp = &common - return &resp, nil - -} - -func (s *userServer) GetAllUsersUid(_ context.Context, req *pbUser.GetAllUsersUidReq) (*pbUser.GetAllUsersUidResp, error) { - log.InfoByKv("rpc GetAllUsersUid arrived server", req.OperationID, "args", req.String()) - c, err := token_verify.ParseToken(req.Token) - if err != nil { - log.InfoByKv("parse token failed", req.OperationID, "err", err.Error()) - return &pbUser.GetAllUsersUidResp{CommonResp: &pbUser.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: err.Error()}}, nil - } - if !utils.IsContain(c.UID, config.Config.Manager.AppManagerUid) { - log.ErrorByKv(" Authentication failed", req.OperationID, "args", c) - return &pbUser.GetAllUsersUidResp{CommonResp: &pbUser.CommonResp{ErrorCode: 401, ErrorMsg: "not authorized"}}, nil - } - uidList, err := im_mysql_model.SelectAllUID() - if err != nil { - log.ErrorByKv("db get failed", req.OperationID, "err", err.Error()) - return &pbUser.GetAllUsersUidResp{CommonResp: &pbUser.CommonResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: err.Error()}}, nil - } else { - return &pbUser.GetAllUsersUidResp{CommonResp: &pbUser.CommonResp{ErrorCode: 0, ErrorMsg: ""}, UidList: uidList}, nil - } - -} -func (s *userServer) AccountCheck(_ context.Context, req *pbUser.AccountCheckReq) (*pbUser.AccountCheckResp, error) { - log.InfoByKv("rpc AccountCheck arrived server", req.OperationID, "args", req.String()) - c, err := token_verify.ParseToken(req.Token) - if err != nil { - log.InfoByKv("parse token failed", req.OperationID, "err", err.Error()) - return &pbUser.AccountCheckResp{CommonResp: &pbUser.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: err.Error()}}, nil - } - if !utils.IsContain(c.UID, config.Config.Manager.AppManagerUid) { - log.ErrorByKv(" Authentication failed", req.OperationID, "args", c) - return &pbUser.AccountCheckResp{CommonResp: &pbUser.CommonResp{ErrorCode: 401, ErrorMsg: "not authorized"}}, nil - } - uidList, err := im_mysql_model.SelectSomeUID(req.UidList) - if err != nil { - log.ErrorByKv("db get SelectSomeUID failed", req.OperationID, "err", err.Error()) - return &pbUser.AccountCheckResp{CommonResp: &pbUser.CommonResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: err.Error()}}, nil - } else { - var r []*pbUser.AccountCheckResp_SingleUserStatus - for _, v := range req.UidList { - temp := new(pbUser.AccountCheckResp_SingleUserStatus) - temp.UserID = v - if utils.IsContain(v, uidList) { - temp.AccountStatus = constant.Registered - } else { - temp.AccountStatus = constant.UnRegistered - } - r = append(r, temp) - } - return &pbUser.AccountCheckResp{CommonResp: &pbUser.CommonResp{ErrorCode: 0, ErrorMsg: ""}, Result: r}, nil - } - -} diff --git a/internal/rpc/user/update_user_info.go b/internal/rpc/user/update_user_info.go deleted file mode 100644 index f022542e4..000000000 --- a/internal/rpc/user/update_user_info.go +++ /dev/null @@ -1,85 +0,0 @@ -package user - -import ( - "Open_IM/internal/push/logic" - chat "Open_IM/internal/rpc/msg" - "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/chat" - pbFriend "Open_IM/pkg/proto/friend" - pbUser "Open_IM/pkg/proto/user" - "Open_IM/pkg/utils" - "context" - "strings" -) - -func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserInfoReq) (*pbUser.CommonResp, error) { - log.Info(req.Token, req.OperationID, "rpc modify user is server,args=%s", req.String()) - claims, err := token_verify.ParseToken(req.Token) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbUser.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: err.Error()}, nil - } - - ownerUid := "" - //if claims.UID == config.Config.AppManagerUid { - if utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) { - ownerUid = req.Uid - } else { - ownerUid = claims.UID - } - - err = im_mysql_model.UpDateUserInfo(ownerUid, req.Name, req.Icon, req.Mobile, req.Birth, req.Email, req.Ex, req.Gender) - if err != nil { - log.Error(req.Token, req.OperationID, "update user some attribute failed,err=%s", err.Error()) - return &pbUser.CommonResp{ErrorCode: constant.ErrModifyUserInfo.ErrCode, ErrorMsg: constant.ErrModifyUserInfo.ErrMsg}, nil - } - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) - client := pbFriend.NewFriendClient(etcdConn) - newReq := &pbFriend.GetFriendListReq{ - OperationID: req.OperationID, - Token: req.Token, - } - - RpcResp, err := client.GetFriendList(context.Background(), newReq) - if err != nil { - log.ErrorByKv("get friend list rpc server failed", req.OperationID, "err", err.Error(), "req", req.String()) - return &pbUser.CommonResp{}, nil - } - if RpcResp.ErrCode != 0 { - log.ErrorByKv("get friend list rpc server failed", req.OperationID, "err", err.Error(), "req", req.String()) - return &pbUser.CommonResp{}, nil - } - self, err := im_mysql_model.FindUserByUID(ownerUid) - if err != nil { - log.ErrorByKv("get self info failed", req.OperationID, "err", err.Error(), "req", req.String()) - return &pbUser.CommonResp{}, nil - } - var name, faceUrl string - if self != nil { - name, faceUrl = self.Name, self.Icon - } - - chat.SelfInfoUpdatedNotification(req.OperationID, req.Uid) - for _, v := range RpcResp.Data { - logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{ - SendID: ownerUid, - RecvID: v.Uid, - SenderNickName: name, - SenderFaceURL: faceUrl, - Content: ownerUid + "'s info has changed", - SendTime: utils.GetCurrentTimestampByNano(), - MsgFrom: constant.SysMsgType, - ContentType: constant.SetSelfInfoTip, - SessionType: constant.SingleChatType, - OperationID: req.OperationID, - Token: req.Token, - }) - - } - return &pbUser.CommonResp{}, nil -} diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go new file mode 100644 index 000000000..e9407d8bf --- /dev/null +++ b/internal/rpc/user/user.go @@ -0,0 +1,238 @@ +package user + +import ( + chat "Open_IM/internal/rpc/msg" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/db" + 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/grpc-etcdv3/getcdv3" + pbFriend "Open_IM/pkg/proto/friend" + pbUser "Open_IM/pkg/proto/user" + "Open_IM/pkg/utils" + "context" + "google.golang.org/grpc" + "net" + "strconv" + "strings" + sdkws "Open_IM/pkg/proto/sdk_ws" +) + +type userServer struct { + rpcPort int + rpcRegisterName string + etcdSchema string + etcdAddr []string +} + +func (s *userServer) Run() { + log.NewInfo("0", "", "rpc user start...") + + ip := utils.ServerIP + registerAddress := ip + ":" + strconv.Itoa(s.rpcPort) + //listener network + listener, err := net.Listen("tcp", registerAddress) + if err != nil { + log.NewError("0", "listen network failed ", err.Error(), registerAddress) + return + } + log.NewInfo("0", "listen network success, address ", registerAddress, listener) + defer listener.Close() + //grpc server + srv := grpc.NewServer() + defer srv.GracefulStop() + //Service registers with etcd + pbUser.RegisterUserServer(srv, s) + err = getcdv3.RegisterEtcd(s.etcdSchema, strings.Join(s.etcdAddr, ","), ip, s.rpcPort, s.rpcRegisterName, 10) + if err != nil { + log.NewError("0", "RegisterEtcd failed ", err.Error(), s.etcdSchema, strings.Join(s.etcdAddr, ","), ip, s.rpcPort, s.rpcRegisterName) + return + } + err = srv.Serve(listener) + if err != nil { + log.NewError("0", "Serve failed ", err.Error()) + return + } + log.NewInfo("0", "rpc user success") +} + +func (s *userServer) GetUserInfo(ctx context.Context, req *pbUser.GetUserInfoReq) (*pbUser.GetUserInfoResp, error) { + log.NewInfo(req.OperationID, "GetUserInfo args ", req.String()) + var userInfoList []*sdkws.UserInfo + if len(req.UserIDList) > 0 { + for _, userID := range req.UserIDList { + var userInfo sdkws.UserInfo + user, err := imdb.GetUserByUserID(userID) + if err != nil { + log.NewError(req.OperationID, "GetUserByUserID failed ", err.Error(), userID) + continue + } + utils.CopyStructFields(&userInfo, user) + userInfoList = append(userInfoList, &userInfo) + } + } else { + + return &pbUser.GetUserInfoResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrArgs.ErrCode, ErrMsg: constant.ErrArgs.ErrMsg}}, nil + } + log.NewInfo(req.OperationID, "GetUserInfo rpc return ", pbUser.GetUserInfoResp{CommonResp: &pbUser.CommonResp{}, UserInfoList:userInfoList}) + return &pbUser.GetUserInfoResp{CommonResp: &pbUser.CommonResp{}, UserInfoList:userInfoList}, nil +} + + + +func (s *userServer) SetReceiveMessageOpt(ctx context.Context, req *pbUser.SetReceiveMessageOptReq) (*pbUser.SetReceiveMessageOptResp, error) { + log.NewInfo(req.OperationID, "SetReceiveMessageOpt args ", req.String()) + m := make(map[string]int, len(req.ConversationIDList)) + for _, v := range req.ConversationIDList { + m[v] = int(req.Opt) + } + err := db.DB.SetMultiConversationMsgOpt(req.FromUserID, m) + if err != nil { + log.NewError(req.OperationID, "SetMultiConversationMsgOpt failed ", err.Error(), req) + return &pbUser.SetReceiveMessageOptResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + resp := pbUser.SetReceiveMessageOptResp{CommonResp: &pbUser.CommonResp{}} + + for _, v := range req.ConversationIDList { + resp.OptResultList = append(resp.OptResultList, &pbUser.OptResult{ConversationId: v, Result: 0}) + } + log.NewInfo(req.OperationID, "SetReceiveMessageOpt rpc return ", resp.String()) + return &resp, nil +} + +func (s *userServer) GetReceiveMessageOpt(ctx context.Context, req *pbUser.GetReceiveMessageOptReq) (*pbUser.GetReceiveMessageOptResp, error) { + log.NewInfo(req.OperationID, "GetReceiveMessageOpt args ", req.String()) + m, err := db.DB.GetMultiConversationMsgOpt(req.FromUserID, req.ConversationId) + if err != nil { + log.NewError(req.OperationID, "GetMultiConversationMsgOpt failed ", err.Error(), req.FromUserID, req.ConversationId) + return &pbUser.GetReceiveMessageOptResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + resp := pbUser.GetReceiveMessageOptResp{CommonResp: &pbUser.CommonResp{}} + for k, v := range m { + resp.ConversationOptResultList = append(resp.ConversationOptResultList, &pbUser.OptResult{ConversationId: k, Result: int32(v)}) + } + log.NewInfo(req.OperationID, "GetReceiveMessageOpt rpc return ", resp.String()) + return &resp, nil +} + +func (s *userServer) GetAllConversationMsgOpt(ctx context.Context, req *pbUser.GetAllConversationMsgOptReq) (*pbUser.GetAllConversationMsgOptResp, error) { + log.NewInfo(req.OperationID, "GetAllConversationMsgOpt args ", req.String()) + m, err := db.DB.GetAllConversationMsgOpt(req.FromUserId) + if err != nil { + log.NewError(req.OperationID, "GetAllConversationMsgOpt failed ", err.Error(), req.FromUserId) + return &pbUser.GetAllConversationMsgOptResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + resp := pbUser.GetAllConversationMsgOptResp{CommonResp: &pbUser.CommonResp{}} + for k, v := range m { + resp.ConversationOptResultList = append(resp.ConversationOptResultList, &pbUser.OptResult{ConversationId: k, Result: int32(v)}) + } + log.NewInfo(req.OperationID, "GetAllConversationMsgOpt rpc return ", resp.String()) + return &resp, nil +} + + +func (s *userServer) DeleteUsers(_ context.Context, req *pbUser.DeleteUsersReq) (*pbUser.DeleteUsersResp, error) { + log.NewInfo(req.OperationID, "DeleteUsers args ", req.String()) + if token_verify.IsMangerUserID(req.OpUserID){ + log.NewError(req.OperationID, "IsMangerUserID false ", req.OpUserID) + return &pbUser.DeleteUsersResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, FailedUserIDList: req.DeleteUserIDList}, nil + } + var common pbUser.CommonResp + resp := pbUser.DeleteUsersResp{CommonResp: &common} + for _, userID := range req.DeleteUserIDList { + err := imdb.DeleteUser(userID) + if err != nil { + common.ErrCode = 201 + common.ErrMsg = "some uid deleted failed" + resp.FailedUserIDList = append(resp.FailedUserIDList, userID) + } + } + log.NewInfo(req.OperationID, "DeleteUsers rpc return ", resp.String()) + return &resp, nil +} + +func (s *userServer) GetAllUserID(_ context.Context, req *pbUser.GetAllUserIDReq) (*pbUser.GetAllUserIDResp, error) { + log.NewInfo(req.OperationID,"GetAllUserID args ", req.String()) + if token_verify.IsMangerUserID(req.OpUserID){ + log.NewError(req.OperationID, "IsMangerUserID false ", req.OpUserID) + return &pbUser.GetAllUserIDResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil + } + uidList, err := imdb.SelectAllUserID() + if err != nil { + log.NewError(req.OperationID, "SelectAllUserID false ", err.Error()) + return &pbUser.GetAllUserIDResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } else { + log.NewInfo(req.OperationID, "GetAllUserID rpc return ", pbUser.GetAllUserIDResp{CommonResp: &pbUser.CommonResp{}, UserIDList: uidList}) + return &pbUser.GetAllUserIDResp{CommonResp: &pbUser.CommonResp{}, UserIDList: uidList}, nil + } +} + + +func (s *userServer) AccountCheck(_ context.Context, req *pbUser.AccountCheckReq) (*pbUser.AccountCheckResp, error) { + log.NewInfo(req.OperationID,"AccountCheck args ", req.String()) + if token_verify.IsMangerUserID(req.OpUserID){ + log.NewError(req.OperationID, "IsMangerUserID false ", req.OpUserID) + return &pbUser.AccountCheckResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil + } + uidList, err := imdb.SelectSomeUserID(req.CheckUserIDList) + if err != nil { + log.NewError(req.OperationID, "SelectSomeUserID failed ", err.Error(), req.CheckUserIDList) + return &pbUser.AccountCheckResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } else { + var r []*pbUser.AccountCheckResp_SingleUserStatus + for _, v := range req.CheckUserIDList { + temp := new(pbUser.AccountCheckResp_SingleUserStatus) + temp.UserID = v + if utils.IsContain(v, uidList) { + temp.AccountStatus = constant.Registered + } else { + temp.AccountStatus = constant.UnRegistered + } + r = append(r, temp) + } + resp := pbUser.AccountCheckResp{CommonResp: &pbUser.CommonResp{ErrCode: 0, ErrMsg: ""}, ResultList: r} + log.NewInfo(req.OperationID, "AccountCheck rpc return ", resp.String()) + return &resp, nil + } + +} + + + + +func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserInfoReq) (*pbUser.UpdateUserInfoResp, error) { + log.NewInfo(req.OperationID,"UpdateUserInfo args ", req.String()) + if !token_verify.CheckAccess(req.OpUserID, req.UserInfo.UserID){ + log.NewError(req.OperationID, "CheckAccess false ", req.OpUserID, req.UserInfo.UserID) + return &pbUser.UpdateUserInfoResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil + } + + var user imdb.User + utils.CopyStructFields(&user, req.UserInfo) + err := imdb.UpdateUserInfo(user) + if err != nil { + 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) + client := pbFriend.NewFriendClient(etcdConn) + newReq := &pbFriend.GetFriendListReq{ + CommID: &pbFriend.CommID{OperationID: req.OperationID, FromUserID: req.UserInfo.UserID, OpUserID: req.OpUserID} + } + + RpcResp, err := client.GetFriendList(context.Background(), newReq) + if err != nil { + log.NewError(req.OperationID, "GetFriendList failed ", err.Error(), newReq) + return &pbUser.UpdateUserInfoResp{CommonResp: &pbUser.CommonResp{}}, nil + } + for _, v := range RpcResp.FriendInfoList{ + chat.FriendInfoChangedNotification(req.OperationID, req.OpUserID, req.UserInfo.UserID, v.FriendUser.UserID) + } + chat.SelfInfoUpdatedNotification(req.OperationID, req.UserInfo.UserID) + return &pbUser.UpdateUserInfoResp{CommonResp: &pbUser.CommonResp{}}, nil +} + + + diff --git a/pkg/base_info/friend_api_struct.go b/pkg/base_info/friend_api_struct.go index 3b20185d8..94a48662b 100644 --- a/pkg/base_info/friend_api_struct.go +++ b/pkg/base_info/friend_api_struct.go @@ -2,16 +2,12 @@ package base_info import open_im_sdk "Open_IM/pkg/proto/sdk_ws" -open_im_sdk "Open_IM/pkg/proto/sdk_ws" - type paramsCommFriend struct { OperationID string `json:"operationID" binding:"required"` ToUserID string `json:"toUserID" binding:"required"` FromUserID string `json:"fromUserID" binding:"required"` } - - type AddBlacklistReq struct { paramsCommFriend } @@ -19,8 +15,6 @@ type AddBlacklistResp struct { CommResp } - - type ImportFriendReq struct { FriendUserIDList []string `json:"friendUserIDList" binding:"required"` OperationID string `json:"operationID" binding:"required"` @@ -28,10 +22,9 @@ type ImportFriendReq struct { } type ImportFriendResp struct { CommResp - Data []string `json:"data"` + Data []string `json:"data"` } - type AddFriendReq struct { paramsCommFriend ReqMsg string `json:"reqMsg"` @@ -40,18 +33,15 @@ type AddFriendResp struct { CommResp } - type AddFriendResponseReq struct { paramsCommFriend - Flag int32 `json:"flag" binding:"required"` + Flag int32 `json:"flag" binding:"required"` HandleMsg string `json:"handleMsg"` } type AddFriendResponseResp struct { CommResp } - - type DeleteFriendReq struct { paramsCommFriend } @@ -59,8 +49,6 @@ type DeleteFriendResp struct { CommResp } - - type GetBlackListReq struct { paramsCommFriend } @@ -69,7 +57,6 @@ type GetBlackListResp struct { BlackUserInfoList []*blackUserInfo `json:"data"` } - //type PublicUserInfo struct { // UserID string `json:"userID"` // Nickname string `json:"nickname"` @@ -81,7 +68,6 @@ type blackUserInfo struct { open_im_sdk.PublicUserInfo } - type SetFriendCommentReq struct { paramsCommFriend Remark string `json:"remark" binding:"required"` @@ -90,7 +76,6 @@ type SetFriendCommentResp struct { CommResp } - type RemoveBlackListReq struct { paramsCommFriend } @@ -106,7 +91,6 @@ type IsFriendResp struct { Response bool `json:"response"` } - type GetFriendsInfoReq struct { paramsCommFriend } @@ -123,10 +107,6 @@ type GetFriendListResp struct { FriendInfoList []*open_im_sdk.FriendInfo `json:"data"` } - - - - type GetFriendApplyListReq struct { paramsCommFriend } @@ -142,14 +122,3 @@ type GetSelfApplyListResp struct { CommResp FriendRequestList open_im_sdk.FriendRequest `json:"data"` } - - - - - - - - - - - diff --git a/pkg/base_info/user_api_struct.go b/pkg/base_info/user_api_struct.go new file mode 100644 index 000000000..c129e8c76 --- /dev/null +++ b/pkg/base_info/user_api_struct.go @@ -0,0 +1,29 @@ +package base_info + +import ( + open_im_sdk "Open_IM/pkg/proto/sdk_ws" +) + +type GetUsersOnlineStatusReq struct { + OperationID string `json:"operationID" binding:"required"` + UserIDList []string `json:"userIDList" binding:"required,lte=200"` + Secret string `json:"secret" binding:"required,max=32"` +} +type OnlineStatus struct { + UserID string `json:"userID"` + Status string `json:"status"` +} +type GetUsersOnlineStatusResp struct { + CommResp + OnlineStatusList []*OnlineStatus `json:"data"` +} + +type GetUserInfoReq struct { + OperationID string `json:"operationID" binding:"required"` + UserIDList []string `json:"userIDList" binding:"required"` +} + +type GetUserInfoResp struct { + CommResp + UserInfoList []*open_im_sdk.UserInfo `json:"data"` +} diff --git a/pkg/common/db/mysql_model/im_mysql_model/group_model.go b/pkg/common/db/mysql_model/im_mysql_model/group_model.go index 5fc580c8a..120815a61 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/group_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/group_model.go @@ -8,6 +8,19 @@ import ( "time" ) +//type Group struct { +// GroupID string `gorm:"column:group_id;primaryKey;"` +// GroupName string `gorm:"column:name"` +// Introduction string `gorm:"column:introduction"` +// Notification string `gorm:"column:notification"` +// FaceUrl string `gorm:"column:face_url"` +// CreateTime time.Time `gorm:"column:create_time"` +// Status int32 `gorm:"column:status"` +// CreatorUserID string `gorm:"column:creator_user_id"` +// GroupType int32 `gorm:"column:group_type"` +// Ex string `gorm:"column:ex"` +//} + func InsertIntoGroup(groupInfo Group) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { @@ -24,228 +37,24 @@ func InsertIntoGroup(groupInfo Group) error { return nil } -func FindGroupInfoByGroupId(groupId string) (*Group, error) { +func GetGroupInfoByGroupID(groupId string) (*Group, error) { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return nil, err } var groupInfo Group - err = dbConn.Raw("select * from `group` where group_id=?", groupId).Scan(&groupInfo).Error + err = dbConn.Table("group").Where("group_id=?", groupId).Find(&groupInfo).Error if err != nil { return nil, err } return &groupInfo, nil } -func SetGroupInfo(groupId, groupName, introduction, notification, groupFaceUrl, ex string) error { +func SetGroupInfo(groupInfo Group) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() - dbConn.LogMode(true) if err != nil { return err } - if groupName != "" { - if err = dbConn.Exec("update `group` set name=? where group_id=?", groupName, groupId).Error; err != nil { - return err - } - } - if introduction != "" { - if err = dbConn.Exec("update `group` set introduction=? where group_id=?", introduction, groupId).Error; err != nil { - return err - } - } - if notification != "" { - if err = dbConn.Exec("update `group` set notification=? where group_id=?", notification, groupId).Error; err != nil { - return err - } - } - if groupFaceUrl != "" { - if err = dbConn.Exec("update `group` set face_url=? where group_id=?", groupFaceUrl, groupId).Error; err != nil { - return err - } - } - if ex != "" { - if err = dbConn.Exec("update `group` set ex=? where group_id=?", ex, groupId).Error; err != nil { - return err - } - } - return nil -} - -func GetGroupApplicationList(uid string) (*group.GetGroupApplicationListResp, error) { - dbConn, err := db.DB.MysqlDB.DefaultGormDB() - if err != nil { - return nil, err - } - - var gID string - var gIDs []string - rows, err := dbConn.Raw("select group_id from `group_member` where uid = ? and administrator_level > 0", uid).Rows() - defer rows.Close() - if err != nil { - return nil, err - } - - for rows.Next() { - rows.Scan(&gID) - gIDs = append(gIDs, gID) - } - - if len(gIDs) == 0 { - return &group.GetGroupApplicationListResp{}, nil - } - - sql := "select id, group_id, from_user_id, to_user_id, flag, req_msg, handled_msg, create_time, " + - "from_user_nickname, to_user_nickname, from_user_face_url, to_user_face_url, handled_user from `group_request` where group_id in ( " - for i := 0; i < len(gIDs); i++ { - if i == len(gIDs)-1 { - sql = sql + "\"" + gIDs[i] + "\"" + " )" - } else { - sql = sql + "\"" + gIDs[i] + "\"" + ", " - } - } - - var groupRequest GroupRequest - var groupRequests []GroupRequest - log.Info("", "", sql) - rows, err = dbConn.Raw(sql).Rows() - defer rows.Close() - if err != nil { - return nil, err - } - for rows.Next() { - rows.Scan(&groupRequest.ID, &groupRequest.GroupID, &groupRequest.FromUserID, &groupRequest.ToUserID, &groupRequest.Flag, &groupRequest.ReqMsg, - &groupRequest.HandledMsg, &groupRequest.CreateTime, &groupRequest.FromUserNickname, &groupRequest.ToUserNickname, - &groupRequest.FromUserFaceUrl, &groupRequest.ToUserFaceUrl, &groupRequest.HandledUser) - groupRequests = append(groupRequests, groupRequest) - } - - reply := &group.GetGroupApplicationListResp{} - reply.Data = &group.GetGroupApplicationListData{} - reply.Data.Count = int32(len(groupRequests)) - for i := 0; i < int(reply.Data.Count); i++ { - addUser := group.GetGroupApplicationList_Data_User{ - ID: groupRequests[i].ID, - GroupID: groupRequests[i].GroupID, - FromUserID: groupRequests[i].FromUserID, - FromUserNickname: groupRequests[i].FromUserNickname, - FromUserFaceUrl: groupRequests[i].FromUserFaceUrl, - ToUserID: groupRequests[i].ToUserID, - AddTime: groupRequests[i].CreateTime.Unix(), - RequestMsg: groupRequests[i].ReqMsg, - HandledMsg: groupRequests[i].HandledMsg, - Flag: groupRequests[i].Flag, - ToUserNickname: groupRequests[i].ToUserNickname, - ToUserFaceUrl: groupRequests[i].ToUserFaceUrl, - HandledUser: groupRequests[i].HandledUser, - Type: 0, - HandleStatus: 0, - HandleResult: 0, - } - - if addUser.ToUserID != "0" { - addUser.Type = 1 - } - - if len(groupRequests[i].HandledUser) > 0 { - if groupRequests[i].HandledUser == uid { - addUser.HandleStatus = 2 - } else { - addUser.HandleStatus = 1 - } - } - - if groupRequests[i].Flag == 1 { - addUser.HandleResult = 1 - } - - reply.Data.User = append(reply.Data.User, &addUser) - } - return reply, nil -} - -func TransferGroupOwner(pb *group.TransferGroupOwnerReq) (*group.TransferGroupOwnerResp, error) { - oldOwner, err := FindGroupMemberInfoByGroupIdAndUserId(pb.GroupID, pb.OldOwnerUserID) - if err != nil { - return nil, err - } - newOwner, err := FindGroupMemberInfoByGroupIdAndUserId(pb.GroupID, pb.NewOwnerUserID) - if err != nil { - return nil, err - } - - if oldOwner.UserID == newOwner.UserID { - return nil, errors.New("the self") - } - - if err = UpdateTheUserAdministratorLevel(pb.GroupID, pb.OldOwnerUserID, 0); err != nil { - return nil, err - } - - if err = UpdateTheUserAdministratorLevel(pb.GroupID, pb.NewOwnerUserID, 1); err != nil { - UpdateTheUserAdministratorLevel(pb.GroupID, pb.OldOwnerUserID, 1) - return nil, err - } - - return &group.TransferGroupOwnerResp{CommonResp: &group.CommonResp{ErrCode: 0}}, nil -} - -func GroupApplicationResponse(pb *group.GroupApplicationResponseReq) (*group.CommonResp, error) { - - ownerUser, err := FindGroupMemberInfoByGroupIdAndUserId(pb.GroupID, pb.OwnerID) - if err != nil { - log.ErrorByKv("FindGroupMemberInfoByGroupIdAndUserId failed", pb.OperationID, "groupId", pb.GroupID, "ownerID", pb.OwnerID) - return nil, err - } - if ownerUser.AdministratorLevel <= 0 { - return nil, errors.New("insufficient permissions") - } - - dbConn, err := db.DB.MysqlDB.DefaultGormDB() - if err != nil { - return nil, err - } - var groupRequest GroupRequest - err = dbConn.Raw("select * from `group_request` where handled_user = ? and group_id = ? and from_user_id = ? and to_user_id = ?", - "", pb.GroupID, pb.FromUserID, pb.ToUserID).Scan(&groupRequest).Error - if err != nil { - log.ErrorByKv("find group_request info failed", pb.OperationID, "groupId", pb.GroupID, "fromUserId", pb.FromUserID, "toUserId", pb.OwnerID) - return nil, err - } - - if groupRequest.Flag != 0 { - return nil, errors.New("application has already handle") - } - - var saveFlag int - if pb.HandleResult == 0 { - saveFlag = -1 - } else if pb.HandleResult == 1 { - saveFlag = 1 - } else { - return nil, errors.New("parma HandleResult error") - } - err = dbConn.Exec("update `group_request` set flag = ?, handled_msg = ?, handled_user = ? where group_id = ? and from_user_id = ? and to_user_id = ?", - saveFlag, pb.HandledMsg, pb.OwnerID, groupRequest.GroupID, groupRequest.FromUserID, groupRequest.ToUserID).Error - if err != nil { - log.ErrorByKv("update group request failed", pb.OperationID, "groupID", pb.GroupID, "flag", saveFlag, "ownerId", pb.OwnerID, "fromUserId", pb.FromUserID, "toUserID", pb.ToUserID) - return nil, err - } - - if saveFlag == 1 { - if groupRequest.ToUserID == "0" { - err = InsertIntoGroupMember(pb.GroupID, pb.FromUserID, groupRequest.FromUserNickname, groupRequest.FromUserFaceUrl, 0) - if err != nil { - log.ErrorByKv("InsertIntoGroupMember failed", pb.OperationID, "groupID", pb.GroupID, "fromUserId", pb.FromUserID) - return nil, err - } - } else { - err = InsertIntoGroupMember(pb.GroupID, pb.ToUserID, groupRequest.ToUserNickname, groupRequest.ToUserFaceUrl, 0) - if err != nil { - log.ErrorByKv("InsertIntoGroupMember failed", pb.OperationID, "groupID", pb.GroupID, "fromUserId", pb.FromUserID) - return nil, err - } - } - } - - return &group.GroupApplicationResponseResp{}, nil + err = dbConn.Table("friend_request").Where("group_id=?", groupInfo.GroupID).Update(&groupInfo).Error + return err } diff --git a/pkg/common/db/mysql_model/im_mysql_model/group_request_model.go b/pkg/common/db/mysql_model/im_mysql_model/group_request_model.go index da793d331..143cab342 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/group_request_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/group_request_model.go @@ -2,15 +2,41 @@ package im_mysql_model import ( "Open_IM/pkg/common/db" + "Open_IM/pkg/common/log" + "Open_IM/pkg/proto/group" "time" ) -func InsertIntoGroupRequest(groupId, fromUserId, toUserId, reqMsg, fromUserNickName, fromUserFaceUrl string) error { +//type GroupRequest struct { +// UserID string `gorm:"column:user_id;primaryKey;"` +// GroupID string `gorm:"column:group_id;primaryKey;"` +// HandleResult int32 `gorm:"column:handle_result"` +// ReqMsg string `gorm:"column:req_msg"` +// HandledMsg string `gorm:"column:handled_msg"` +// ReqTime time.Time `gorm:"column:req_time"` +// HandleUserID string `gorm:"column:handle_user_id"` +// HandledTime time.Time `gorm:"column:handle_time"` +// Ex string `gorm:"column:ex"` +//} + +func UpdateGroupRequest(groupRequest GroupRequest) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return err } - toInsertInfo := GroupRequest{GroupID: groupId, FromUserID: fromUserId, ToUserID: toUserId, ReqMsg: reqMsg, FromUserNickname: fromUserNickName, FromUserFaceUrl: fromUserFaceUrl, CreateTime: time.Now()} + err = dbConn.Table("group_request").Where("group_id=? and user_id=?", groupRequest.GroupID, groupRequest.UserID).Update(&groupRequest).Error + if err != nil { + return err + } + return nil +} + +func InsertIntoGroupRequest(toInsertInfo GroupRequest) error { + dbConn, err := db.DB.MysqlDB.DefaultGormDB() + if err != nil { + return err + } + toInsertInfo.HandledTime = time.Now() err = dbConn.Table("group_request").Create(&toInsertInfo).Error if err != nil { return err @@ -18,45 +44,139 @@ func InsertIntoGroupRequest(groupId, fromUserId, toUserId, reqMsg, fromUserNickN return nil } -func FindGroupRequestUserInfoByGroupIDAndUid(groupId, uid string) (*GroupRequest, error) { +func GetGroupRequestByGroupIDAndUserID(groupID, userID string) (*GroupRequest, error) { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return nil, err } - var requestUserInfo GroupRequest - err = dbConn.Table("group_request").Where("from_user_id=? and group_id=?", uid, groupId).Find(&requestUserInfo).Error + var groupRequest GroupRequest + err = dbConn.Table("group_request").Where("user_id=? and group_id=?", userID, groupID).Find(&groupRequest).Error if err != nil { return nil, err } - return &requestUserInfo, nil + return &groupRequest, nil } -func DelGroupRequest(groupId, fromUserId, toUserId string) error { +func DelGroupRequestByGroupIDAndUserID(groupID, userID string) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return err } - err = dbConn.Exec("delete from group_request where group_id=? and from_user_id=? and to_user_id=?", groupId, fromUserId, toUserId).Error + err = dbConn.Table("group_request").Where("group_id=? and user_id=?", groupID, userID).Delete(&GroupRequest{}).Error if err != nil { return err } return nil } -func FindGroupBeInvitedRequestInfoByUidAndGroupID(groupId, uid string) (*GroupRequest, error) { +func GetGroupRequestByGroupID(groupID string) ([]GroupRequest, error) { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return nil, err } - var beInvitedRequestUserInfo GroupRequest - err = dbConn.Table("group_request").Where("to_user_id=? and group_id=?", uid, groupId).Find(&beInvitedRequestUserInfo).Error + var groupRequestList []GroupRequest + err = dbConn.Table("group_request").Where("group_id=?", groupID).Find(&groupRequestList).Error if err != nil { return nil, err } - return &beInvitedRequestUserInfo, nil - + return groupRequestList, nil } -func InsertGroupRequest(groupId, fromUser, fromUserNickName, fromUserFaceUrl, toUser, requestMsg, handledMsg string, handleStatus int) error { - return nil +//received +func GetGroupApplicationList(userID string) ([]GroupRequest, error) { + var groupRequestList []GroupRequest + memberList, err := GetGroupMemberListByUserID(userID) + if err != nil { + return nil, err + } + for _, v := range memberList { + if v.RoleLevel > 0 { + list, err := GetGroupRequestByGroupID(v.GroupID) + if err != nil { + continue + } + groupRequestList = append(groupRequestList, list...) + } + } + return groupRequestList, nil } + +// +//func GroupApplicationResponse(pb *group.GroupApplicationResponseReq) (*group.CommonResp, error) { +// +// ownerUser, err := FindGroupMemberInfoByGroupIdAndUserId(pb.GroupID, pb.OwnerID) +// if err != nil { +// log.ErrorByKv("FindGroupMemberInfoByGroupIdAndUserId failed", pb.OperationID, "groupId", pb.GroupID, "ownerID", pb.OwnerID) +// return nil, err +// } +// if ownerUser.AdministratorLevel <= 0 { +// return nil, errors.New("insufficient permissions") +// } +// +// dbConn, err := db.DB.MysqlDB.DefaultGormDB() +// if err != nil { +// return nil, err +// } +// var groupRequest GroupRequest +// err = dbConn.Raw("select * from `group_request` where handled_user = ? and group_id = ? and from_user_id = ? and to_user_id = ?", +// "", pb.GroupID, pb.FromUserID, pb.ToUserID).Scan(&groupRequest).Error +// if err != nil { +// log.ErrorByKv("find group_request info failed", pb.OperationID, "groupId", pb.GroupID, "fromUserId", pb.FromUserID, "toUserId", pb.OwnerID) +// return nil, err +// } +// +// if groupRequest.Flag != 0 { +// return nil, errors.New("application has already handle") +// } +// +// var saveFlag int +// if pb.HandleResult == 0 { +// saveFlag = -1 +// } else if pb.HandleResult == 1 { +// saveFlag = 1 +// } else { +// return nil, errors.New("parma HandleResult error") +// } +// err = dbConn.Exec("update `group_request` set flag = ?, handled_msg = ?, handled_user = ? where group_id = ? and from_user_id = ? and to_user_id = ?", +// saveFlag, pb.HandledMsg, pb.OwnerID, groupRequest.GroupID, groupRequest.FromUserID, groupRequest.ToUserID).Error +// if err != nil { +// log.ErrorByKv("update group request failed", pb.OperationID, "groupID", pb.GroupID, "flag", saveFlag, "ownerId", pb.OwnerID, "fromUserId", pb.FromUserID, "toUserID", pb.ToUserID) +// return nil, err +// } +// +// if saveFlag == 1 { +// if groupRequest.ToUserID == "0" { +// err = InsertIntoGroupMember(pb.GroupID, pb.FromUserID, groupRequest.FromUserNickname, groupRequest.FromUserFaceUrl, 0) +// if err != nil { +// log.ErrorByKv("InsertIntoGroupMember failed", pb.OperationID, "groupID", pb.GroupID, "fromUserId", pb.FromUserID) +// return nil, err +// } +// } else { +// err = InsertIntoGroupMember(pb.GroupID, pb.ToUserID, groupRequest.ToUserNickname, groupRequest.ToUserFaceUrl, 0) +// if err != nil { +// log.ErrorByKv("InsertIntoGroupMember failed", pb.OperationID, "groupID", pb.GroupID, "fromUserId", pb.FromUserID) +// return nil, err +// } +// } +// } +// +// return &group.GroupApplicationResponseResp{}, nil +//} + +//func FindGroupBeInvitedRequestInfoByUidAndGroupID(groupId, uid string) (*GroupRequest, error) { +// dbConn, err := db.DB.MysqlDB.DefaultGormDB() +// if err != nil { +// return nil, err +// } +// var beInvitedRequestUserInfo GroupRequest +// err = dbConn.Table("group_request").Where("to_user_id=? and group_id=?", uid, groupId).Find(&beInvitedRequestUserInfo).Error +// if err != nil { +// return nil, err +// } +// return &beInvitedRequestUserInfo, nil +// +//} + +//func InsertGroupRequest(groupId, fromUser, fromUserNickName, fromUserFaceUrl, toUser, requestMsg, handledMsg string, handleStatus int) error { +// return nil +//} diff --git a/pkg/common/db/mysql_model/im_mysql_model/model_struct.go b/pkg/common/db/mysql_model/im_mysql_model/model_struct.go index 45741797e..f67930e8b 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/model_struct.go +++ b/pkg/common/db/mysql_model/im_mysql_model/model_struct.go @@ -40,7 +40,7 @@ type Group struct { type GroupMember struct { GroupID string `gorm:"column:group_id;primaryKey;"` UserID string `gorm:"column:user_id;primaryKey;"` - NickName string `gorm:"column:nickname"` + Nickname string `gorm:"column:nickname"` FaceUrl string `gorm:"user_group_face_url"` RoleLevel int32 `gorm:"column:role_level"` JoinTime time.Time `gorm:"column:join_time"` @@ -52,7 +52,7 @@ type GroupMember struct { type GroupRequest struct { UserID string `gorm:"column:user_id;primaryKey;"` GroupID string `gorm:"column:group_id;primaryKey;"` - HandleResult string `gorm:"column:handle_result"` + HandleResult int32 `gorm:"column:handle_result"` ReqMsg string `gorm:"column:req_msg"` HandledMsg string `gorm:"column:handled_msg"` ReqTime time.Time `gorm:"column:req_time"` @@ -73,7 +73,7 @@ type User struct { CreateTime time.Time `gorm:"column:create_time"` } -type BlackList struct { +type Black struct { OwnerUserID string `gorm:"column:owner_user_id;primaryKey;"` BlockUserID string `gorm:"column:block_user_id;primaryKey;"` CreateTime time.Time `gorm:"column:create_time"` diff --git a/pkg/common/db/mysql_model/im_mysql_model/user_black_list_model.go b/pkg/common/db/mysql_model/im_mysql_model/user_black_list_model.go index 39ad51a13..42a7c2fa9 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/user_black_list_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/user_black_list_model.go @@ -5,42 +5,52 @@ import ( "time" ) -func InsertInToUserBlackList(ownerID, blockID string) error { +func InsertInToUserBlackList(black Black) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return err } - toInsertInfo := BlackList{OwnerUserID: ownerID, BlockUserID: blockID, CreateTime: time.Now()} - err = dbConn.Table("user_black_list").Create(toInsertInfo).Error + black.CreateTime = time.Now() + err = dbConn.Table("user_black_list").Create(black).Error return err } -func FindRelationshipFromBlackList(ownerID, blockID string) error { +//type Black struct { +// OwnerUserID string `gorm:"column:owner_user_id;primaryKey;"` +// BlockUserID string `gorm:"column:block_user_id;primaryKey;"` +// CreateTime time.Time `gorm:"column:create_time"` +// AddSource int32 `gorm:"column:add_source"` +// OperatorUserID int32 `gorm:"column:operator_user_id"` +// Ex string `gorm:"column:ex"` +//} + +func CheckBlack(ownerUserID, blockUserID string) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return err } - var blackList BlackList - err = dbConn.Table("user_black_list").Where("owner_id=? and block_id=?", ownerID, blockID).Find(&blackList).Error + var black Black + err = dbConn.Table("user_black_list").Where("owner_user_id=? and block_user_id=?", ownerUserID, blockUserID).Find(&black).Error return err } -func RemoveBlackList(ownerID, blockID string) error { +func RemoveBlackList(ownerUserID, blockUserID string) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return err } - err = dbConn.Exec("delete from user_black_list where owner_id=? and block_id=?", ownerID, blockID).Error + + err = dbConn.Table("user_black_list").Where("owner_user_id=? and block_user_id=?", ownerUserID, blockUserID).Delete(&Black{}).Error return err } -func GetBlackListByUID(ownerID string) ([]BlackList, error) { +func GetBlackListByUserID(ownerUserID string) ([]Black, error) { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return nil, err } - var blackListUsersInfo []BlackList - err = dbConn.Table("user_black_list").Where("owner_id=?", ownerID).Find(&blackListUsersInfo).Error + var blackListUsersInfo []Black + err = dbConn.Table("user_black_list").Where("owner_user_id=?", ownerUserID).Find(&blackListUsersInfo).Error if err != nil { return nil, err } diff --git a/pkg/common/db/mysql_model/im_mysql_model/user_model.go b/pkg/common/db/mysql_model/im_mysql_model/user_model.go index 98ddcb7fc..4025d2db3 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/user_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/user_model.go @@ -3,7 +3,6 @@ package im_mysql_model import ( "Open_IM/pkg/common/config" "Open_IM/pkg/common/db" - pbAuth "Open_IM/pkg/proto/auth" "Open_IM/pkg/utils" "fmt" _ "github.com/jinzhu/gorm/dialects/mysql" @@ -12,168 +11,101 @@ import ( func init() { //init managers - var pb pbAuth.UserRegisterReq for k, v := range config.Config.Manager.AppManagerUid { - if !IsExistUser(v) { - pb.UID = v - pb.Name = "AppManager" + utils.IntToString(k+1) - err := UserRegister(&pb) - if err != nil { - fmt.Println("AppManager insert error", err.Error()) - } + user, err := GetUserByUserID(v) + if err != nil { + fmt.Println("GetUserByUserID failed ", err.Error(), v, user) + continue } + var appMgr User + appMgr.Nickname = "AppManager" + utils.IntToString(k+1) + err = UserRegister(appMgr) + if err != nil { + fmt.Println("AppManager insert error", err.Error()) + } + } } -func UserRegister(pb *pbAuth.UserRegisterReq) error { + +func UserRegister(user User) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return err } - addUser := User{ - UserID: pb.UID, - Nickname: pb.Name, - FaceUrl: pb.Icon, - Gender: pb.Gender, - Mobile: pb.Mobile, - Birth: pb.Birth, - Email: pb.Email, - Ex: pb.Ex, - CreateTime: time.Now(), - } - err = dbConn.Table("user").Create(&addUser).Error + user.CreateTime = time.Now() + + err = dbConn.Table("user").Create(&user).Error if err != nil { return err } return nil } -func UserDelete(uid string) error { +//type User struct { +// UserID string `gorm:"column:user_id;primaryKey;"` +// Nickname string `gorm:"column:name"` +// FaceUrl string `gorm:"column:icon"` +// Gender int32 `gorm:"column:gender"` +// PhoneNumber string `gorm:"column:phone_number"` +// Birth string `gorm:"column:birth"` +// Email string `gorm:"column:email"` +// Ex string `gorm:"column:ex"` +// CreateTime time.Time `gorm:"column:create_time"` +//} + +func DeleteUser(userID string) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return err } - err = dbConn.Table("user").Where("uid=?", uid).Delete(User{}).Error - if err != nil { - return err - } - return nil + err = dbConn.Table("user").Where("user_id=?", userID).Delete(User{}).Error + return err } -func FindUserByUID(uid string) (*User, error) { + +func GetUserByUserID(userID string) (*User, error) { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return nil, err } var user User - err = dbConn.Table("user").Where("uid=?", uid).First(&user).Error + err = dbConn.Table("user").Where("user_id=?", userID).First(&user).Error if err != nil { return nil, err } return &user, nil } -func UpDateUserInfo(uid, name, headUrl, mobilePhoneNum, birth, email, extendInfo string, gender int32) error { +func UpdateUserInfo(user User) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return err } - if name != "" { - if err = dbConn.Exec("update user set name=? where uid=?", name, uid).Error; err != nil { - return err - } - } - if headUrl != "" { - if err = dbConn.Exec("update user set icon=? where uid=?", headUrl, uid).Error; err != nil { - return err - } - } - if mobilePhoneNum != "" { - if err = dbConn.Exec("update user set mobile=? where uid=?", mobilePhoneNum, uid).Error; err != nil { - return err - } - } - if birth != "" { - if err = dbConn.Exec("update user set birth=? where uid=?", birth, uid).Error; err != nil { - return err - } - } - if email != "" { - if err = dbConn.Exec("update user set email=? where uid=?", email, uid).Error; err != nil { - return err - } - } - if extendInfo != "" { - if err = dbConn.Exec("update user set ex=? where uid=?", extendInfo, uid).Error; err != nil { - return err - } - } - if gender != 0 { - if err = dbConn.Exec("update user set gender=? where uid=?", gender, uid).Error; err != nil { - return err - } - } - return nil + err = dbConn.Table("user").Where("user_id=?", user.UserID).Update(&user).Error + return err } -func SelectAllUID() ([]string, error) { - var uid []string - +func SelectAllUserID() ([]string, error) { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { - return uid, err + return nil, err } - rows, err := dbConn.Raw("select uid from user").Rows() + var resultArr []string + err = dbConn.Table("user").Select([]string{"user_id"}).Scan(&resultArr).Error if err != nil { - return uid, err + return nil, err } - defer rows.Close() - var strUID string - for rows.Next() { - rows.Scan(&strUID) - uid = append(uid, strUID) - } - return uid, nil -} -func SelectSomeUID(uids []string) ([]string, error) { - var uid []string - - dbConn, err := db.DB.MysqlDB.DefaultGormDB() - if err != nil { - return uid, err - } - rows, err := dbConn.Raw("select uid from user where uid in (" + sqlStringHandle(uids) + ")").Rows() - if err != nil { - return uid, err - } - defer rows.Close() - var strUID string - for rows.Next() { - rows.Scan(&strUID) - uid = append(uid, strUID) - } - return uid, nil + return resultArr, nil } -func IsExistUser(uid string) bool { +func SelectSomeUserID(userIDList []string) ([]string, error) { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { - return false + return nil, err } - var number int32 - err = dbConn.Raw("select count(*) from `user` where uid = ?", uid).Count(&number).Error + var userList []User + err = dbConn.Table("user").Where("(user_id) IN ? ", userIDList).Find(&userList).Error if err != nil { - return false + return nil, err } - if number != 1 { - return false - } - return true -} -func sqlStringHandle(ss []string) (s string) { - for i := 0; i < len(ss); i++ { - s += "'" + ss[i] + "'" - if i < len(ss)-1 { - s += "," - } - } - return s + return userIDList, nil } diff --git a/pkg/proto/auth/auth.pb.go b/pkg/proto/auth/auth.pb.go index 71ab5fe7a..1bc510860 100644 --- a/pkg/proto/auth/auth.pb.go +++ b/pkg/proto/auth/auth.pb.go @@ -6,6 +6,7 @@ package pbAuth // import "./auth" import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" +import sdk_ws "Open_IM/pkg/proto/sdk_ws" import ( context "golang.org/x/net/context" @@ -23,25 +24,65 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package -type UserRegisterReq struct { - UID string `protobuf:"bytes,1,opt,name=UID" json:"UID,omitempty"` - Name string `protobuf:"bytes,2,opt,name=Name" json:"Name,omitempty"` - Icon string `protobuf:"bytes,3,opt,name=Icon" json:"Icon,omitempty"` - Gender int32 `protobuf:"varint,4,opt,name=Gender" json:"Gender,omitempty"` - Mobile string `protobuf:"bytes,5,opt,name=Mobile" json:"Mobile,omitempty"` - Birth string `protobuf:"bytes,6,opt,name=Birth" json:"Birth,omitempty"` - Email string `protobuf:"bytes,7,opt,name=Email" json:"Email,omitempty"` - Ex string `protobuf:"bytes,8,opt,name=Ex" json:"Ex,omitempty"` +type CommonResp struct { + ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } +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_auth_6e5d34ffb6edf37a, []int{0} +} +func (m *CommonResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CommonResp.Unmarshal(m, b) +} +func (m *CommonResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CommonResp.Marshal(b, m, deterministic) +} +func (dst *CommonResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommonResp.Merge(dst, src) +} +func (m *CommonResp) XXX_Size() int { + return xxx_messageInfo_CommonResp.Size(m) +} +func (m *CommonResp) XXX_DiscardUnknown() { + xxx_messageInfo_CommonResp.DiscardUnknown(m) +} + +var xxx_messageInfo_CommonResp proto.InternalMessageInfo + +func (m *CommonResp) GetErrCode() int32 { + if m != nil { + return m.ErrCode + } + return 0 +} + +func (m *CommonResp) GetErrMsg() string { + if m != nil { + return m.ErrMsg + } + return "" +} + +type UserRegisterReq struct { + UserInfo *sdk_ws.UserInfo `protobuf:"bytes,1,opt,name=UserInfo" json:"UserInfo,omitempty"` + OperationID string `protobuf:"bytes,2,opt,name=OperationID" json:"OperationID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + func (m *UserRegisterReq) Reset() { *m = UserRegisterReq{} } func (m *UserRegisterReq) String() string { return proto.CompactTextString(m) } func (*UserRegisterReq) ProtoMessage() {} func (*UserRegisterReq) Descriptor() ([]byte, []int) { - return fileDescriptor_auth_d2199f7b1388fd2f, []int{0} + return fileDescriptor_auth_6e5d34ffb6edf37a, []int{1} } func (m *UserRegisterReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UserRegisterReq.Unmarshal(m, b) @@ -61,74 +102,32 @@ func (m *UserRegisterReq) XXX_DiscardUnknown() { var xxx_messageInfo_UserRegisterReq proto.InternalMessageInfo -func (m *UserRegisterReq) GetUID() string { +func (m *UserRegisterReq) GetUserInfo() *sdk_ws.UserInfo { if m != nil { - return m.UID + return m.UserInfo } - return "" + return nil } -func (m *UserRegisterReq) GetName() string { +func (m *UserRegisterReq) GetOperationID() string { if m != nil { - return m.Name - } - return "" -} - -func (m *UserRegisterReq) GetIcon() string { - if m != nil { - return m.Icon - } - return "" -} - -func (m *UserRegisterReq) GetGender() int32 { - if m != nil { - return m.Gender - } - return 0 -} - -func (m *UserRegisterReq) GetMobile() string { - if m != nil { - return m.Mobile - } - return "" -} - -func (m *UserRegisterReq) GetBirth() string { - if m != nil { - return m.Birth - } - return "" -} - -func (m *UserRegisterReq) GetEmail() string { - if m != nil { - return m.Email - } - return "" -} - -func (m *UserRegisterReq) GetEx() string { - if m != nil { - return m.Ex + return m.OperationID } return "" } type UserRegisterResp struct { - Success bool `protobuf:"varint,1,opt,name=Success" json:"Success,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + CommonResp *CommonResp `protobuf:"bytes,1,opt,name=CommonResp" json:"CommonResp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *UserRegisterResp) Reset() { *m = UserRegisterResp{} } func (m *UserRegisterResp) String() string { return proto.CompactTextString(m) } func (*UserRegisterResp) ProtoMessage() {} func (*UserRegisterResp) Descriptor() ([]byte, []int) { - return fileDescriptor_auth_d2199f7b1388fd2f, []int{1} + return fileDescriptor_auth_6e5d34ffb6edf37a, []int{2} } func (m *UserRegisterResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UserRegisterResp.Unmarshal(m, b) @@ -148,16 +147,18 @@ func (m *UserRegisterResp) XXX_DiscardUnknown() { var xxx_messageInfo_UserRegisterResp proto.InternalMessageInfo -func (m *UserRegisterResp) GetSuccess() bool { +func (m *UserRegisterResp) GetCommonResp() *CommonResp { if m != nil { - return m.Success + return m.CommonResp } - return false + return nil } type UserTokenReq struct { Platform int32 `protobuf:"varint,1,opt,name=Platform" json:"Platform,omitempty"` - UID string `protobuf:"bytes,2,opt,name=UID" json:"UID,omitempty"` + FromUserID string `protobuf:"bytes,2,opt,name=FromUserID" json:"FromUserID,omitempty"` + OpUserID string `protobuf:"bytes,3,opt,name=OpUserID" json:"OpUserID,omitempty"` + OperationID string `protobuf:"bytes,4,opt,name=OperationID" json:"OperationID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -167,7 +168,7 @@ func (m *UserTokenReq) Reset() { *m = UserTokenReq{} } func (m *UserTokenReq) String() string { return proto.CompactTextString(m) } func (*UserTokenReq) ProtoMessage() {} func (*UserTokenReq) Descriptor() ([]byte, []int) { - return fileDescriptor_auth_d2199f7b1388fd2f, []int{2} + return fileDescriptor_auth_6e5d34ffb6edf37a, []int{3} } func (m *UserTokenReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UserTokenReq.Unmarshal(m, b) @@ -194,28 +195,41 @@ func (m *UserTokenReq) GetPlatform() int32 { return 0 } -func (m *UserTokenReq) GetUID() string { +func (m *UserTokenReq) GetFromUserID() string { if m != nil { - return m.UID + return m.FromUserID + } + return "" +} + +func (m *UserTokenReq) GetOpUserID() string { + if m != nil { + return m.OpUserID + } + return "" +} + +func (m *UserTokenReq) GetOperationID() string { + if m != nil { + return m.OperationID } return "" } type UserTokenResp struct { - ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"` - ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"` - Token string `protobuf:"bytes,3,opt,name=Token" json:"Token,omitempty"` - ExpiredTime int64 `protobuf:"varint,4,opt,name=ExpiredTime" json:"ExpiredTime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + CommonResp *CommonResp `protobuf:"bytes,1,opt,name=CommonResp" json:"CommonResp,omitempty"` + Token string `protobuf:"bytes,2,opt,name=Token" json:"Token,omitempty"` + ExpiredTime int64 `protobuf:"varint,3,opt,name=ExpiredTime" json:"ExpiredTime,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *UserTokenResp) Reset() { *m = UserTokenResp{} } func (m *UserTokenResp) String() string { return proto.CompactTextString(m) } func (*UserTokenResp) ProtoMessage() {} func (*UserTokenResp) Descriptor() ([]byte, []int) { - return fileDescriptor_auth_d2199f7b1388fd2f, []int{3} + return fileDescriptor_auth_6e5d34ffb6edf37a, []int{4} } func (m *UserTokenResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UserTokenResp.Unmarshal(m, b) @@ -235,18 +249,11 @@ func (m *UserTokenResp) XXX_DiscardUnknown() { var xxx_messageInfo_UserTokenResp proto.InternalMessageInfo -func (m *UserTokenResp) GetErrCode() int32 { +func (m *UserTokenResp) GetCommonResp() *CommonResp { if m != nil { - return m.ErrCode + return m.CommonResp } - return 0 -} - -func (m *UserTokenResp) GetErrMsg() string { - if m != nil { - return m.ErrMsg - } - return "" + return nil } func (m *UserTokenResp) GetToken() string { @@ -264,6 +271,7 @@ func (m *UserTokenResp) GetExpiredTime() int64 { } func init() { + proto.RegisterType((*CommonResp)(nil), "pbAuth.CommonResp") proto.RegisterType((*UserRegisterReq)(nil), "pbAuth.UserRegisterReq") proto.RegisterType((*UserRegisterResp)(nil), "pbAuth.UserRegisterResp") proto.RegisterType((*UserTokenReq)(nil), "pbAuth.UserTokenReq") @@ -375,30 +383,31 @@ var _Auth_serviceDesc = grpc.ServiceDesc{ Metadata: "auth/auth.proto", } -func init() { proto.RegisterFile("auth/auth.proto", fileDescriptor_auth_d2199f7b1388fd2f) } +func init() { proto.RegisterFile("auth/auth.proto", fileDescriptor_auth_6e5d34ffb6edf37a) } -var fileDescriptor_auth_d2199f7b1388fd2f = []byte{ - // 348 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0x41, 0x4f, 0xf2, 0x40, - 0x10, 0x86, 0xd3, 0x42, 0x0b, 0xcc, 0xf7, 0x21, 0x64, 0x82, 0xba, 0xe1, 0x44, 0x7a, 0xe2, 0x60, - 0x6a, 0xa2, 0x17, 0x13, 0xbd, 0x80, 0x36, 0x86, 0x03, 0xc6, 0x54, 0xb8, 0x78, 0x2b, 0xb0, 0x42, - 0x23, 0x65, 0xeb, 0x6e, 0x49, 0xf0, 0xec, 0x8f, 0xf2, 0xef, 0x99, 0x9d, 0xdd, 0x12, 0x34, 0x5c, - 0xda, 0x79, 0x9f, 0x9d, 0xc9, 0xee, 0x3b, 0x33, 0xd0, 0x4a, 0xb6, 0xc5, 0xea, 0x52, 0x7f, 0xc2, - 0x5c, 0x8a, 0x42, 0xa0, 0x9f, 0xcf, 0x06, 0xdb, 0x62, 0x15, 0x7c, 0x3b, 0xd0, 0x9a, 0x2a, 0x2e, - 0x63, 0xbe, 0x4c, 0x55, 0xa1, 0xff, 0x1f, 0xd8, 0x86, 0xca, 0x74, 0xf4, 0xc0, 0x9c, 0x9e, 0xd3, - 0x6f, 0xc4, 0x3a, 0x44, 0x84, 0xea, 0x53, 0x92, 0x71, 0xe6, 0x12, 0xa2, 0x58, 0xb3, 0xd1, 0x5c, - 0x6c, 0x58, 0xc5, 0x30, 0x1d, 0xe3, 0x19, 0xf8, 0x8f, 0x7c, 0xb3, 0xe0, 0x92, 0x55, 0x7b, 0x4e, - 0xdf, 0x8b, 0xad, 0xd2, 0x7c, 0x2c, 0x66, 0xe9, 0x9a, 0x33, 0x8f, 0xb2, 0xad, 0xc2, 0x0e, 0x78, - 0xc3, 0x54, 0x16, 0x2b, 0xe6, 0x13, 0x36, 0x42, 0xd3, 0x28, 0x4b, 0xd2, 0x35, 0xab, 0x19, 0x4a, - 0x02, 0x4f, 0xc0, 0x8d, 0x76, 0xac, 0x4e, 0xc8, 0x8d, 0x76, 0xc1, 0x05, 0xb4, 0x7f, 0x3f, 0x5c, - 0xe5, 0xc8, 0xa0, 0xf6, 0xb2, 0x9d, 0xcf, 0xb9, 0x52, 0xf4, 0xfa, 0x7a, 0x5c, 0xca, 0xe0, 0x0e, - 0xfe, 0xeb, 0xec, 0x89, 0x78, 0xe7, 0x1b, 0xed, 0xb1, 0x0b, 0xf5, 0xe7, 0x75, 0x52, 0xbc, 0x09, - 0x99, 0x51, 0xaa, 0x17, 0xef, 0x75, 0xe9, 0xdf, 0xdd, 0xfb, 0x0f, 0x3e, 0xa1, 0x79, 0x50, 0x6d, - 0x2e, 0x8a, 0xa4, 0xbc, 0x17, 0x0b, 0x6e, 0xab, 0x4b, 0xa9, 0xad, 0x46, 0x52, 0x8e, 0xd5, 0xd2, - 0xd6, 0x5b, 0xa5, 0x4d, 0x51, 0xb9, 0xed, 0x97, 0x11, 0xd8, 0x83, 0x7f, 0xd1, 0x2e, 0x4f, 0x25, - 0x5f, 0x4c, 0xd2, 0x8c, 0x53, 0xd7, 0x2a, 0xf1, 0x21, 0xba, 0xfa, 0x72, 0xa0, 0xaa, 0x27, 0x85, - 0x03, 0xe3, 0xa0, 0xf4, 0x8b, 0xe7, 0xa1, 0x19, 0x61, 0xf8, 0x67, 0x7c, 0x5d, 0x76, 0xfc, 0x40, - 0xe5, 0x78, 0x03, 0x8d, 0xbd, 0x0d, 0xec, 0x1c, 0xa6, 0x95, 0x7d, 0xe9, 0x9e, 0x1e, 0xa1, 0x2a, - 0x1f, 0xb6, 0x5e, 0x9b, 0x21, 0xad, 0xcf, 0xad, 0x39, 0x9e, 0xf9, 0xb4, 0x46, 0xd7, 0x3f, 0x01, - 0x00, 0x00, 0xff, 0xff, 0x15, 0x5d, 0xc8, 0xb6, 0x59, 0x02, 0x00, 0x00, +var fileDescriptor_auth_6e5d34ffb6edf37a = []byte{ + // 362 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0x4d, 0x4f, 0xc2, 0x40, + 0x14, 0x4c, 0xe5, 0x43, 0x78, 0x48, 0x30, 0x2f, 0xa0, 0x4d, 0x0f, 0x06, 0x7b, 0xe2, 0xd4, 0x46, + 0xbc, 0x98, 0x98, 0x98, 0x20, 0x4a, 0xc2, 0x81, 0x60, 0x1a, 0xbc, 0x78, 0x21, 0x90, 0x2e, 0xd0, + 0xd4, 0x76, 0xd7, 0xdd, 0x12, 0x4c, 0x3c, 0x7a, 0xf1, 0x67, 0x9b, 0xdd, 0x7e, 0xb8, 0x22, 0x27, + 0x2f, 0x6d, 0x66, 0xe6, 0xf5, 0xcd, 0xcc, 0x76, 0xa1, 0xb5, 0xd8, 0x26, 0x1b, 0x57, 0x3e, 0x1c, + 0xc6, 0x69, 0x42, 0xb1, 0xca, 0x96, 0x83, 0x6d, 0xb2, 0xb1, 0x2e, 0xa7, 0x8c, 0xc4, 0xf3, 0xf1, + 0xc4, 0x65, 0xe1, 0xda, 0x55, 0x92, 0x2b, 0xfc, 0x70, 0xbe, 0x13, 0xee, 0x4e, 0xa4, 0xa3, 0xf6, + 0x1d, 0xc0, 0x90, 0x46, 0x11, 0x8d, 0x3d, 0x22, 0x18, 0x9a, 0x70, 0x4c, 0x38, 0x1f, 0x52, 0x9f, + 0x98, 0x46, 0xd7, 0xe8, 0x55, 0xbc, 0x1c, 0xe2, 0x19, 0x54, 0x09, 0xe7, 0x13, 0xb1, 0x36, 0x8f, + 0xba, 0x46, 0xaf, 0xee, 0x65, 0xc8, 0x5e, 0x41, 0xeb, 0x59, 0x10, 0xee, 0x91, 0x75, 0x20, 0x12, + 0xf9, 0x7e, 0xc3, 0x2b, 0xa8, 0x49, 0x6a, 0x1c, 0xaf, 0xa8, 0xda, 0xd2, 0xe8, 0x77, 0x1c, 0x2a, + 0x83, 0x04, 0xd1, 0x5c, 0xf8, 0xa1, 0x93, 0x8b, 0x5e, 0x31, 0x86, 0x5d, 0x68, 0x4c, 0x19, 0xe1, + 0x8b, 0x24, 0xa0, 0xf1, 0xf8, 0x21, 0xb3, 0xd0, 0x29, 0x7b, 0x04, 0xa7, 0xbf, 0x7d, 0x04, 0xc3, + 0xbe, 0x9e, 0x3d, 0xb3, 0x42, 0x27, 0xed, 0xee, 0xfc, 0x28, 0x9e, 0x36, 0x65, 0x7f, 0x19, 0x70, + 0x22, 0x17, 0xcd, 0x68, 0x48, 0x62, 0x99, 0xd6, 0x82, 0xda, 0xd3, 0xeb, 0x22, 0x59, 0x51, 0x1e, + 0x65, 0x9d, 0x0b, 0x8c, 0x17, 0x00, 0x23, 0x4e, 0x23, 0x15, 0x33, 0x4f, 0xa5, 0x31, 0xf2, 0xdb, + 0x29, 0xcb, 0xd4, 0x92, 0x52, 0x0b, 0xbc, 0x5f, 0xa9, 0xfc, 0xb7, 0xd2, 0x07, 0x34, 0xb5, 0x24, + 0xff, 0xeb, 0x83, 0x6d, 0xa8, 0xa8, 0x05, 0x59, 0xba, 0x14, 0x48, 0xf3, 0xc7, 0x77, 0x16, 0x70, + 0xe2, 0xcf, 0x82, 0x88, 0xa8, 0x6c, 0x25, 0x4f, 0xa7, 0xfa, 0x9f, 0x06, 0x94, 0xe5, 0x5e, 0x1c, + 0xa4, 0xe7, 0x91, 0x1f, 0x2c, 0x9e, 0xe7, 0x86, 0x7b, 0xbf, 0xd5, 0x32, 0x0f, 0x0b, 0x82, 0xe1, + 0x0d, 0xd4, 0x8b, 0x22, 0xd8, 0xd6, 0xc7, 0xf2, 0x53, 0xb6, 0x3a, 0x07, 0x58, 0xc1, 0xee, 0x5b, + 0x2f, 0x4d, 0x47, 0x5d, 0xdc, 0xdb, 0x54, 0x5e, 0x56, 0xd5, 0xad, 0xbc, 0xfe, 0x0e, 0x00, 0x00, + 0xff, 0xff, 0x8c, 0xd6, 0x72, 0x1f, 0xd3, 0x02, 0x00, 0x00, } diff --git a/pkg/proto/auth/auth.proto b/pkg/proto/auth/auth.proto index 21b82ff40..592c4987e 100644 --- a/pkg/proto/auth/auth.proto +++ b/pkg/proto/auth/auth.proto @@ -1,33 +1,34 @@ syntax = "proto3"; +import "Open_IM/pkg/proto/sdk_ws/ws.proto"; package pbAuth; option go_package = "./auth;pbAuth"; -message UserRegisterReq { - string UID = 1; - string Name = 2; - string Icon = 3; - int32 Gender = 4; - string Mobile = 5; - string Birth = 6; - string Email = 7; - string Ex = 8; +message CommonResp{ + int32 errCode = 1; + string errMsg = 2; } -message UserRegisterResp { - bool Success = 1; +message UserRegisterReq { + open_im_sdk.UserInfo UserInfo = 1; + string OperationID = 2; } +message UserRegisterResp { + CommonResp CommonResp = 1; +} + message UserTokenReq { int32 Platform = 1; - string UID = 2; + string FromUserID = 2; + string OpUserID = 3; + string OperationID = 4; +} +message UserTokenResp { + CommonResp CommonResp = 1; + string Token = 2; + int64 ExpiredTime = 3; } -message UserTokenResp { - int32 ErrCode = 1; - string ErrMsg = 2; - string Token = 3; - int64 ExpiredTime = 4; -} service Auth { rpc UserRegister(UserRegisterReq) returns(UserRegisterResp); diff --git a/pkg/proto/user/user.pb.go b/pkg/proto/user/user.pb.go index 7a6744c06..e81e474a9 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 sdk_ws "Open_IM/pkg/proto/sdk_ws" import ( context "golang.org/x/net/context" @@ -24,8 +25,8 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type CommonResp struct { - ErrorCode int32 `protobuf:"varint,1,opt,name=errorCode" json:"errorCode,omitempty"` - ErrorMsg string `protobuf:"bytes,2,opt,name=errorMsg" json:"errorMsg,omitempty"` + ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -35,7 +36,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_04b52567a288fdb7, []int{0} + return fileDescriptor_user_119cb27841530cfa, []int{0} } func (m *CommonResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CommonResp.Unmarshal(m, b) @@ -55,23 +56,77 @@ func (m *CommonResp) XXX_DiscardUnknown() { var xxx_messageInfo_CommonResp proto.InternalMessageInfo -func (m *CommonResp) GetErrorCode() int32 { +func (m *CommonResp) GetErrCode() int32 { if m != nil { - return m.ErrorCode + return m.ErrCode } return 0 } -func (m *CommonResp) GetErrorMsg() string { +func (m *CommonResp) GetErrMsg() string { if m != nil { - return m.ErrorMsg + return m.ErrMsg + } + return "" +} + +type DeleteUsersReq struct { + DeleteUserIDList []string `protobuf:"bytes,2,rep,name=DeleteUserIDList" json:"DeleteUserIDList,omitempty"` + OpUserID string `protobuf:"bytes,3,opt,name=OpUserID" json:"OpUserID,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 *DeleteUsersReq) Reset() { *m = DeleteUsersReq{} } +func (m *DeleteUsersReq) String() string { return proto.CompactTextString(m) } +func (*DeleteUsersReq) ProtoMessage() {} +func (*DeleteUsersReq) Descriptor() ([]byte, []int) { + return fileDescriptor_user_119cb27841530cfa, []int{1} +} +func (m *DeleteUsersReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DeleteUsersReq.Unmarshal(m, b) +} +func (m *DeleteUsersReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DeleteUsersReq.Marshal(b, m, deterministic) +} +func (dst *DeleteUsersReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteUsersReq.Merge(dst, src) +} +func (m *DeleteUsersReq) XXX_Size() int { + return xxx_messageInfo_DeleteUsersReq.Size(m) +} +func (m *DeleteUsersReq) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteUsersReq.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteUsersReq proto.InternalMessageInfo + +func (m *DeleteUsersReq) GetDeleteUserIDList() []string { + if m != nil { + return m.DeleteUserIDList + } + return nil +} + +func (m *DeleteUsersReq) GetOpUserID() string { + if m != nil { + return m.OpUserID + } + return "" +} + +func (m *DeleteUsersReq) GetOperationID() string { + if m != nil { + return m.OperationID } return "" } type DeleteUsersResp struct { - CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` - FailedUidList []string `protobuf:"bytes,2,rep,name=failedUidList" json:"failedUidList,omitempty"` + CommonResp *CommonResp `protobuf:"bytes,1,opt,name=CommonResp" json:"CommonResp,omitempty"` + FailedUserIDList []string `protobuf:"bytes,2,rep,name=FailedUserIDList" json:"FailedUserIDList,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -81,7 +136,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_04b52567a288fdb7, []int{1} + return fileDescriptor_user_119cb27841530cfa, []int{2} } func (m *DeleteUsersResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteUsersResp.Unmarshal(m, b) @@ -108,163 +163,109 @@ func (m *DeleteUsersResp) GetCommonResp() *CommonResp { return nil } -func (m *DeleteUsersResp) GetFailedUidList() []string { +func (m *DeleteUsersResp) GetFailedUserIDList() []string { if m != nil { - return m.FailedUidList + return m.FailedUserIDList } return nil } -type DeleteUsersReq struct { - DeleteUidList []string `protobuf:"bytes,2,rep,name=deleteUidList" json:"deleteUidList,omitempty"` - Token string `protobuf:"bytes,3,opt,name=token" json:"token,omitempty"` - OperationID string `protobuf:"bytes,4,opt,name=OperationID" json:"OperationID,omitempty"` +type GetAllUserIDReq struct { + OpUserID string `protobuf:"bytes,1,opt,name=opUserID" json:"opUserID,omitempty"` + OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -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_04b52567a288fdb7, []int{2} +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_119cb27841530cfa, []int{3} } -func (m *DeleteUsersReq) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeleteUsersReq.Unmarshal(m, b) +func (m *GetAllUserIDReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetAllUserIDReq.Unmarshal(m, b) } -func (m *DeleteUsersReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeleteUsersReq.Marshal(b, m, deterministic) +func (m *GetAllUserIDReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetAllUserIDReq.Marshal(b, m, deterministic) } -func (dst *DeleteUsersReq) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteUsersReq.Merge(dst, src) +func (dst *GetAllUserIDReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAllUserIDReq.Merge(dst, src) } -func (m *DeleteUsersReq) XXX_Size() int { - return xxx_messageInfo_DeleteUsersReq.Size(m) +func (m *GetAllUserIDReq) XXX_Size() int { + return xxx_messageInfo_GetAllUserIDReq.Size(m) } -func (m *DeleteUsersReq) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteUsersReq.DiscardUnknown(m) +func (m *GetAllUserIDReq) XXX_DiscardUnknown() { + xxx_messageInfo_GetAllUserIDReq.DiscardUnknown(m) } -var xxx_messageInfo_DeleteUsersReq proto.InternalMessageInfo +var xxx_messageInfo_GetAllUserIDReq proto.InternalMessageInfo -func (m *DeleteUsersReq) GetDeleteUidList() []string { +func (m *GetAllUserIDReq) GetOpUserID() string { if m != nil { - return m.DeleteUidList - } - return nil -} - -func (m *DeleteUsersReq) GetToken() string { - if m != nil { - return m.Token + return m.OpUserID } return "" } -func (m *DeleteUsersReq) GetOperationID() string { +func (m *GetAllUserIDReq) GetOperationID() string { if m != nil { return m.OperationID } return "" } -type GetAllUsersUidReq struct { - Token string `protobuf:"bytes,2,opt,name=token" json:"token,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 *GetAllUsersUidReq) Reset() { *m = GetAllUsersUidReq{} } -func (m *GetAllUsersUidReq) String() string { return proto.CompactTextString(m) } -func (*GetAllUsersUidReq) ProtoMessage() {} -func (*GetAllUsersUidReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_04b52567a288fdb7, []int{3} -} -func (m *GetAllUsersUidReq) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetAllUsersUidReq.Unmarshal(m, b) -} -func (m *GetAllUsersUidReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetAllUsersUidReq.Marshal(b, m, deterministic) -} -func (dst *GetAllUsersUidReq) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAllUsersUidReq.Merge(dst, src) -} -func (m *GetAllUsersUidReq) XXX_Size() int { - return xxx_messageInfo_GetAllUsersUidReq.Size(m) -} -func (m *GetAllUsersUidReq) XXX_DiscardUnknown() { - xxx_messageInfo_GetAllUsersUidReq.DiscardUnknown(m) -} - -var xxx_messageInfo_GetAllUsersUidReq proto.InternalMessageInfo - -func (m *GetAllUsersUidReq) GetToken() string { - if m != nil { - return m.Token - } - return "" -} - -func (m *GetAllUsersUidReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - -type GetAllUsersUidResp struct { - CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` - UidList []string `protobuf:"bytes,2,rep,name=uidList" json:"uidList,omitempty"` +type GetAllUserIDResp struct { + CommonResp *CommonResp `protobuf:"bytes,1,opt,name=CommonResp" json:"CommonResp,omitempty"` + UserIDList []string `protobuf:"bytes,2,rep,name=UserIDList" json:"UserIDList,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *GetAllUsersUidResp) Reset() { *m = GetAllUsersUidResp{} } -func (m *GetAllUsersUidResp) String() string { return proto.CompactTextString(m) } -func (*GetAllUsersUidResp) ProtoMessage() {} -func (*GetAllUsersUidResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_04b52567a288fdb7, []int{4} +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_119cb27841530cfa, []int{4} } -func (m *GetAllUsersUidResp) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetAllUsersUidResp.Unmarshal(m, b) +func (m *GetAllUserIDResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetAllUserIDResp.Unmarshal(m, b) } -func (m *GetAllUsersUidResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetAllUsersUidResp.Marshal(b, m, deterministic) +func (m *GetAllUserIDResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetAllUserIDResp.Marshal(b, m, deterministic) } -func (dst *GetAllUsersUidResp) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetAllUsersUidResp.Merge(dst, src) +func (dst *GetAllUserIDResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetAllUserIDResp.Merge(dst, src) } -func (m *GetAllUsersUidResp) XXX_Size() int { - return xxx_messageInfo_GetAllUsersUidResp.Size(m) +func (m *GetAllUserIDResp) XXX_Size() int { + return xxx_messageInfo_GetAllUserIDResp.Size(m) } -func (m *GetAllUsersUidResp) XXX_DiscardUnknown() { - xxx_messageInfo_GetAllUsersUidResp.DiscardUnknown(m) +func (m *GetAllUserIDResp) XXX_DiscardUnknown() { + xxx_messageInfo_GetAllUserIDResp.DiscardUnknown(m) } -var xxx_messageInfo_GetAllUsersUidResp proto.InternalMessageInfo +var xxx_messageInfo_GetAllUserIDResp proto.InternalMessageInfo -func (m *GetAllUsersUidResp) GetCommonResp() *CommonResp { +func (m *GetAllUserIDResp) GetCommonResp() *CommonResp { if m != nil { return m.CommonResp } return nil } -func (m *GetAllUsersUidResp) GetUidList() []string { +func (m *GetAllUserIDResp) GetUserIDList() []string { if m != nil { - return m.UidList + return m.UserIDList } return nil } type AccountCheckReq struct { - UidList []string `protobuf:"bytes,1,rep,name=uidList" json:"uidList,omitempty"` - Token string `protobuf:"bytes,2,opt,name=token" json:"token,omitempty"` - OperationID string `protobuf:"bytes,3,opt,name=operationID" json:"operationID,omitempty"` + CheckUserIDList []string `protobuf:"bytes,1,rep,name=CheckUserIDList" json:"CheckUserIDList,omitempty"` + OpUserID string `protobuf:"bytes,2,opt,name=OpUserID" json:"OpUserID,omitempty"` + OperationID string `protobuf:"bytes,3,opt,name=OperationID" json:"OperationID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -274,7 +275,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_04b52567a288fdb7, []int{5} + return fileDescriptor_user_119cb27841530cfa, []int{5} } func (m *AccountCheckReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AccountCheckReq.Unmarshal(m, b) @@ -294,16 +295,16 @@ func (m *AccountCheckReq) XXX_DiscardUnknown() { var xxx_messageInfo_AccountCheckReq proto.InternalMessageInfo -func (m *AccountCheckReq) GetUidList() []string { +func (m *AccountCheckReq) GetCheckUserIDList() []string { if m != nil { - return m.UidList + return m.CheckUserIDList } return nil } -func (m *AccountCheckReq) GetToken() string { +func (m *AccountCheckReq) GetOpUserID() string { if m != nil { - return m.Token + return m.OpUserID } return "" } @@ -317,7 +318,7 @@ func (m *AccountCheckReq) GetOperationID() string { type AccountCheckResp struct { CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` - Result []*AccountCheckResp_SingleUserStatus `protobuf:"bytes,2,rep,name=result" json:"result,omitempty"` + ResultList []*AccountCheckResp_SingleUserStatus `protobuf:"bytes,2,rep,name=ResultList" json:"ResultList,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -327,7 +328,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_04b52567a288fdb7, []int{6} + return fileDescriptor_user_119cb27841530cfa, []int{6} } func (m *AccountCheckResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AccountCheckResp.Unmarshal(m, b) @@ -354,9 +355,9 @@ func (m *AccountCheckResp) GetCommonResp() *CommonResp { return nil } -func (m *AccountCheckResp) GetResult() []*AccountCheckResp_SingleUserStatus { +func (m *AccountCheckResp) GetResultList() []*AccountCheckResp_SingleUserStatus { if m != nil { - return m.Result + return m.ResultList } return nil } @@ -373,7 +374,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_04b52567a288fdb7, []int{6, 0} + return fileDescriptor_user_119cb27841530cfa, []int{6, 0} } func (m *AccountCheckResp_SingleUserStatus) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AccountCheckResp_SingleUserStatus.Unmarshal(m, b) @@ -409,7 +410,7 @@ func (m *AccountCheckResp_SingleUserStatus) GetAccountStatus() string { type GetUserInfoReq struct { UserIDList []string `protobuf:"bytes,1,rep,name=userIDList" json:"userIDList,omitempty"` - Token string `protobuf:"bytes,2,opt,name=token" json:"token,omitempty"` + OpUserID string `protobuf:"bytes,2,opt,name=OpUserID" json:"OpUserID,omitempty"` OperationID string `protobuf:"bytes,3,opt,name=OperationID" json:"OperationID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -420,7 +421,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_04b52567a288fdb7, []int{7} + return fileDescriptor_user_119cb27841530cfa, []int{7} } func (m *GetUserInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUserInfoReq.Unmarshal(m, b) @@ -447,9 +448,9 @@ func (m *GetUserInfoReq) GetUserIDList() []string { return nil } -func (m *GetUserInfoReq) GetToken() string { +func (m *GetUserInfoReq) GetOpUserID() string { if m != nil { - return m.Token + return m.OpUserID } return "" } @@ -462,19 +463,18 @@ func (m *GetUserInfoReq) GetOperationID() string { } type GetUserInfoResp struct { - ErrorCode int32 `protobuf:"varint,1,opt,name=errorCode" json:"errorCode,omitempty"` - ErrorMsg string `protobuf:"bytes,2,opt,name=errorMsg" json:"errorMsg,omitempty"` - Data []*UserInfo `protobuf:"bytes,3,rep,name=Data" json:"Data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` + UserInfoList []*sdk_ws.UserInfo `protobuf:"bytes,3,rep,name=UserInfoList" json:"UserInfoList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } 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_04b52567a288fdb7, []int{8} + return fileDescriptor_user_119cb27841530cfa, []int{8} } func (m *GetUserInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUserInfoResp.Unmarshal(m, b) @@ -494,188 +494,34 @@ func (m *GetUserInfoResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetUserInfoResp proto.InternalMessageInfo -func (m *GetUserInfoResp) GetErrorCode() int32 { +func (m *GetUserInfoResp) GetCommonResp() *CommonResp { if m != nil { - return m.ErrorCode - } - return 0 -} - -func (m *GetUserInfoResp) GetErrorMsg() string { - if m != nil { - return m.ErrorMsg - } - return "" -} - -func (m *GetUserInfoResp) GetData() []*UserInfo { - if m != nil { - return m.Data + return m.CommonResp } return nil } -type UserInfo struct { - Uid string `protobuf:"bytes,1,opt,name=uid" json:"uid,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` - Icon string `protobuf:"bytes,3,opt,name=icon" json:"icon,omitempty"` - Gender int32 `protobuf:"varint,4,opt,name=gender" json:"gender,omitempty"` - Mobile string `protobuf:"bytes,5,opt,name=mobile" json:"mobile,omitempty"` - Birth string `protobuf:"bytes,6,opt,name=birth" json:"birth,omitempty"` - Email string `protobuf:"bytes,7,opt,name=email" json:"email,omitempty"` - Ex string `protobuf:"bytes,8,opt,name=ex" json:"ex,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UserInfo) Reset() { *m = UserInfo{} } -func (m *UserInfo) String() string { return proto.CompactTextString(m) } -func (*UserInfo) ProtoMessage() {} -func (*UserInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_user_04b52567a288fdb7, []int{9} -} -func (m *UserInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UserInfo.Unmarshal(m, b) -} -func (m *UserInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UserInfo.Marshal(b, m, deterministic) -} -func (dst *UserInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_UserInfo.Merge(dst, src) -} -func (m *UserInfo) XXX_Size() int { - return xxx_messageInfo_UserInfo.Size(m) -} -func (m *UserInfo) XXX_DiscardUnknown() { - xxx_messageInfo_UserInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_UserInfo proto.InternalMessageInfo - -func (m *UserInfo) GetUid() string { +func (m *GetUserInfoResp) GetUserInfoList() []*sdk_ws.UserInfo { if m != nil { - return m.Uid + return m.UserInfoList } - return "" -} - -func (m *UserInfo) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *UserInfo) GetIcon() string { - if m != nil { - return m.Icon - } - return "" -} - -func (m *UserInfo) GetGender() int32 { - if m != nil { - return m.Gender - } - return 0 -} - -func (m *UserInfo) GetMobile() string { - if m != nil { - return m.Mobile - } - return "" -} - -func (m *UserInfo) GetBirth() string { - if m != nil { - return m.Birth - } - return "" -} - -func (m *UserInfo) GetEmail() string { - if m != nil { - return m.Email - } - return "" -} - -func (m *UserInfo) GetEx() string { - if m != nil { - return m.Ex - } - return "" -} - -type LogoutReq struct { - OperationID string `protobuf:"bytes,1,opt,name=OperationID" json:"OperationID,omitempty"` - Token string `protobuf:"bytes,2,opt,name=token" json:"token,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *LogoutReq) Reset() { *m = LogoutReq{} } -func (m *LogoutReq) String() string { return proto.CompactTextString(m) } -func (*LogoutReq) ProtoMessage() {} -func (*LogoutReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_04b52567a288fdb7, []int{10} -} -func (m *LogoutReq) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_LogoutReq.Unmarshal(m, b) -} -func (m *LogoutReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_LogoutReq.Marshal(b, m, deterministic) -} -func (dst *LogoutReq) XXX_Merge(src proto.Message) { - xxx_messageInfo_LogoutReq.Merge(dst, src) -} -func (m *LogoutReq) XXX_Size() int { - return xxx_messageInfo_LogoutReq.Size(m) -} -func (m *LogoutReq) XXX_DiscardUnknown() { - xxx_messageInfo_LogoutReq.DiscardUnknown(m) -} - -var xxx_messageInfo_LogoutReq proto.InternalMessageInfo - -func (m *LogoutReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - -func (m *LogoutReq) GetToken() string { - if m != nil { - return m.Token - } - return "" + return nil } type UpdateUserInfoReq struct { - Icon string `protobuf:"bytes,1,opt,name=icon" json:"icon,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` - Gender int32 `protobuf:"varint,3,opt,name=gender" json:"gender,omitempty"` - Mobile string `protobuf:"bytes,4,opt,name=mobile" json:"mobile,omitempty"` - Birth string `protobuf:"bytes,5,opt,name=birth" json:"birth,omitempty"` - Email string `protobuf:"bytes,6,opt,name=email" json:"email,omitempty"` - Ex string `protobuf:"bytes,7,opt,name=ex" json:"ex,omitempty"` - Token string `protobuf:"bytes,8,opt,name=token" json:"token,omitempty"` - OperationID string `protobuf:"bytes,9,opt,name=OperationID" json:"OperationID,omitempty"` - Uid string `protobuf:"bytes,10,opt,name=Uid" json:"Uid,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + UserInfo *sdk_ws.UserInfo `protobuf:"bytes,1,opt,name=UserInfo" json:"UserInfo,omitempty"` + OpUserID string `protobuf:"bytes,2,opt,name=OpUserID" json:"OpUserID,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 *UpdateUserInfoReq) Reset() { *m = UpdateUserInfoReq{} } func (m *UpdateUserInfoReq) String() string { return proto.CompactTextString(m) } func (*UpdateUserInfoReq) ProtoMessage() {} func (*UpdateUserInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_04b52567a288fdb7, []int{11} + return fileDescriptor_user_119cb27841530cfa, []int{9} } func (m *UpdateUserInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UpdateUserInfoReq.Unmarshal(m, b) @@ -695,58 +541,16 @@ func (m *UpdateUserInfoReq) XXX_DiscardUnknown() { var xxx_messageInfo_UpdateUserInfoReq proto.InternalMessageInfo -func (m *UpdateUserInfoReq) GetIcon() string { +func (m *UpdateUserInfoReq) GetUserInfo() *sdk_ws.UserInfo { if m != nil { - return m.Icon + return m.UserInfo } - return "" + return nil } -func (m *UpdateUserInfoReq) GetName() string { +func (m *UpdateUserInfoReq) GetOpUserID() string { if m != nil { - return m.Name - } - return "" -} - -func (m *UpdateUserInfoReq) GetGender() int32 { - if m != nil { - return m.Gender - } - return 0 -} - -func (m *UpdateUserInfoReq) GetMobile() string { - if m != nil { - return m.Mobile - } - return "" -} - -func (m *UpdateUserInfoReq) GetBirth() string { - if m != nil { - return m.Birth - } - return "" -} - -func (m *UpdateUserInfoReq) GetEmail() string { - if m != nil { - return m.Email - } - return "" -} - -func (m *UpdateUserInfoReq) GetEx() string { - if m != nil { - return m.Ex - } - return "" -} - -func (m *UpdateUserInfoReq) GetToken() string { - if m != nil { - return m.Token + return m.OpUserID } return "" } @@ -758,18 +562,50 @@ func (m *UpdateUserInfoReq) GetOperationID() string { return "" } -func (m *UpdateUserInfoReq) GetUid() string { +type UpdateUserInfoResp struct { + CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +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_119cb27841530cfa, []int{10} +} +func (m *UpdateUserInfoResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UpdateUserInfoResp.Unmarshal(m, b) +} +func (m *UpdateUserInfoResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UpdateUserInfoResp.Marshal(b, m, deterministic) +} +func (dst *UpdateUserInfoResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpdateUserInfoResp.Merge(dst, src) +} +func (m *UpdateUserInfoResp) XXX_Size() int { + return xxx_messageInfo_UpdateUserInfoResp.Size(m) +} +func (m *UpdateUserInfoResp) XXX_DiscardUnknown() { + xxx_messageInfo_UpdateUserInfoResp.DiscardUnknown(m) +} + +var xxx_messageInfo_UpdateUserInfoResp proto.InternalMessageInfo + +func (m *UpdateUserInfoResp) GetCommonResp() *CommonResp { if m != nil { - return m.Uid + return m.CommonResp } - return "" + return nil } type SetReceiveMessageOptReq struct { - UId string `protobuf:"bytes,1,opt,name=uId" json:"uId,omitempty"` + FromUserID string `protobuf:"bytes,1,opt,name=FromUserID" json:"FromUserID,omitempty"` Opt int32 `protobuf:"varint,2,opt,name=opt" json:"opt,omitempty"` - ConversationId []string `protobuf:"bytes,3,rep,name=conversationId" json:"conversationId,omitempty"` + ConversationIDList []string `protobuf:"bytes,3,rep,name=conversationIDList" json:"conversationIDList,omitempty"` OperationID string `protobuf:"bytes,4,opt,name=operationID" json:"operationID,omitempty"` + OpUserID string `protobuf:"bytes,5,opt,name=OpUserID" json:"OpUserID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -779,7 +615,7 @@ func (m *SetReceiveMessageOptReq) Reset() { *m = SetReceiveMessageOptReq func (m *SetReceiveMessageOptReq) String() string { return proto.CompactTextString(m) } func (*SetReceiveMessageOptReq) ProtoMessage() {} func (*SetReceiveMessageOptReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_04b52567a288fdb7, []int{12} + return fileDescriptor_user_119cb27841530cfa, []int{11} } func (m *SetReceiveMessageOptReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetReceiveMessageOptReq.Unmarshal(m, b) @@ -799,9 +635,9 @@ func (m *SetReceiveMessageOptReq) XXX_DiscardUnknown() { var xxx_messageInfo_SetReceiveMessageOptReq proto.InternalMessageInfo -func (m *SetReceiveMessageOptReq) GetUId() string { +func (m *SetReceiveMessageOptReq) GetFromUserID() string { if m != nil { - return m.UId + return m.FromUserID } return "" } @@ -813,9 +649,9 @@ func (m *SetReceiveMessageOptReq) GetOpt() int32 { return 0 } -func (m *SetReceiveMessageOptReq) GetConversationId() []string { +func (m *SetReceiveMessageOptReq) GetConversationIDList() []string { if m != nil { - return m.ConversationId + return m.ConversationIDList } return nil } @@ -827,110 +663,9 @@ func (m *SetReceiveMessageOptReq) GetOperationID() string { return "" } -type SetReceiveMessageOptResp struct { - ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"` - ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` - OptResult []*OptResult `protobuf:"bytes,3,rep,name=optResult" json:"optResult,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SetReceiveMessageOptResp) Reset() { *m = SetReceiveMessageOptResp{} } -func (m *SetReceiveMessageOptResp) String() string { return proto.CompactTextString(m) } -func (*SetReceiveMessageOptResp) ProtoMessage() {} -func (*SetReceiveMessageOptResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_04b52567a288fdb7, []int{13} -} -func (m *SetReceiveMessageOptResp) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SetReceiveMessageOptResp.Unmarshal(m, b) -} -func (m *SetReceiveMessageOptResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SetReceiveMessageOptResp.Marshal(b, m, deterministic) -} -func (dst *SetReceiveMessageOptResp) XXX_Merge(src proto.Message) { - xxx_messageInfo_SetReceiveMessageOptResp.Merge(dst, src) -} -func (m *SetReceiveMessageOptResp) XXX_Size() int { - return xxx_messageInfo_SetReceiveMessageOptResp.Size(m) -} -func (m *SetReceiveMessageOptResp) XXX_DiscardUnknown() { - xxx_messageInfo_SetReceiveMessageOptResp.DiscardUnknown(m) -} - -var xxx_messageInfo_SetReceiveMessageOptResp proto.InternalMessageInfo - -func (m *SetReceiveMessageOptResp) GetErrCode() int32 { +func (m *SetReceiveMessageOptReq) GetOpUserID() string { if m != nil { - return m.ErrCode - } - return 0 -} - -func (m *SetReceiveMessageOptResp) GetErrMsg() string { - if m != nil { - return m.ErrMsg - } - return "" -} - -func (m *SetReceiveMessageOptResp) GetOptResult() []*OptResult { - if m != nil { - return m.OptResult - } - return nil -} - -type GetReceiveMessageOptReq struct { - UId string `protobuf:"bytes,1,opt,name=uId" json:"uId,omitempty"` - ConversationId []string `protobuf:"bytes,2,rep,name=conversationId" json:"conversationId,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 *GetReceiveMessageOptReq) Reset() { *m = GetReceiveMessageOptReq{} } -func (m *GetReceiveMessageOptReq) String() string { return proto.CompactTextString(m) } -func (*GetReceiveMessageOptReq) ProtoMessage() {} -func (*GetReceiveMessageOptReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_04b52567a288fdb7, []int{14} -} -func (m *GetReceiveMessageOptReq) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetReceiveMessageOptReq.Unmarshal(m, b) -} -func (m *GetReceiveMessageOptReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetReceiveMessageOptReq.Marshal(b, m, deterministic) -} -func (dst *GetReceiveMessageOptReq) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetReceiveMessageOptReq.Merge(dst, src) -} -func (m *GetReceiveMessageOptReq) XXX_Size() int { - return xxx_messageInfo_GetReceiveMessageOptReq.Size(m) -} -func (m *GetReceiveMessageOptReq) XXX_DiscardUnknown() { - xxx_messageInfo_GetReceiveMessageOptReq.DiscardUnknown(m) -} - -var xxx_messageInfo_GetReceiveMessageOptReq proto.InternalMessageInfo - -func (m *GetReceiveMessageOptReq) GetUId() string { - if m != nil { - return m.UId - } - return "" -} - -func (m *GetReceiveMessageOptReq) GetConversationId() []string { - if m != nil { - return m.ConversationId - } - return nil -} - -func (m *GetReceiveMessageOptReq) GetOperationID() string { - if m != nil { - return m.OperationID + return m.OpUserID } return "" } @@ -947,7 +682,7 @@ func (m *OptResult) Reset() { *m = OptResult{} } func (m *OptResult) String() string { return proto.CompactTextString(m) } func (*OptResult) ProtoMessage() {} func (*OptResult) Descriptor() ([]byte, []int) { - return fileDescriptor_user_04b52567a288fdb7, []int{15} + return fileDescriptor_user_119cb27841530cfa, []int{12} } func (m *OptResult) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OptResult.Unmarshal(m, b) @@ -981,20 +716,127 @@ func (m *OptResult) GetResult() int32 { return 0 } +type SetReceiveMessageOptResp struct { + CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` + OptResultList []*OptResult `protobuf:"bytes,2,rep,name=optResultList" json:"optResultList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SetReceiveMessageOptResp) Reset() { *m = SetReceiveMessageOptResp{} } +func (m *SetReceiveMessageOptResp) String() string { return proto.CompactTextString(m) } +func (*SetReceiveMessageOptResp) ProtoMessage() {} +func (*SetReceiveMessageOptResp) Descriptor() ([]byte, []int) { + return fileDescriptor_user_119cb27841530cfa, []int{13} +} +func (m *SetReceiveMessageOptResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SetReceiveMessageOptResp.Unmarshal(m, b) +} +func (m *SetReceiveMessageOptResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SetReceiveMessageOptResp.Marshal(b, m, deterministic) +} +func (dst *SetReceiveMessageOptResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetReceiveMessageOptResp.Merge(dst, src) +} +func (m *SetReceiveMessageOptResp) XXX_Size() int { + return xxx_messageInfo_SetReceiveMessageOptResp.Size(m) +} +func (m *SetReceiveMessageOptResp) XXX_DiscardUnknown() { + xxx_messageInfo_SetReceiveMessageOptResp.DiscardUnknown(m) +} + +var xxx_messageInfo_SetReceiveMessageOptResp proto.InternalMessageInfo + +func (m *SetReceiveMessageOptResp) GetCommonResp() *CommonResp { + if m != nil { + return m.CommonResp + } + return nil +} + +func (m *SetReceiveMessageOptResp) GetOptResultList() []*OptResult { + if m != nil { + return m.OptResultList + } + return nil +} + +type GetReceiveMessageOptReq struct { + FromUserID string `protobuf:"bytes,1,opt,name=FromUserID" json:"FromUserID,omitempty"` + ConversationId []string `protobuf:"bytes,2,rep,name=conversationId" json:"conversationId,omitempty"` + OperationID string `protobuf:"bytes,3,opt,name=operationID" json:"operationID,omitempty"` + OpUserID string `protobuf:"bytes,4,opt,name=OpUserID" json:"OpUserID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetReceiveMessageOptReq) Reset() { *m = GetReceiveMessageOptReq{} } +func (m *GetReceiveMessageOptReq) String() string { return proto.CompactTextString(m) } +func (*GetReceiveMessageOptReq) ProtoMessage() {} +func (*GetReceiveMessageOptReq) Descriptor() ([]byte, []int) { + return fileDescriptor_user_119cb27841530cfa, []int{14} +} +func (m *GetReceiveMessageOptReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetReceiveMessageOptReq.Unmarshal(m, b) +} +func (m *GetReceiveMessageOptReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetReceiveMessageOptReq.Marshal(b, m, deterministic) +} +func (dst *GetReceiveMessageOptReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetReceiveMessageOptReq.Merge(dst, src) +} +func (m *GetReceiveMessageOptReq) XXX_Size() int { + return xxx_messageInfo_GetReceiveMessageOptReq.Size(m) +} +func (m *GetReceiveMessageOptReq) XXX_DiscardUnknown() { + xxx_messageInfo_GetReceiveMessageOptReq.DiscardUnknown(m) +} + +var xxx_messageInfo_GetReceiveMessageOptReq proto.InternalMessageInfo + +func (m *GetReceiveMessageOptReq) GetFromUserID() string { + if m != nil { + return m.FromUserID + } + return "" +} + +func (m *GetReceiveMessageOptReq) GetConversationId() []string { + if m != nil { + return m.ConversationId + } + return nil +} + +func (m *GetReceiveMessageOptReq) GetOperationID() string { + if m != nil { + return m.OperationID + } + return "" +} + +func (m *GetReceiveMessageOptReq) GetOpUserID() string { + if m != nil { + return m.OpUserID + } + return "" +} + type GetReceiveMessageOptResp struct { - ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"` - ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` - ConversationOptResult []*OptResult `protobuf:"bytes,3,rep,name=conversationOptResult" json:"conversationOptResult,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` + ConversationOptResultList []*OptResult `protobuf:"bytes,3,rep,name=conversationOptResultList" json:"conversationOptResultList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetReceiveMessageOptResp) Reset() { *m = GetReceiveMessageOptResp{} } func (m *GetReceiveMessageOptResp) String() string { return proto.CompactTextString(m) } func (*GetReceiveMessageOptResp) ProtoMessage() {} func (*GetReceiveMessageOptResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_04b52567a288fdb7, []int{16} + return fileDescriptor_user_119cb27841530cfa, []int{15} } func (m *GetReceiveMessageOptResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetReceiveMessageOptResp.Unmarshal(m, b) @@ -1014,30 +856,24 @@ func (m *GetReceiveMessageOptResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetReceiveMessageOptResp proto.InternalMessageInfo -func (m *GetReceiveMessageOptResp) GetErrCode() int32 { +func (m *GetReceiveMessageOptResp) GetCommonResp() *CommonResp { if m != nil { - return m.ErrCode + return m.CommonResp } - return 0 + return nil } -func (m *GetReceiveMessageOptResp) GetErrMsg() string { +func (m *GetReceiveMessageOptResp) GetConversationOptResultList() []*OptResult { if m != nil { - return m.ErrMsg - } - return "" -} - -func (m *GetReceiveMessageOptResp) GetConversationOptResult() []*OptResult { - if m != nil { - return m.ConversationOptResult + return m.ConversationOptResultList } return nil } type GetAllConversationMsgOptReq struct { - UId string `protobuf:"bytes,1,opt,name=uId" json:"uId,omitempty"` + FromUserId string `protobuf:"bytes,1,opt,name=FromUserId" json:"FromUserId,omitempty"` OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` + OpUserID string `protobuf:"bytes,3,opt,name=OpUserID" json:"OpUserID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1047,7 +883,7 @@ func (m *GetAllConversationMsgOptReq) Reset() { *m = GetAllConversationM func (m *GetAllConversationMsgOptReq) String() string { return proto.CompactTextString(m) } func (*GetAllConversationMsgOptReq) ProtoMessage() {} func (*GetAllConversationMsgOptReq) Descriptor() ([]byte, []int) { - return fileDescriptor_user_04b52567a288fdb7, []int{17} + return fileDescriptor_user_119cb27841530cfa, []int{16} } func (m *GetAllConversationMsgOptReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetAllConversationMsgOptReq.Unmarshal(m, b) @@ -1067,9 +903,9 @@ func (m *GetAllConversationMsgOptReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetAllConversationMsgOptReq proto.InternalMessageInfo -func (m *GetAllConversationMsgOptReq) GetUId() string { +func (m *GetAllConversationMsgOptReq) GetFromUserId() string { if m != nil { - return m.UId + return m.FromUserId } return "" } @@ -1081,20 +917,26 @@ func (m *GetAllConversationMsgOptReq) GetOperationID() string { return "" } +func (m *GetAllConversationMsgOptReq) GetOpUserID() string { + if m != nil { + return m.OpUserID + } + return "" +} + type GetAllConversationMsgOptResp struct { - ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"` - ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` - ConversationOptResult []*OptResult `protobuf:"bytes,3,rep,name=conversationOptResult" json:"conversationOptResult,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` + ConversationOptResultList []*OptResult `protobuf:"bytes,3,rep,name=conversationOptResultList" json:"conversationOptResultList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetAllConversationMsgOptResp) Reset() { *m = GetAllConversationMsgOptResp{} } func (m *GetAllConversationMsgOptResp) String() string { return proto.CompactTextString(m) } func (*GetAllConversationMsgOptResp) ProtoMessage() {} func (*GetAllConversationMsgOptResp) Descriptor() ([]byte, []int) { - return fileDescriptor_user_04b52567a288fdb7, []int{18} + return fileDescriptor_user_119cb27841530cfa, []int{17} } func (m *GetAllConversationMsgOptResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetAllConversationMsgOptResp.Unmarshal(m, b) @@ -1114,45 +956,37 @@ func (m *GetAllConversationMsgOptResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetAllConversationMsgOptResp proto.InternalMessageInfo -func (m *GetAllConversationMsgOptResp) GetErrCode() int32 { +func (m *GetAllConversationMsgOptResp) GetCommonResp() *CommonResp { if m != nil { - return m.ErrCode + return m.CommonResp } - return 0 + return nil } -func (m *GetAllConversationMsgOptResp) GetErrMsg() string { +func (m *GetAllConversationMsgOptResp) GetConversationOptResultList() []*OptResult { if m != nil { - return m.ErrMsg - } - return "" -} - -func (m *GetAllConversationMsgOptResp) GetConversationOptResult() []*OptResult { - if m != nil { - return m.ConversationOptResult + return m.ConversationOptResultList } return nil } func init() { proto.RegisterType((*CommonResp)(nil), "user.CommonResp") - proto.RegisterType((*DeleteUsersResp)(nil), "user.DeleteUsersResp") proto.RegisterType((*DeleteUsersReq)(nil), "user.DeleteUsersReq") - proto.RegisterType((*GetAllUsersUidReq)(nil), "user.GetAllUsersUidReq") - proto.RegisterType((*GetAllUsersUidResp)(nil), "user.GetAllUsersUidResp") + proto.RegisterType((*DeleteUsersResp)(nil), "user.DeleteUsersResp") + proto.RegisterType((*GetAllUserIDReq)(nil), "user.GetAllUserIDReq") + proto.RegisterType((*GetAllUserIDResp)(nil), "user.GetAllUserIDResp") proto.RegisterType((*AccountCheckReq)(nil), "user.AccountCheckReq") proto.RegisterType((*AccountCheckResp)(nil), "user.AccountCheckResp") proto.RegisterType((*AccountCheckResp_SingleUserStatus)(nil), "user.AccountCheckResp.SingleUserStatus") proto.RegisterType((*GetUserInfoReq)(nil), "user.GetUserInfoReq") proto.RegisterType((*GetUserInfoResp)(nil), "user.GetUserInfoResp") - proto.RegisterType((*UserInfo)(nil), "user.UserInfo") - proto.RegisterType((*LogoutReq)(nil), "user.LogoutReq") proto.RegisterType((*UpdateUserInfoReq)(nil), "user.UpdateUserInfoReq") + proto.RegisterType((*UpdateUserInfoResp)(nil), "user.UpdateUserInfoResp") proto.RegisterType((*SetReceiveMessageOptReq)(nil), "user.SetReceiveMessageOptReq") + proto.RegisterType((*OptResult)(nil), "user.OptResult") proto.RegisterType((*SetReceiveMessageOptResp)(nil), "user.SetReceiveMessageOptResp") proto.RegisterType((*GetReceiveMessageOptReq)(nil), "user.GetReceiveMessageOptReq") - proto.RegisterType((*OptResult)(nil), "user.OptResult") proto.RegisterType((*GetReceiveMessageOptResp)(nil), "user.GetReceiveMessageOptResp") proto.RegisterType((*GetAllConversationMsgOptReq)(nil), "user.GetAllConversationMsgOptReq") proto.RegisterType((*GetAllConversationMsgOptResp)(nil), "user.GetAllConversationMsgOptResp") @@ -1170,9 +1004,9 @@ const _ = grpc.SupportPackageIsVersion4 type UserClient interface { GetUserInfo(ctx context.Context, in *GetUserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResp, error) - UpdateUserInfo(ctx context.Context, in *UpdateUserInfoReq, opts ...grpc.CallOption) (*CommonResp, error) + UpdateUserInfo(ctx context.Context, in *UpdateUserInfoReq, opts ...grpc.CallOption) (*UpdateUserInfoResp, error) DeleteUsers(ctx context.Context, in *DeleteUsersReq, opts ...grpc.CallOption) (*DeleteUsersResp, error) - GetAllUsersUid(ctx context.Context, in *GetAllUsersUidReq, opts ...grpc.CallOption) (*GetAllUsersUidResp, error) + GetAllUserID(ctx context.Context, in *GetAllUserIDReq, opts ...grpc.CallOption) (*GetAllUserIDResp, error) SetReceiveMessageOpt(ctx context.Context, in *SetReceiveMessageOptReq, opts ...grpc.CallOption) (*SetReceiveMessageOptResp, error) GetReceiveMessageOpt(ctx context.Context, in *GetReceiveMessageOptReq, opts ...grpc.CallOption) (*GetReceiveMessageOptResp, error) GetAllConversationMsgOpt(ctx context.Context, in *GetAllConversationMsgOptReq, opts ...grpc.CallOption) (*GetAllConversationMsgOptResp, error) @@ -1189,15 +1023,15 @@ func NewUserClient(cc *grpc.ClientConn) UserClient { func (c *userClient) GetUserInfo(ctx context.Context, in *GetUserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResp, error) { out := new(GetUserInfoResp) - err := grpc.Invoke(ctx, "/user.user/getUserInfo", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/user.user/GetUserInfo", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -func (c *userClient) UpdateUserInfo(ctx context.Context, in *UpdateUserInfoReq, opts ...grpc.CallOption) (*CommonResp, error) { - out := new(CommonResp) +func (c *userClient) UpdateUserInfo(ctx context.Context, in *UpdateUserInfoReq, opts ...grpc.CallOption) (*UpdateUserInfoResp, error) { + out := new(UpdateUserInfoResp) err := grpc.Invoke(ctx, "/user.user/UpdateUserInfo", in, out, c.cc, opts...) if err != nil { return nil, err @@ -1214,9 +1048,9 @@ func (c *userClient) DeleteUsers(ctx context.Context, in *DeleteUsersReq, opts . return out, nil } -func (c *userClient) GetAllUsersUid(ctx context.Context, in *GetAllUsersUidReq, opts ...grpc.CallOption) (*GetAllUsersUidResp, error) { - out := new(GetAllUsersUidResp) - err := grpc.Invoke(ctx, "/user.user/GetAllUsersUid", in, out, c.cc, opts...) +func (c *userClient) GetAllUserID(ctx context.Context, in *GetAllUserIDReq, opts ...grpc.CallOption) (*GetAllUserIDResp, error) { + out := new(GetAllUserIDResp) + err := grpc.Invoke(ctx, "/user.user/GetAllUserID", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -1263,9 +1097,9 @@ func (c *userClient) AccountCheck(ctx context.Context, in *AccountCheckReq, opts type UserServer interface { GetUserInfo(context.Context, *GetUserInfoReq) (*GetUserInfoResp, error) - UpdateUserInfo(context.Context, *UpdateUserInfoReq) (*CommonResp, error) + UpdateUserInfo(context.Context, *UpdateUserInfoReq) (*UpdateUserInfoResp, error) DeleteUsers(context.Context, *DeleteUsersReq) (*DeleteUsersResp, error) - GetAllUsersUid(context.Context, *GetAllUsersUidReq) (*GetAllUsersUidResp, error) + GetAllUserID(context.Context, *GetAllUserIDReq) (*GetAllUserIDResp, error) SetReceiveMessageOpt(context.Context, *SetReceiveMessageOptReq) (*SetReceiveMessageOptResp, error) GetReceiveMessageOpt(context.Context, *GetReceiveMessageOptReq) (*GetReceiveMessageOptResp, error) GetAllConversationMsgOpt(context.Context, *GetAllConversationMsgOptReq) (*GetAllConversationMsgOptResp, error) @@ -1330,20 +1164,20 @@ func _User_DeleteUsers_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } -func _User_GetAllUsersUid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetAllUsersUidReq) +func _User_GetAllUserID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAllUserIDReq) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(UserServer).GetAllUsersUid(ctx, in) + return srv.(UserServer).GetAllUserID(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/user.user/GetAllUsersUid", + FullMethod: "/user.user/GetAllUserID", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UserServer).GetAllUsersUid(ctx, req.(*GetAllUsersUidReq)) + return srv.(UserServer).GetAllUserID(ctx, req.(*GetAllUserIDReq)) } return interceptor(ctx, in, info, handler) } @@ -1425,7 +1259,7 @@ var _User_serviceDesc = grpc.ServiceDesc{ HandlerType: (*UserServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "getUserInfo", + MethodName: "GetUserInfo", Handler: _User_GetUserInfo_Handler, }, { @@ -1437,8 +1271,8 @@ var _User_serviceDesc = grpc.ServiceDesc{ Handler: _User_DeleteUsers_Handler, }, { - MethodName: "GetAllUsersUid", - Handler: _User_GetAllUsersUid_Handler, + MethodName: "GetAllUserID", + Handler: _User_GetAllUserID_Handler, }, { MethodName: "SetReceiveMessageOpt", @@ -1461,64 +1295,60 @@ var _User_serviceDesc = grpc.ServiceDesc{ Metadata: "user/user.proto", } -func init() { proto.RegisterFile("user/user.proto", fileDescriptor_user_04b52567a288fdb7) } +func init() { proto.RegisterFile("user/user.proto", fileDescriptor_user_119cb27841530cfa) } -var fileDescriptor_user_04b52567a288fdb7 = []byte{ - // 896 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xdd, 0x6e, 0xdb, 0x36, - 0x14, 0x86, 0xfc, 0x17, 0xeb, 0x78, 0xb1, 0x1d, 0x22, 0x3f, 0x82, 0x96, 0x05, 0x1e, 0x31, 0x6c, - 0xb9, 0x99, 0x37, 0x64, 0x77, 0x0b, 0x86, 0x21, 0xb5, 0x5b, 0xc3, 0x48, 0x02, 0xb7, 0x0a, 0x7c, - 0xd3, 0xab, 0x2a, 0x12, 0xe3, 0x08, 0x91, 0x45, 0x45, 0x3f, 0x41, 0x80, 0x3e, 0x40, 0x1f, 0xa0, - 0x17, 0x7d, 0x8d, 0x3e, 0x4a, 0xef, 0xfa, 0x1c, 0x7d, 0x83, 0x82, 0xa4, 0x64, 0x53, 0x3f, 0x76, - 0x82, 0xb4, 0x40, 0x6f, 0x04, 0x9e, 0x43, 0xf2, 0x3b, 0xfc, 0x3e, 0x1e, 0x1e, 0x1d, 0xe8, 0xc4, - 0x21, 0x09, 0xfe, 0x62, 0x9f, 0xbe, 0x1f, 0xd0, 0x88, 0xa2, 0x1a, 0x1b, 0xe3, 0x17, 0x00, 0x03, - 0x3a, 0x9f, 0x53, 0xcf, 0x20, 0xa1, 0x8f, 0xf6, 0x41, 0x25, 0x41, 0x40, 0x83, 0x01, 0xb5, 0x89, - 0xa6, 0xf4, 0x94, 0xc3, 0xba, 0xb1, 0x74, 0x20, 0x1d, 0x9a, 0xdc, 0x38, 0x0f, 0x67, 0x5a, 0xa5, - 0xa7, 0x1c, 0xaa, 0xc6, 0xc2, 0xc6, 0x0e, 0x74, 0x86, 0xc4, 0x25, 0x11, 0x99, 0x86, 0x24, 0x08, - 0x39, 0xd8, 0xdf, 0x00, 0xd6, 0x02, 0x9a, 0xa3, 0xb5, 0x8e, 0xba, 0x7d, 0x7e, 0x82, 0x65, 0x48, - 0x43, 0x5a, 0x83, 0x7e, 0x83, 0xcd, 0x2b, 0xd3, 0x71, 0x89, 0x3d, 0x75, 0xec, 0x33, 0x27, 0x8c, - 0xb4, 0x4a, 0xaf, 0x7a, 0xa8, 0x1a, 0x59, 0x27, 0xf6, 0xa0, 0x9d, 0x09, 0x75, 0xcb, 0xf6, 0xd9, - 0xc2, 0x93, 0xdd, 0x97, 0x71, 0xa2, 0x6d, 0xa8, 0x47, 0xf4, 0x86, 0x78, 0x5a, 0x95, 0x9f, 0x5d, - 0x18, 0xa8, 0x07, 0xad, 0x89, 0x4f, 0x02, 0x33, 0x72, 0xa8, 0x37, 0x1e, 0x6a, 0x35, 0x3e, 0x27, - 0xbb, 0xf0, 0x29, 0x6c, 0x8d, 0x48, 0x74, 0xe2, 0xba, 0x3c, 0xde, 0xd4, 0xb1, 0x59, 0xc8, 0x05, - 0x58, 0x25, 0x07, 0x46, 0x25, 0x30, 0x11, 0x48, 0x76, 0xe1, 0x37, 0x80, 0xf2, 0x60, 0x4f, 0x92, - 0x4a, 0x83, 0x8d, 0x38, 0x43, 0x36, 0x35, 0xb1, 0x05, 0x9d, 0x13, 0xcb, 0xa2, 0xb1, 0x17, 0x0d, - 0xae, 0x89, 0x75, 0xc3, 0x0e, 0x2b, 0x2d, 0x56, 0x32, 0x8b, 0x9f, 0x4c, 0xe3, 0xb3, 0x02, 0xdd, - 0x6c, 0x94, 0x27, 0xb1, 0xf8, 0x1f, 0x1a, 0x01, 0x09, 0x63, 0x57, 0x90, 0x68, 0x1d, 0xfd, 0x21, - 0x56, 0xe7, 0x91, 0xfb, 0x17, 0x8e, 0x37, 0x73, 0xf9, 0x7d, 0x5f, 0x44, 0x66, 0x14, 0x87, 0x46, - 0xb2, 0x4d, 0x7f, 0x09, 0xdd, 0xfc, 0x1c, 0xda, 0x85, 0x06, 0x43, 0x19, 0x0f, 0xf9, 0x11, 0x54, - 0x23, 0xb1, 0x58, 0x96, 0x98, 0x02, 0x58, 0x2c, 0x4c, 0x38, 0x67, 0x9d, 0xf8, 0x1a, 0xda, 0x23, - 0x12, 0x31, 0xb8, 0xb1, 0x77, 0x45, 0x99, 0x7a, 0x07, 0x00, 0x02, 0x41, 0x12, 0x50, 0xf2, 0xac, - 0xd6, 0x70, 0x52, 0xd4, 0x50, 0xce, 0x2b, 0x0a, 0x9d, 0x4c, 0xa4, 0x6f, 0x79, 0x7f, 0x08, 0x43, - 0x6d, 0x68, 0x46, 0xa6, 0x56, 0xe5, 0x3a, 0xb6, 0x85, 0x8e, 0x0b, 0x6c, 0x3e, 0x87, 0x3f, 0x2a, - 0xd0, 0x4c, 0x5d, 0xa8, 0x0b, 0xd5, 0xd8, 0xb1, 0x13, 0x89, 0xd8, 0x10, 0x21, 0xa8, 0x79, 0xe6, - 0x9c, 0x24, 0xd0, 0x7c, 0xcc, 0x7c, 0x8e, 0x45, 0xd3, 0x27, 0xc3, 0xc7, 0x4c, 0xdf, 0x19, 0xf1, - 0x6c, 0x12, 0xf0, 0xc7, 0x52, 0x37, 0x12, 0x8b, 0xf9, 0xe7, 0xf4, 0xd2, 0x71, 0x89, 0x56, 0x17, - 0xba, 0x0b, 0x8b, 0xe9, 0x73, 0xe9, 0x04, 0xd1, 0xb5, 0xd6, 0x10, 0xfa, 0x70, 0x83, 0x79, 0xc9, - 0xdc, 0x74, 0x5c, 0x6d, 0x43, 0x78, 0xb9, 0x81, 0xda, 0x50, 0x21, 0xf7, 0x5a, 0x93, 0xbb, 0x2a, - 0xe4, 0x1e, 0x0f, 0x40, 0x3d, 0xa3, 0x33, 0x1a, 0x47, 0xec, 0x22, 0x72, 0x92, 0x2a, 0x05, 0x49, - 0xcb, 0xaf, 0x02, 0x7f, 0x51, 0x60, 0x6b, 0xea, 0xdb, 0xa6, 0xa8, 0x18, 0xe9, 0xb5, 0xa6, 0xd4, - 0x14, 0x89, 0x5a, 0x99, 0x04, 0x4b, 0xba, 0xd5, 0x15, 0x74, 0x6b, 0xe5, 0x74, 0xeb, 0xa5, 0x74, - 0x1b, 0x45, 0xba, 0x1b, 0x29, 0xdd, 0xe5, 0xf9, 0x9b, 0x6b, 0x52, 0x49, 0x2d, 0xf2, 0xee, 0x42, - 0x75, 0xea, 0xd8, 0x1a, 0x88, 0xcb, 0x9c, 0x3a, 0x36, 0x7e, 0xa7, 0xc0, 0xde, 0x05, 0x89, 0x0c, - 0x62, 0x11, 0xe7, 0x8e, 0x9c, 0x93, 0x30, 0x34, 0x67, 0x64, 0xe2, 0x73, 0x1d, 0xd9, 0xd5, 0x8f, - 0x97, 0x57, 0x3f, 0xb6, 0x99, 0x87, 0xfa, 0x11, 0xa7, 0x5d, 0x37, 0xd8, 0x10, 0xfd, 0x0e, 0x6d, - 0x8b, 0x7a, 0x77, 0x24, 0x08, 0x45, 0x0c, 0x9b, 0x67, 0x96, 0x6a, 0xe4, 0xbc, 0xf9, 0x52, 0x51, - 0x2b, 0x96, 0x8a, 0xb7, 0xa0, 0x95, 0x1f, 0x44, 0x54, 0x31, 0x12, 0xc8, 0xd9, 0x9e, 0x9a, 0x4c, - 0x5d, 0x12, 0x48, 0x99, 0x9e, 0x58, 0xe8, 0x4f, 0x50, 0x29, 0xdf, 0xcc, 0x8a, 0x86, 0x48, 0xf6, - 0x8e, 0x48, 0xf6, 0x49, 0xea, 0x36, 0x96, 0x2b, 0x70, 0x0c, 0x7b, 0xa3, 0x47, 0xab, 0x50, 0xe4, - 0x5c, 0x79, 0x0c, 0xe7, 0x92, 0xf2, 0x78, 0x0a, 0xea, 0xe2, 0x38, 0x25, 0xb0, 0x22, 0x66, 0x1e, - 0x76, 0x57, 0x2a, 0x86, 0x3c, 0xd1, 0x84, 0x85, 0xdf, 0x2b, 0xa0, 0x8d, 0xbe, 0x9f, 0x82, 0xcf, - 0x61, 0x47, 0x0e, 0x3c, 0x79, 0x48, 0xcd, 0xf2, 0xd5, 0xf8, 0x15, 0xfc, 0x2c, 0x7e, 0x64, 0x03, - 0x69, 0xfa, 0x3c, 0x9c, 0xad, 0x54, 0x37, 0xa7, 0x5a, 0xa5, 0xa8, 0xda, 0x07, 0x05, 0xf6, 0x57, - 0x63, 0xfe, 0x40, 0xb2, 0x47, 0x9f, 0x6a, 0xc0, 0xdb, 0x25, 0xf4, 0x2f, 0xb4, 0x66, 0xcb, 0x9a, - 0x8d, 0xb6, 0xc5, 0xfe, 0xec, 0x0f, 0x43, 0xdf, 0x29, 0xf1, 0x86, 0x3e, 0x3a, 0x86, 0x76, 0xb6, - 0x0a, 0xa1, 0xbd, 0xa4, 0x4c, 0xe7, 0x6b, 0x93, 0x5e, 0xf8, 0x6b, 0xb2, 0xc0, 0x52, 0xd3, 0x93, - 0x06, 0xce, 0xf6, 0x41, 0x69, 0xe0, 0x7c, 0x23, 0x36, 0xe0, 0xbf, 0x34, 0xa9, 0xe7, 0x48, 0x03, - 0x17, 0xda, 0x1a, 0x5d, 0x2b, 0x9f, 0x08, 0x7d, 0x34, 0x85, 0xed, 0xb2, 0x67, 0x8c, 0x7e, 0x11, - 0x3b, 0x56, 0xd4, 0x1a, 0xfd, 0x60, 0xdd, 0xb4, 0x80, 0x1d, 0xad, 0x81, 0x1d, 0xad, 0x87, 0x5d, - 0xf9, 0x2c, 0x4c, 0xfe, 0x64, 0x4a, 0x33, 0x09, 0xfd, 0x2a, 0x73, 0x2c, 0xcd, 0x5e, 0x1d, 0x3f, - 0xb4, 0x24, 0xf4, 0xd1, 0x7f, 0xf0, 0x93, 0xdc, 0xa7, 0xa0, 0x9d, 0xb2, 0xde, 0xe5, 0x56, 0xdf, - 0x2d, 0x6f, 0x69, 0x9e, 0x6d, 0xbe, 0x6e, 0xf5, 0x79, 0x3b, 0x7e, 0xcc, 0x3e, 0x97, 0x0d, 0xde, - 0x94, 0xff, 0xf3, 0x35, 0x00, 0x00, 0xff, 0xff, 0x24, 0xd7, 0xfe, 0x0d, 0xa7, 0x0b, 0x00, 0x00, +var fileDescriptor_user_119cb27841530cfa = []byte{ + // 825 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xdf, 0x6e, 0xd3, 0x3e, + 0x14, 0x56, 0xd6, 0x6e, 0xbf, 0xf5, 0x74, 0x6b, 0xfb, 0xb3, 0xf6, 0x27, 0x04, 0x98, 0x3a, 0x0b, + 0x41, 0xb5, 0x8b, 0x14, 0x86, 0xb8, 0x00, 0x04, 0xd2, 0xe8, 0xb4, 0x68, 0x82, 0xaa, 0x28, 0xd3, + 0x6e, 0xb8, 0x99, 0x42, 0x63, 0x4a, 0xd5, 0x36, 0x0e, 0x71, 0xba, 0x09, 0x90, 0xb8, 0x81, 0xb7, + 0xe0, 0x82, 0xe7, 0xe0, 0x35, 0x78, 0x01, 0x5e, 0x05, 0xc5, 0x4e, 0x5a, 0x3b, 0x49, 0x5b, 0x54, + 0xb8, 0xe0, 0xa6, 0xaa, 0x3f, 0x1f, 0x1f, 0x7f, 0xdf, 0xe7, 0x63, 0xe7, 0x40, 0x75, 0xcc, 0x48, + 0xd0, 0x8c, 0x7e, 0x4c, 0x3f, 0xa0, 0x21, 0x45, 0xc5, 0xe8, 0xbf, 0xb1, 0xdf, 0xf1, 0x89, 0x77, + 0x71, 0xda, 0x6e, 0xfa, 0x83, 0x5e, 0x93, 0x4f, 0x34, 0x99, 0x3b, 0xb8, 0xb8, 0x62, 0xcd, 0x2b, + 0x26, 0x02, 0xf1, 0x53, 0x80, 0x16, 0x1d, 0x8d, 0xa8, 0x67, 0x13, 0xe6, 0x23, 0x1d, 0xfe, 0x23, + 0x41, 0xd0, 0xa2, 0x2e, 0xd1, 0xb5, 0xba, 0xd6, 0x58, 0xb5, 0x93, 0x21, 0xda, 0x81, 0x35, 0x12, + 0x04, 0x6d, 0xd6, 0xd3, 0x57, 0xea, 0x5a, 0xa3, 0x64, 0xc7, 0x23, 0xfc, 0x01, 0x2a, 0xc7, 0x64, + 0x48, 0x42, 0x72, 0xce, 0x48, 0xc0, 0x6c, 0xf2, 0x0e, 0x1d, 0x40, 0x6d, 0x8a, 0x9c, 0x1e, 0xbf, + 0xe8, 0xb3, 0x50, 0x5f, 0xa9, 0x17, 0x1a, 0x25, 0x3b, 0x83, 0x23, 0x03, 0xd6, 0x3b, 0xbe, 0x18, + 0xeb, 0x05, 0x9e, 0x77, 0x32, 0x46, 0x75, 0x28, 0x77, 0x7c, 0x12, 0x38, 0x61, 0x9f, 0x7a, 0xa7, + 0xc7, 0x7a, 0x91, 0x4f, 0xcb, 0x10, 0xa6, 0x50, 0x55, 0xf6, 0x66, 0x3e, 0xba, 0x2b, 0xcb, 0xe1, + 0x1a, 0xca, 0x87, 0x35, 0x93, 0x1b, 0x33, 0xc5, 0x6d, 0x59, 0xf2, 0x01, 0xd4, 0x4e, 0x9c, 0xfe, + 0x90, 0xb8, 0x59, 0xba, 0x69, 0x1c, 0x77, 0xa0, 0x6a, 0x91, 0xf0, 0x68, 0x38, 0x14, 0x58, 0xa4, + 0xd6, 0x80, 0x75, 0x9a, 0x28, 0xd0, 0x84, 0x02, 0x2a, 0x29, 0xa0, 0x92, 0x02, 0x61, 0x9c, 0x0c, + 0x61, 0x17, 0x6a, 0x6a, 0xc2, 0xa5, 0x24, 0xec, 0x01, 0x64, 0xc8, 0x4b, 0x08, 0x7e, 0x0f, 0xd5, + 0xa3, 0x6e, 0x97, 0x8e, 0xbd, 0xb0, 0xf5, 0x96, 0x74, 0x07, 0x11, 0xed, 0x06, 0x54, 0xf9, 0x7f, + 0x69, 0x9d, 0xc6, 0xd7, 0xa5, 0x61, 0xe5, 0x88, 0x56, 0xe6, 0x1f, 0x51, 0x21, 0x7b, 0x44, 0x3f, + 0x35, 0xa8, 0xa9, 0x7b, 0x0b, 0x85, 0xdd, 0xdf, 0x50, 0x38, 0x8d, 0x41, 0x16, 0x80, 0x4d, 0xd8, + 0x78, 0x18, 0x4e, 0x14, 0x96, 0x0f, 0xef, 0x88, 0x15, 0xe9, 0xec, 0xe6, 0x59, 0xdf, 0xeb, 0x0d, + 0x79, 0x49, 0x9c, 0x85, 0x4e, 0x38, 0x66, 0xb6, 0xb4, 0xd4, 0x78, 0x09, 0xb5, 0xf4, 0x7c, 0x54, + 0xda, 0x63, 0xf9, 0x00, 0xe3, 0x11, 0xba, 0x05, 0x9b, 0x8e, 0x48, 0x2e, 0x02, 0x63, 0xf9, 0x2a, + 0x88, 0x3d, 0xa8, 0x58, 0x24, 0xe4, 0x86, 0x78, 0x6f, 0x68, 0xe4, 0xed, 0x1e, 0xc0, 0x38, 0x6d, + 0xab, 0x84, 0xfc, 0xa1, 0xa3, 0x9f, 0x78, 0x0d, 0x4e, 0xf7, 0x5b, 0xca, 0xcf, 0x87, 0xb0, 0x91, + 0x64, 0xe0, 0x24, 0x0b, 0xdc, 0xd1, 0x6d, 0x93, 0x46, 0xef, 0x45, 0x7f, 0x74, 0xc1, 0xdc, 0x81, + 0x39, 0xd9, 0x42, 0x09, 0xc5, 0x5f, 0x34, 0xf8, 0xff, 0xdc, 0x77, 0x9d, 0xf8, 0x1e, 0xc7, 0x9a, + 0xef, 0xc1, 0x7a, 0x32, 0x8c, 0x09, 0xcc, 0x48, 0x36, 0x09, 0x5b, 0x64, 0x03, 0xcd, 0xda, 0x20, + 0xdf, 0x9c, 0x13, 0x40, 0x69, 0x16, 0xcb, 0x38, 0x81, 0xbf, 0x6b, 0xb0, 0x7b, 0x46, 0x42, 0x9b, + 0x74, 0x49, 0xff, 0x92, 0xb4, 0x09, 0x63, 0x4e, 0x8f, 0x74, 0xfc, 0x30, 0x3e, 0xc8, 0x93, 0x80, + 0x8e, 0x94, 0xdb, 0x2d, 0x21, 0xa8, 0x06, 0x05, 0xea, 0x87, 0x9c, 0xfc, 0xaa, 0x1d, 0xfd, 0x45, + 0x26, 0xa0, 0x2e, 0xf5, 0x2e, 0x49, 0xc0, 0x62, 0x9e, 0x13, 0x77, 0x4b, 0x76, 0xce, 0x4c, 0x5a, + 0x67, 0x31, 0xa3, 0x53, 0x71, 0x69, 0x55, 0x75, 0x09, 0x3f, 0x87, 0x12, 0x67, 0x1a, 0x55, 0x37, + 0xba, 0x0d, 0x15, 0x65, 0x03, 0x37, 0x26, 0x9c, 0x42, 0xa3, 0x6a, 0x0f, 0xf8, 0x8a, 0x98, 0x77, + 0x3c, 0xc2, 0x9f, 0x35, 0xd0, 0xf3, 0x8d, 0x58, 0xaa, 0xc2, 0x1e, 0xc0, 0x26, 0x4d, 0xb8, 0x49, + 0x97, 0xb6, 0x2a, 0x16, 0x4d, 0x68, 0xdb, 0x6a, 0x14, 0xfe, 0xa6, 0xc1, 0xae, 0xb5, 0xe4, 0x71, + 0x64, 0x1d, 0x10, 0x4f, 0x61, 0xda, 0x81, 0x85, 0xc5, 0xa5, 0x98, 0x5e, 0x4c, 0x99, 0xfe, 0x55, + 0x03, 0xdd, 0xfa, 0x7b, 0x3e, 0xb5, 0xe1, 0x9a, 0x4c, 0xaf, 0xa3, 0x78, 0x56, 0xc8, 0xf7, 0x6c, + 0xf6, 0x0a, 0xfc, 0x11, 0xae, 0x8b, 0x0f, 0x4a, 0x4b, 0x0a, 0x69, 0xb3, 0x5e, 0x8e, 0x85, 0x6e, + 0xc6, 0x42, 0x77, 0xf1, 0x17, 0x6b, 0xde, 0x17, 0x3b, 0x3a, 0xbc, 0x1b, 0xb3, 0x77, 0xff, 0x07, + 0xec, 0x39, 0xfc, 0x51, 0x04, 0xde, 0x19, 0xa1, 0x47, 0x50, 0x96, 0x5e, 0x51, 0xb4, 0x25, 0x72, + 0xa8, 0x0f, 0xb9, 0xb1, 0x9d, 0x83, 0x32, 0x1f, 0xb5, 0xa0, 0xa2, 0x3e, 0x3d, 0x68, 0x57, 0x04, + 0x66, 0x9e, 0x45, 0x43, 0xcf, 0x9f, 0x60, 0x7e, 0x44, 0x40, 0xea, 0x5d, 0x12, 0x02, 0x6a, 0x2b, + 0x95, 0x10, 0x48, 0x37, 0x39, 0x4f, 0x60, 0x43, 0xee, 0x1a, 0xd0, 0x94, 0xa7, 0xdc, 0x9a, 0x18, + 0x3b, 0x79, 0x30, 0xf3, 0xd1, 0x39, 0x6c, 0xe5, 0x5d, 0x74, 0x74, 0x53, 0xc4, 0xcf, 0x78, 0x0d, + 0x8d, 0xbd, 0x79, 0xd3, 0x22, 0xad, 0x35, 0x27, 0xad, 0x35, 0x3f, 0xed, 0xcc, 0x2b, 0xe5, 0xf0, + 0xeb, 0x96, 0x5b, 0x53, 0x68, 0x5f, 0x56, 0x98, 0x5b, 0xf1, 0x06, 0x5e, 0x14, 0x22, 0xfc, 0x94, + 0xbb, 0x88, 0xc4, 0xcf, 0x54, 0xcf, 0x94, 0xf8, 0x99, 0x6e, 0x38, 0x9e, 0x6d, 0xbe, 0x2a, 0x9b, + 0xbc, 0xf7, 0x7e, 0x1c, 0xfd, 0xbc, 0x5e, 0xe3, 0x8d, 0xf5, 0xfd, 0x5f, 0x01, 0x00, 0x00, 0xff, + 0xff, 0x24, 0xc8, 0xbf, 0xca, 0x94, 0x0b, 0x00, 0x00, } diff --git a/pkg/proto/user/user.proto b/pkg/proto/user/user.proto index e3c6ddffe..2efd32ae4 100644 --- a/pkg/proto/user/user.proto +++ b/pkg/proto/user/user.proto @@ -1,34 +1,38 @@ syntax = "proto3"; +import "Open_IM/pkg/proto/sdk_ws/ws.proto"; option go_package = "./user;user"; package user; message CommonResp{ - int32 errorCode = 1; - string errorMsg = 2; -} -message DeleteUsersResp{ - CommonResp commonResp = 1; - repeated string failedUidList = 2; + int32 errCode = 1; + string errMsg = 2; } + message DeleteUsersReq{ - repeated string deleteUidList = 2; - string token = 3; + repeated string DeleteUserIDList = 2; + string OpUserID = 3; string OperationID = 4; } -message GetAllUsersUidReq{ - string token = 2; - string operationID = 3; - +message DeleteUsersResp{ + CommonResp CommonResp = 1; + repeated string FailedUserIDList = 2; } -message GetAllUsersUidResp{ - CommonResp commonResp = 1; - repeated string uidList = 2; + +message GetAllUserIDReq{ + string opUserID = 1; + string operationID = 2; } +message GetAllUserIDResp{ + CommonResp CommonResp = 1; + repeated string UserIDList = 2; +} + + message AccountCheckReq{ - repeated string uidList = 1; - string token = 2; - string operationID = 3; + repeated string CheckUserIDList = 1; + string OpUserID = 2; + string OperationID = 3; } message AccountCheckResp{ @@ -37,97 +41,77 @@ message AccountCheckResp{ string userID = 1; string accountStatus = 2; } - repeated SingleUserStatus result = 2; - + repeated SingleUserStatus ResultList = 2; } + + message GetUserInfoReq{ repeated string userIDList = 1; - string token = 2; + string OpUserID = 2; string OperationID = 3; } message GetUserInfoResp{ - int32 errorCode = 1; - string errorMsg = 2; - repeated UserInfo Data = 3; -} -message UserInfo{ - string uid = 1; - string name = 2; - string icon = 3; - int32 gender = 4; - string mobile = 5; - string birth = 6; - string email = 7; - string ex = 8; + CommonResp commonResp = 1; + repeated open_im_sdk.UserInfo UserInfoList = 3; } -message LogoutReq{ - string OperationID = 1; - string token = 2; -} message UpdateUserInfoReq{ - string icon = 1; - string name = 2; - int32 gender = 3; - string mobile = 4; - string birth = 5; - string email = 6; - string ex = 7; - string token = 8; - string OperationID = 9; - string Uid = 10; + open_im_sdk.UserInfo UserInfo = 1; + string OpUserID = 2; + string operationID = 3; } +message UpdateUserInfoResp{ + CommonResp commonResp = 1; +} + message SetReceiveMessageOptReq{ - string uId = 1; - int32 opt = 2; - repeated string conversationId = 3; - string operationID = 4; + string FromUserID = 1; + int32 opt = 2; + repeated string conversationIDList = 3; + string operationID = 4; + string OpUserID = 5; +} +message OptResult{ + string conversationId = 1; + int32 result = 2; //-1: failed; 0:default; 1: not receive ; 2: not jpush } - message SetReceiveMessageOptResp{ - int32 errCode = 1; - string errMsg = 2; - repeated OptResult optResult = 3; + CommonResp commonResp = 1; + repeated OptResult optResultList = 2; } message GetReceiveMessageOptReq{ - string uId = 1; - repeated string conversationId = 2; - string operationID = 3; + string FromUserID = 1; + repeated string conversationId = 2; + string operationID = 3; + string OpUserID = 4; } - -message OptResult{ - string conversationId = 1; - int32 result = 2; //-1: failed; 0:default; 1: not receive ; 2: not jpush -} - message GetReceiveMessageOptResp{ - int32 errCode = 1; - string errMsg = 2; - repeated OptResult conversationOptResult = 3; + CommonResp commonResp = 1; + repeated OptResult conversationOptResultList = 3; } + message GetAllConversationMsgOptReq{ - string uId = 1; - string operationID = 2; + string FromUserId = 1; + string operationID = 2; + string OpUserID = 3; } - message GetAllConversationMsgOptResp{ - int32 errCode = 1; - string errMsg = 2; - repeated OptResult conversationOptResult = 3; + CommonResp commonResp = 1; + repeated OptResult conversationOptResultList = 3; } service user { - rpc getUserInfo(GetUserInfoReq) returns(GetUserInfoResp); - rpc UpdateUserInfo(UpdateUserInfoReq) returns(CommonResp); + rpc GetUserInfo(GetUserInfoReq) returns(GetUserInfoResp); + rpc UpdateUserInfo(UpdateUserInfoReq) returns(UpdateUserInfoResp); rpc DeleteUsers(DeleteUsersReq)returns(DeleteUsersResp); - rpc GetAllUsersUid(GetAllUsersUidReq)returns(GetAllUsersUidResp); + rpc GetAllUserID(GetAllUserIDReq)returns(GetAllUserIDResp); rpc SetReceiveMessageOpt(SetReceiveMessageOptReq)returns(SetReceiveMessageOptResp); rpc GetReceiveMessageOpt(GetReceiveMessageOptReq)returns(GetReceiveMessageOptResp); rpc GetAllConversationMsgOpt(GetAllConversationMsgOptReq)returns(GetAllConversationMsgOptResp);