diff --git a/cmd/open_im_demo/main.go b/cmd/open_im_demo/main.go index b73fe7676..72eeee974 100644 --- a/cmd/open_im_demo/main.go +++ b/cmd/open_im_demo/main.go @@ -51,6 +51,7 @@ func main() { address = config.Config.CmsApi.ListenIP + ":" + strconv.Itoa(*ginPort) fmt.Println("start demo api server address: ", address) go register.OnboardingProcessRoutine() + go register.ImportFriendRoutine() err := r.Run(address) if err != nil { log.Error("", "run failed ", *ginPort, err.Error()) diff --git a/internal/cms_api/admin/admin.go b/internal/cms_api/admin/admin.go index a741c8016..81a900d02 100644 --- a/internal/cms_api/admin/admin.go +++ b/internal/cms_api/admin/admin.go @@ -8,6 +8,7 @@ import ( "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" pbAdmin "Open_IM/pkg/proto/admin_cms" + pbCommon "Open_IM/pkg/proto/sdk_ws" "Open_IM/pkg/utils" "context" "github.com/minio/minio-go/v7" @@ -87,3 +88,94 @@ func AdminLogin(c *gin.Context) { resp.Token = respPb.Token openIMHttp.RespHttp200(c, constant.OK, resp) } + +func AddUserRegisterAddFriendIDList(c *gin.Context) { + var ( + req apiStruct.AddUserRegisterAddFriendIDListRequest + resp apiStruct.AddUserRegisterAddFriendIDListResponse + ) + if err := c.BindJSON(&req); err != nil { + log.NewInfo("0", utils.GetSelfFuncName(), err.Error()) + openIMHttp.RespHttp200(c, constant.ErrArgs, nil) + return + } + log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req) + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAdminCMSName, req.OperationID) + if etcdConn == nil { + errMsg := req.OperationID + "getcdv3.GetConn == nil" + log.NewError(req.OperationID, errMsg) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) + return + } + client := pbAdmin.NewAdminCMSClient(etcdConn) + _, err := client.AddUserRegisterAddFriendIDList(context.Background(), &pbAdmin.AddUserRegisterAddFriendIDListReq{OperationID: req.OperationID, UserIDList: req.UserIDList}) + if err != nil { + log.NewError(req.OperationID, utils.GetSelfFuncName(), "rpc failed", err.Error()) + openIMHttp.RespHttp200(c, err, nil) + return + } + openIMHttp.RespHttp200(c, constant.OK, resp) +} + +func ReduceUserRegisterAddFriendIDList(c *gin.Context) { + var ( + req apiStruct.ReduceUserRegisterAddFriendIDListRequest + resp apiStruct.ReduceUserRegisterAddFriendIDListResponse + ) + if err := c.BindJSON(&req); err != nil { + log.NewInfo("0", utils.GetSelfFuncName(), err.Error()) + openIMHttp.RespHttp200(c, constant.ErrArgs, nil) + return + } + log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req) + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAdminCMSName, req.OperationID) + if etcdConn == nil { + errMsg := req.OperationID + "getcdv3.GetConn == nil" + log.NewError(req.OperationID, errMsg) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) + return + } + client := pbAdmin.NewAdminCMSClient(etcdConn) + _, err := client.ReduceUserRegisterAddFriendIDList(context.Background(), &pbAdmin.ReduceUserRegisterAddFriendIDListReq{OperationID: req.OperationID, UserIDList: req.UserIDList, Operation: req.Operation}) + if err != nil { + log.NewError(req.OperationID, utils.GetSelfFuncName(), "rpc failed", err.Error()) + openIMHttp.RespHttp200(c, err, nil) + return + } + openIMHttp.RespHttp200(c, constant.OK, resp) +} + +func GetUserRegisterAddFriendIDList(c *gin.Context) { + var ( + req apiStruct.GetUserRegisterAddFriendIDListRequest + resp apiStruct.GetUserRegisterAddFriendIDListResponse + ) + if err := c.BindJSON(&req); err != nil { + log.NewInfo("0", utils.GetSelfFuncName(), err.Error()) + openIMHttp.RespHttp200(c, constant.ErrArgs, nil) + return + } + log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req) + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAdminCMSName, req.OperationID) + if etcdConn == nil { + errMsg := req.OperationID + "getcdv3.GetConn == nil" + log.NewError(req.OperationID, errMsg) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) + return + } + client := pbAdmin.NewAdminCMSClient(etcdConn) + respPb, err := client.GetUserRegisterAddFriendIDList(context.Background(), &pbAdmin.GetUserRegisterAddFriendIDListReq{OperationID: req.OperationID, Pagination: &pbCommon.RequestPagination{ + PageNumber: int32(req.PageNumber), + ShowNumber: int32(req.ShowNumber), + }}) + if err != nil { + log.NewError(req.OperationID, utils.GetSelfFuncName(), "rpc failed", err.Error()) + openIMHttp.RespHttp200(c, err, nil) + return + } + resp.Users = respPb.UserInfoList + resp.ShowNumber = int(respPb.Pagination.ShowNumber) + resp.CurrentPage = int(respPb.Pagination.CurrentPage) + log.NewInfo(req.OperationID, utils.GetSelfFuncName(), resp) + openIMHttp.RespHttp200(c, constant.OK, resp) +} diff --git a/internal/cms_api/router.go b/internal/cms_api/router.go index 058cd26ad..8edca6deb 100644 --- a/internal/cms_api/router.go +++ b/internal/cms_api/router.go @@ -20,6 +20,10 @@ func NewGinRouter() *gin.Engine { adminRouterGroup := router.Group("/admin") { adminRouterGroup.POST("/login", admin.AdminLogin) + adminRouterGroup.Use(middleware.JWTAuth()) + adminRouterGroup.POST("/add_user_register_add_friend_ID", admin.AddUserRegisterAddFriendIDList) + adminRouterGroup.POST("/reduce_user_register_reduce_friend_ID", admin.ReduceUserRegisterAddFriendIDList) + adminRouterGroup.POST("/get_user_register_reduce_friend_ID_list", admin.GetUserRegisterAddFriendIDList) } r2 := router.Group("") r2.Use(middleware.JWTAuth()) @@ -73,12 +77,6 @@ func NewGinRouter() *gin.Engine { userRouterGroup.POST("/delete_user", user.DeleteUser) userRouterGroup.GET("/get_users_by_name", user.GetUsersByName) } - friendRouterGroup := r2.Group("/friend") - { - friendRouterGroup.POST("/get_friends_by_id") - friendRouterGroup.POST("/set_friend") - friendRouterGroup.POST("/remove_friend") - } messageCMSRouterGroup := r2.Group("/message") { messageCMSRouterGroup.GET("/get_chat_logs", messageCMS.GetChatLogs) diff --git a/internal/cron_task/cron_task.go b/internal/cron_task/cron_task.go index d38b2b8a4..59a06fef1 100644 --- a/internal/cron_task/cron_task.go +++ b/internal/cron_task/cron_task.go @@ -15,7 +15,7 @@ import ( const cronTaskOperationID = "cronTaskOperationID-" func StartCronTask() { - log.NewPrivateLog("cron.log") + log.NewPrivateLog("cron") log.NewInfo(utils.OperationIDGenerator(), "start cron task") c := cron.New() fmt.Println("config", config.Config.Mongo.ChatRecordsClearTime) diff --git a/internal/demo/register/onboarding_process.go b/internal/demo/register/onboarding_process.go index 5a10b6ec0..53ae1f28b 100644 --- a/internal/demo/register/onboarding_process.go +++ b/internal/demo/register/onboarding_process.go @@ -9,6 +9,7 @@ import ( "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" groupRpc "Open_IM/pkg/proto/group" + organizationRpc "Open_IM/pkg/proto/organization" commonPb "Open_IM/pkg/proto/sdk_ws" "Open_IM/pkg/utils" diff --git a/internal/demo/register/register_import_friend.go b/internal/demo/register/register_import_friend.go new file mode 100644 index 000000000..533168846 --- /dev/null +++ b/internal/demo/register/register_import_friend.go @@ -0,0 +1,50 @@ +package register + +import ( + "Open_IM/pkg/common/config" + imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" + pbFriend "Open_IM/pkg/proto/friend" + "Open_IM/pkg/utils" + "context" + "strings" +) + +var ChImportFriend chan *pbFriend.ImportFriendReq + +func init() { + ChImportFriend = make(chan *pbFriend.ImportFriendReq, 1000) +} + +func ImportFriendRoutine() { + for { + req := <-ChImportFriend + go func() { + friendUserIDList, err := imdb.GetRegisterAddFriendList(0, 0) + if err != nil { + log.NewError(req.OperationID, utils.GetSelfFuncName(), req, err.Error()) + return + } + if len(friendUserIDList) == 0 { + return + } + req.FriendUserIDList = friendUserIDList + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName, req.OperationID) + if etcdConn == nil { + errMsg := req.OperationID + "getcdv3.GetConn == nil" + log.NewError(req.OperationID, errMsg) + return + } + client := pbFriend.NewFriendClient(etcdConn) + rpcResp, err := client.ImportFriend(context.Background(), req) + if err != nil { + log.NewError(req.OperationID, "ImportFriend failed ", err.Error(), req.String()) + return + } + if rpcResp.CommonResp.ErrCode != 0 { + log.NewError(req.OperationID, "ImportFriend failed ", rpcResp) + } + }() + } +} diff --git a/internal/demo/register/set_password.go b/internal/demo/register/set_password.go index a553a10cd..79636f7f7 100644 --- a/internal/demo/register/set_password.go +++ b/internal/demo/register/set_password.go @@ -8,6 +8,7 @@ import ( "Open_IM/pkg/common/db/mysql_model/im_mysql_model" http2 "Open_IM/pkg/common/http" "Open_IM/pkg/common/log" + pbFriend "Open_IM/pkg/proto/friend" "Open_IM/pkg/utils" "encoding/json" "math/big" @@ -132,6 +133,17 @@ func SetPassword(c *gin.Context) { log.NewWarn(params.OperationID, utils.GetSelfFuncName(), "to ch timeOut") } } + + select { + case ChImportFriend <- &pbFriend.ImportFriendReq{ + OperationID: params.OperationID, + FromUserID: userID, + OpUserID: userID, + }: + case <-time.After(time.Second * 2): + log.NewWarn(params.OperationID, utils.GetSelfFuncName(), "to ChImportFriend timeOut") + } + c.JSON(http.StatusOK, gin.H{"errCode": constant.NoError, "errMsg": "", "data": openIMRegisterResp.UserToken}) return } diff --git a/internal/rpc/admin_cms/admin_cms.go b/internal/rpc/admin_cms/admin_cms.go index 4a97f94e1..f74d64eed 100644 --- a/internal/rpc/admin_cms/admin_cms.go +++ b/internal/rpc/admin_cms/admin_cms.go @@ -3,11 +3,13 @@ package admin_cms import ( "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" + imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model" openIMHttp "Open_IM/pkg/common/http" "Open_IM/pkg/common/log" "Open_IM/pkg/common/token_verify" "Open_IM/pkg/grpc-etcdv3/getcdv3" pbAdminCMS "Open_IM/pkg/proto/admin_cms" + server_api_params "Open_IM/pkg/proto/sdk_ws" "Open_IM/pkg/utils" "context" "net" @@ -100,3 +102,50 @@ func (s *adminCMSServer) AdminLogin(_ context.Context, req *pbAdminCMS.AdminLogi log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String()) return resp, nil } + +func (s *adminCMSServer) AddUserRegisterAddFriendIDList(_ context.Context, req *pbAdminCMS.AddUserRegisterAddFriendIDListReq) (*pbAdminCMS.AddUserRegisterAddFriendIDListResp, error) { + log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String()) + resp := &pbAdminCMS.AddUserRegisterAddFriendIDListResp{} + if err := imdb.AddUserRegisterAddFriendIDList(req.UserIDList...); err != nil { + log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.UserIDList) + return resp, openIMHttp.WrapError(constant.ErrDB) + } + log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", req.String()) + return resp, nil +} + +func (s *adminCMSServer) ReduceUserRegisterAddFriendIDList(_ context.Context, req *pbAdminCMS.ReduceUserRegisterAddFriendIDListReq) (*pbAdminCMS.ReduceUserRegisterAddFriendIDListResp, error) { + log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String()) + resp := &pbAdminCMS.ReduceUserRegisterAddFriendIDListResp{} + if req.Operation == 0 { + if err := imdb.ReduceUserRegisterAddFriendIDList(req.UserIDList...); err != nil { + log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.UserIDList) + return resp, openIMHttp.WrapError(constant.ErrDB) + } + } else { + if err := imdb.DeleteAllRegisterAddFriendIDList(); err != nil { + log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.UserIDList) + return resp, openIMHttp.WrapError(constant.ErrDB) + } + } + log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", req.String()) + return resp, nil +} + +func (s *adminCMSServer) GetUserRegisterAddFriendIDList(_ context.Context, req *pbAdminCMS.GetUserRegisterAddFriendIDListReq) (*pbAdminCMS.GetUserRegisterAddFriendIDListResp, error) { + log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String()) + resp := &pbAdminCMS.GetUserRegisterAddFriendIDListResp{UserInfoList: []*server_api_params.UserInfo{}} + userIDList, err := imdb.GetRegisterAddFriendList(req.Pagination.ShowNumber, req.Pagination.ShowNumber) + if err != nil { + log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error()) + return resp, openIMHttp.WrapError(constant.ErrDB) + } + userList, err := imdb.GetUsersByUserIDList(userIDList) + if err != nil { + log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), userIDList) + return resp, openIMHttp.WrapError(constant.ErrDB) + } + utils.CopyStructFields(&resp.UserInfoList, userList) + log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", req.String()) + return resp, nil +} diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index e97119854..39e68d38f 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -623,7 +623,7 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou continue } - err = imdb.RemoveGroupMember(req.GroupID, v) + err = imdb.DeleteGroupMemberByGroupIDAndUserID(req.GroupID, v) if err != nil { log.NewError(req.OperationID, "RemoveGroupMember failed ", err.Error(), req.GroupID, v) resp.Id2ResultList = append(resp.Id2ResultList, &pbGroup.Id2Result{UserID: v, Result: -1}) @@ -1344,7 +1344,7 @@ func (s *groupServer) GetGroupByID(_ context.Context, req *pbGroup.GetGroupByIDR return resp, http.WrapError(constant.ErrDB) } utils.CopyStructFields(resp.CMSGroup.GroupInfo, group) - groupMember, err := imdb.GetGroupMaster(group.GroupID) + groupMember, err := imdb.GetGroupOwnerInfoByGroupID(group.GroupID) if err != nil { log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetGroupMaster", err.Error()) return resp, http.WrapError(constant.ErrDB) @@ -1388,11 +1388,12 @@ func (s *groupServer) GetGroup(_ context.Context, req *pbGroup.GetGroupReq) (*pb for _, v := range groups { group := &pbGroup.CMSGroup{GroupInfo: &open_im_sdk.GroupInfo{}} utils.CopyStructFields(group.GroupInfo, v) - groupMember, err := imdb.GetGroupMaster(v.GroupID) + groupMember, err := imdb.GetGroupOwnerInfoByGroupID(v.GroupID) if err != nil { log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetGroupMaster error", err.Error()) continue } + group.GroupInfo.CreateTime = uint32(v.CreateTime.Unix()) group.GroupOwnerUserID = groupMember.UserID group.GroupOwnerUserName = groupMember.Nickname @@ -1419,17 +1420,11 @@ func (s *groupServer) GetGroups(_ context.Context, req *pbGroup.GetGroupsReq) (* for _, v := range groups { group := &pbGroup.CMSGroup{GroupInfo: &open_im_sdk.GroupInfo{}} utils.CopyStructFields(group.GroupInfo, v) - groupMember, err := imdb.GetGroupMaster(v.GroupID) + groupMember, err := imdb.GetGroupOwnerInfoByGroupID(v.GroupID) if err != nil { log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetGroupMaster failed", err.Error(), v) continue } - //groupCountNum, err := imdb.GetGroupsCountNum(v) - //if err != nil { - // log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetGroupsCountNum failed", err.Error(), v) - // continue - //} - //group.GroupInfo.MemberCount = uint32(groupCountNum) group.GroupInfo.CreateTime = uint32(v.CreateTime.Unix()) group.GroupOwnerUserID = groupMember.UserID group.GroupOwnerUserName = groupMember.Nickname @@ -1442,7 +1437,7 @@ func (s *groupServer) GetGroups(_ context.Context, req *pbGroup.GetGroupsReq) (* func (s *groupServer) OperateUserRole(_ context.Context, req *pbGroup.OperateUserRoleReq) (*pbGroup.OperateUserRoleResp, error) { log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "args:", req.String()) resp := &pbGroup.OperateUserRoleResp{} - oldOwnerUserID, err := imdb.GetGroupMaster(req.GroupID) + oldOwnerUserID, err := imdb.GetGroupOwnerInfoByGroupID(req.GroupID) if err != nil { log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetGroupMaster failed", err.Error()) return resp, http.WrapError(constant.ErrDB) @@ -1504,7 +1499,7 @@ func (s *groupServer) RemoveGroupMembersCMS(_ context.Context, req *pbGroup.Remo log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "args:", req.String()) resp := &pbGroup.RemoveGroupMembersCMSResp{} for _, userId := range req.UserIDList { - err := imdb.RemoveGroupMember(req.GroupID, userId) + err := imdb.DeleteGroupMemberByGroupIDAndUserID(req.GroupID, userId) if err != nil { log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error()) resp.Failed = append(resp.Failed, userId) diff --git a/internal/rpc/message_cms/message_cms.go b/internal/rpc/message_cms/message_cms.go index 44fdca1e4..f0757e421 100644 --- a/internal/rpc/message_cms/message_cms.go +++ b/internal/rpc/message_cms/message_cms.go @@ -150,7 +150,7 @@ func (s *messageCMSServer) GetChatLogs(_ context.Context, req *pbMessageCMS.GetC pbChatLog.ReciverNickName = recvUser.Nickname case constant.GroupChatType: - group, err := imdb.GetGroupById(chatLog.RecvID) + group, err := imdb.GetGroupInfoByGroupID(chatLog.RecvID) if err != nil { log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetGroupById failed") continue diff --git a/pkg/cms_api_struct/admin.go b/pkg/cms_api_struct/admin.go index 02463f6e5..504ed02cc 100644 --- a/pkg/cms_api_struct/admin.go +++ b/pkg/cms_api_struct/admin.go @@ -1,8 +1,6 @@ package cms_api_struct -import ( - apiStruct "Open_IM/pkg/base_info" -) +import server_api_params "Open_IM/pkg/proto/sdk_ws" type AdminLoginRequest struct { AdminName string `json:"admin_name" binding:"required"` @@ -13,31 +11,29 @@ type AdminLoginResponse struct { Token string `json:"token"` } -type UploadUpdateAppReq struct { - OperationID string `form:"operationID" binding:"required"` - Type int `form:"type" binding:"required"` - Version string `form:"version" binding:"required"` - //File *multipart.FileHeader `form:"file" binding:"required"` - //Yaml *multipart.FileHeader `form:"yaml" binding:"required"` - ForceUpdate bool `form:"forceUpdate" binding:"required"` +type AddUserRegisterAddFriendIDListRequest struct { + OperationID string `json:"operationID" binding:"required"` + UserIDList []string `json:"userIDList" binding:"required"` } -type UploadUpdateAppResp struct { - apiStruct.CommResp +type AddUserRegisterAddFriendIDListResponse struct { } -type GetDownloadURLReq struct { +type ReduceUserRegisterAddFriendIDListRequest struct { + OperationID string `json:"operationID" binding:"required"` + UserIDList []string `json:"userIDList" binding:"required"` + Operation int32 `json:"operation" binding:"required"` +} + +type ReduceUserRegisterAddFriendIDListResponse struct { +} + +type GetUserRegisterAddFriendIDListRequest struct { OperationID string `json:"operationID" binding:"required"` - Type int `json:"type" binding:"required"` - Version string `json:"version" binding:"required"` -} - -type GetDownloadURLResp struct { - apiStruct.CommResp - Data struct { - HasNewVersion bool `json:"hasNewVersion"` - ForceUpdate bool `json:"forceUpdate"` - FileURL string `json:"fileURL"` - YamlURL string `json:"yamlURL"` - } `json:"data"` + RequestPagination +} + +type GetUserRegisterAddFriendIDListResponse struct { + Users []*server_api_params.UserInfo `json:"Users"` + ResponsePagination } diff --git a/pkg/cms_api_struct/group.go b/pkg/cms_api_struct/group.go index 7546312df..5296478b6 100644 --- a/pkg/cms_api_struct/group.go +++ b/pkg/cms_api_struct/group.go @@ -4,14 +4,14 @@ type GroupResponse struct { GroupOwnerName string `json:"GroupOwnerName"` GroupOwnerID string `json:"GroupOwnerID"` //*server_api_params.GroupInfo - GroupID string `json:"groupID"` - GroupName string `json:"groupName"` - Notification string `json:"notification"` - Introduction string `json:"introduction"` - FaceURL string `json:"faceURL"` - OwnerUserID string `json:"ownerUserID"` - CreateTime uint32 `json:"createTime"` - //MemberCount uint32 `json:"memberCount"` + GroupID string `json:"groupID"` + GroupName string `json:"groupName"` + Notification string `json:"notification"` + Introduction string `json:"introduction"` + FaceURL string `json:"faceURL"` + OwnerUserID string `json:"ownerUserID"` + CreateTime uint32 `json:"createTime"` + MemberCount uint32 `json:"memberCount"` Ex string `json:"ex"` Status int32 `json:"status"` CreatorUserID string `json:"creatorUserID"` diff --git a/pkg/common/db/model_struct.go b/pkg/common/db/model_struct.go index ea2c0734d..bc33aec7e 100644 --- a/pkg/common/db/model_struct.go +++ b/pkg/common/db/model_struct.go @@ -325,3 +325,11 @@ type AppVersion struct { func (AppVersion) TableName() string { return "app_version" } + +type RegisterAddFriend struct { + UserID string `gorm:"column:user_id;size:64"` +} + +func (RegisterAddFriend) TableName() string { + return "register_add_friend" +} diff --git a/pkg/common/db/mysql.go b/pkg/common/db/mysql.go index 58f651d94..105065f91 100644 --- a/pkg/common/db/mysql.go +++ b/pkg/common/db/mysql.go @@ -78,7 +78,7 @@ func initMysqlDB() { &GroupMember{}, &GroupRequest{}, &User{}, - &Black{}, &ChatLog{}, &Register{}, &Conversation{}, &AppVersion{}, &Department{}, &BlackList{}, &IpLimit{}, &UserIpLimit{}, &Invitation{}) + &Black{}, &ChatLog{}, &Register{}, &Conversation{}, &AppVersion{}, &Department{}, &BlackList{}, &IpLimit{}, &UserIpLimit{}, &Invitation{}, &RegisterAddFriend{}) db.Set("gorm:table_options", "CHARSET=utf8") db.Set("gorm:table_options", "collation=utf8_unicode_ci") @@ -154,6 +154,11 @@ func initMysqlDB() { fmt.Println("CreateTable UserIpLimit") db.Migrator().CreateTable(&UserIpLimit{}) } + + if !db.Migrator().HasTable(&RegisterAddFriend{}) { + fmt.Println("CreateTable RegisterAddFriend") + db.Migrator().CreateTable(&RegisterAddFriend{}) + } DB.MysqlDB.db = db return } diff --git a/pkg/common/db/mysql_model/im_mysql_model/demo_model.go b/pkg/common/db/mysql_model/im_mysql_model/demo_model.go index 8668026d7..8184b5a6e 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/demo_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/demo_model.go @@ -28,3 +28,38 @@ func ResetPassword(account, password string) error { } return db.DB.MysqlDB.DefaultGormDB().Table("registers").Where("account = ?", account).Updates(&r).Error } + +func GetRegisterAddFriendList(showNumber, pageNumber int32) ([]string, error) { + var IDList []string + var err error + model := db.DB.MysqlDB.DefaultGormDB().Model(&db.RegisterAddFriend{}) + if showNumber == 0 { + err = model.Pluck("user_id", &IDList).Error + } else { + err = model.Limit(int(showNumber)).Offset(int(showNumber*(pageNumber-1))).Pluck("user_id", &IDList).Error + } + return IDList, err +} + +func AddUserRegisterAddFriendIDList(userIDList ...string) error { + var list []db.RegisterAddFriend + for _, v := range userIDList { + list = append(list, db.RegisterAddFriend{UserID: v}) + } + err := db.DB.MysqlDB.DefaultGormDB().Create(list).Error + return err +} + +func ReduceUserRegisterAddFriendIDList(userIDList ...string) error { + var list []db.RegisterAddFriend + for _, v := range userIDList { + list = append(list, db.RegisterAddFriend{UserID: v}) + } + err := db.DB.MysqlDB.DefaultGormDB().Delete(list).Error + return err +} + +func DeleteAllRegisterAddFriendIDList() error { + err := db.DB.MysqlDB.DefaultGormDB().Where("1 = 1").Delete(&db.RegisterAddFriend{}).Error + return err +} diff --git a/pkg/common/db/mysql_model/im_mysql_model/group_member_model.go b/pkg/common/db/mysql_model/im_mysql_model/group_member_model.go index 0a4780011..89526b9de 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/group_member_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/group_member_model.go @@ -140,14 +140,6 @@ func IsExistGroupMember(groupID, userID string) bool { return true } -func RemoveGroupMember(groupID string, UserID string) error { - return DeleteGroupMemberByGroupIDAndUserID(groupID, UserID) -} - -func GetMemberInfoByID(groupID string, userID string) (*db.GroupMember, error) { - return GetGroupMemberInfoByGroupIDAndUserID(groupID, userID) -} - func GetGroupMemberByGroupID(groupID string, filter int32, begin int32, maxNumber int32) ([]db.GroupMember, error) { var memberList []db.GroupMember var err error 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 34d420b52..aa4ef29b9 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 @@ -1,12 +1,9 @@ package im_mysql_model import ( - "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db" "Open_IM/pkg/utils" - "errors" "fmt" - "gorm.io/gorm" "time" ) @@ -36,32 +33,35 @@ func InsertIntoGroup(groupInfo db.Group) error { if err != nil { return err } - return nil } -func GetGroupInfoByGroupID(groupId string) (*db.Group, error) { +func GetGroupInfoByGroupID(groupID string) (*db.Group, error) { var groupInfo db.Group - err := db.DB.MysqlDB.DefaultGormDB().Table("groups").Where("group_id=?", groupId).Take(&groupInfo).Error - if err != nil { - return nil, err - } - return &groupInfo, nil + err := db.DB.MysqlDB.DefaultGormDB().Table("groups").Where("group_id=?", groupID).Take(&groupInfo).Error + return &groupInfo, err } func SetGroupInfo(groupInfo db.Group) error { return db.DB.MysqlDB.DefaultGormDB().Table("groups").Where("group_id=?", groupInfo.GroupID).Updates(&groupInfo).Error } -func GetGroupsByName(groupName string, pageNumber, showNumber int32) ([]db.Group, error) { - var groups []db.Group - err := db.DB.MysqlDB.DefaultGormDB().Table("groups").Where(fmt.Sprintf(" name like '%%%s%%' ", groupName)).Limit(int(showNumber)).Offset(int(showNumber * (pageNumber - 1))).Find(&groups).Error +type GroupWithNum struct { + db.Group + MemberCount int `gorm:"column:num"` +} + +func GetGroupsByName(groupName string, pageNumber, showNumber int32) ([]GroupWithNum, error) { + var groups []GroupWithNum + err := db.DB.MysqlDB.DefaultGormDB().Table("groups").Select("groups.*, (select count(*) from group_members where group_members.group_id=groups.group_id) as num"). + Where(fmt.Sprintf(" name like '%%%s%%' ", groupName)).Limit(int(showNumber)).Offset(int(showNumber * (pageNumber - 1))).Find(&groups).Error return groups, err } -func GetGroups(pageNumber, showNumber int) ([]db.Group, error) { - var groups []db.Group - if err := db.DB.MysqlDB.DefaultGormDB().Table("groups").Limit(showNumber).Offset(showNumber * (pageNumber - 1)).Find(&groups).Error; err != nil { +func GetGroups(pageNumber, showNumber int) ([]GroupWithNum, error) { + var groups []GroupWithNum + if err := db.DB.MysqlDB.DefaultGormDB().Table("groups").Select("groups.*, (select count(*) from group_members where group_members.group_id=groups.group_id) as num"). + Limit(showNumber).Offset(showNumber * (pageNumber - 1)).Find(&groups).Error; err != nil { return groups, err } return groups, nil @@ -78,77 +78,6 @@ func OperateGroupStatus(groupId string, groupStatus int32) error { return nil } -func DeleteGroup(groupId string) error { - var group db.Group - var groupMembers []db.GroupMember - if err := db.DB.MysqlDB.DefaultGormDB().Table("groups").Where("group_id=?", groupId).Delete(&group).Error; err != nil { - return err - } - if err := db.DB.MysqlDB.DefaultGormDB().Table("group_members").Where("group_id=?", groupId).Delete(groupMembers).Error; err != nil { - return err - } - return nil -} - -func OperateGroupRole(userId, groupId string, roleLevel int32) (string, string, error) { - groupMember := db.GroupMember{ - UserID: userId, - GroupID: groupId, - } - updateInfo := db.GroupMember{ - RoleLevel: roleLevel, - } - groupMaster := db.GroupMember{} - var err error - switch roleLevel { - case constant.GroupOwner: - err = db.DB.MysqlDB.DefaultGormDB().Transaction(func(tx *gorm.DB) error { - result := db.DB.MysqlDB.DefaultGormDB().Table("group_members").Where("group_id = ? and role_level = ?", groupId, constant.GroupOwner).First(&groupMaster).Updates(&db.GroupMember{ - RoleLevel: constant.GroupOrdinaryUsers, - }) - if result.Error != nil { - return result.Error - } - if result.RowsAffected == 0 { - return errors.New(fmt.Sprintf("user %s not exist in group %s or already operate", userId, groupId)) - } - - result = db.DB.MysqlDB.DefaultGormDB().Table("group_members").First(&groupMember).Updates(updateInfo) - if result.Error != nil { - return result.Error - } - if result.RowsAffected == 0 { - return errors.New(fmt.Sprintf("user %s not exist in group %s or already operate", userId, groupId)) - } - return nil - }) - - case constant.GroupOrdinaryUsers: - err = db.DB.MysqlDB.DefaultGormDB().Transaction(func(tx *gorm.DB) error { - result := db.DB.MysqlDB.DefaultGormDB().Table("group_members").Where("group_id = ? and role_level = ?", groupId, constant.GroupOwner).First(&groupMaster) - if result.Error != nil { - return result.Error - } - if result.RowsAffected == 0 { - return errors.New(fmt.Sprintf("user %s not exist in group %s or already operate", userId, groupId)) - } - if groupMaster.UserID == userId { - return errors.New(fmt.Sprintf("user %s is master of %s, cant set to ordinary user", userId, groupId)) - } else { - result = db.DB.MysqlDB.DefaultGormDB().Table("group_members").Find(&groupMember).Updates(updateInfo) - if result.Error != nil { - return result.Error - } - if result.RowsAffected == 0 { - return errors.New(fmt.Sprintf("user %s not exist in group %s or already operate", userId, groupId)) - } - } - return nil - }) - } - return "", "", err -} - func GetGroupsCountNum(group db.Group) (int32, error) { var count int64 if err := db.DB.MysqlDB.DefaultGormDB().Table("groups").Where(fmt.Sprintf(" name like '%%%s%%' ", group.GroupName)).Count(&count).Error; err != nil { @@ -157,34 +86,10 @@ func GetGroupsCountNum(group db.Group) (int32, error) { return int32(count), nil } -func GetGroupById(groupId string) (db.Group, error) { - group := db.Group{ - GroupID: groupId, - } - if err := db.DB.MysqlDB.DefaultGormDB().Table("groups").Find(&group).Error; err != nil { - return group, err - } - return group, nil -} - -func GetGroupMaster(groupId string) (db.GroupMember, error) { - groupMember := db.GroupMember{} - if err := db.DB.MysqlDB.DefaultGormDB().Table("group_members").Where("role_level=? and group_id=?", constant.GroupOwner, groupId).Find(&groupMember).Error; err != nil { - return groupMember, err - } - return groupMember, nil -} - func UpdateGroupInfoDefaultZero(groupID string, args map[string]interface{}) error { return db.DB.MysqlDB.DefaultGormDB().Table("groups").Where("group_id = ? ", groupID).Updates(args).Error } -func GetAllGroupIDList() ([]string, error) { - var groupIDList []string - err := db.DB.MysqlDB.DefaultGormDB().Table("groups").Pluck("group_id", &groupIDList).Error - return groupIDList, err -} - func GetGroupIDListByGroupType(groupType int) ([]string, error) { var groupIDList []string if err := db.DB.MysqlDB.DefaultGormDB().Table("groups").Where("group_type = ? ", groupType).Pluck("group_id", &groupIDList).Error; err != nil { 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 6e8a1d280..059c43d55 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 @@ -72,6 +72,12 @@ func GetUserByUserID(userID string) (*db.User, error) { return &user, nil } +func GetUsersByUserIDList(userIDList []string) ([]*db.User, error) { + var userList []*db.User + err := db.DB.MysqlDB.DefaultGormDB().Table("users").Where("user_id in (?)", userIDList).Find(&userList).Error + return userList, err +} + func GetUserNameByUserID(userID string) (string, error) { var user db.User err := db.DB.MysqlDB.DefaultGormDB().Table("users").Select("name").Where("user_id=?", userID).First(&user).Error diff --git a/pkg/proto/admin_cms/admin_cms.pb.go b/pkg/proto/admin_cms/admin_cms.pb.go index 890f409a9..06522567a 100644 --- a/pkg/proto/admin_cms/admin_cms.pb.go +++ b/pkg/proto/admin_cms/admin_cms.pb.go @@ -1,284 +1,452 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.1 -// protoc v3.15.5 // source: admin_cms/admin_cms.proto -package admin_cms +package admin_cms // import "./admin_cms" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import sdk_ws "Open_IM/pkg/proto/sdk_ws" import ( - context "context" + context "golang.org/x/net/context" grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" ) -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type AdminLoginReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields + OperationID string `protobuf:"bytes,1,opt,name=OperationID" json:"OperationID,omitempty"` + AdminID string `protobuf:"bytes,2,opt,name=AdminID" json:"AdminID,omitempty"` + Secret string `protobuf:"bytes,3,opt,name=Secret" json:"Secret,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} - OperationID string `protobuf:"bytes,1,opt,name=OperationID,proto3" json:"OperationID,omitempty"` - AdminID string `protobuf:"bytes,2,opt,name=AdminID,proto3" json:"AdminID,omitempty"` - Secret string `protobuf:"bytes,3,opt,name=Secret,proto3" json:"Secret,omitempty"` +func (m *AdminLoginReq) Reset() { *m = AdminLoginReq{} } +func (m *AdminLoginReq) String() string { return proto.CompactTextString(m) } +func (*AdminLoginReq) ProtoMessage() {} +func (*AdminLoginReq) Descriptor() ([]byte, []int) { + return fileDescriptor_admin_cms_e0cc6ee28c5c634b, []int{0} +} +func (m *AdminLoginReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AdminLoginReq.Unmarshal(m, b) +} +func (m *AdminLoginReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AdminLoginReq.Marshal(b, m, deterministic) +} +func (dst *AdminLoginReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_AdminLoginReq.Merge(dst, src) +} +func (m *AdminLoginReq) XXX_Size() int { + return xxx_messageInfo_AdminLoginReq.Size(m) } +func (m *AdminLoginReq) XXX_DiscardUnknown() { + xxx_messageInfo_AdminLoginReq.DiscardUnknown(m) +} + +var xxx_messageInfo_AdminLoginReq proto.InternalMessageInfo -func (x *AdminLoginReq) Reset() { - *x = AdminLoginReq{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_cms_admin_cms_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +func (m *AdminLoginReq) GetOperationID() string { + if m != nil { + return m.OperationID } + return "" } -func (x *AdminLoginReq) String() string { - return protoimpl.X.MessageStringOf(x) +func (m *AdminLoginReq) GetAdminID() string { + if m != nil { + return m.AdminID + } + return "" } -func (*AdminLoginReq) ProtoMessage() {} - -func (x *AdminLoginReq) ProtoReflect() protoreflect.Message { - mi := &file_admin_cms_admin_cms_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms +func (m *AdminLoginReq) GetSecret() string { + if m != nil { + return m.Secret } - return mi.MessageOf(x) + return "" } -// Deprecated: Use AdminLoginReq.ProtoReflect.Descriptor instead. -func (*AdminLoginReq) Descriptor() ([]byte, []int) { - return file_admin_cms_admin_cms_proto_rawDescGZIP(), []int{0} +type AdminLoginResp struct { + Token string `protobuf:"bytes,1,opt,name=token" json:"token,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *AdminLoginReq) GetOperationID() string { - if x != nil { - return x.OperationID +func (m *AdminLoginResp) Reset() { *m = AdminLoginResp{} } +func (m *AdminLoginResp) String() string { return proto.CompactTextString(m) } +func (*AdminLoginResp) ProtoMessage() {} +func (*AdminLoginResp) Descriptor() ([]byte, []int) { + return fileDescriptor_admin_cms_e0cc6ee28c5c634b, []int{1} +} +func (m *AdminLoginResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AdminLoginResp.Unmarshal(m, b) +} +func (m *AdminLoginResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AdminLoginResp.Marshal(b, m, deterministic) +} +func (dst *AdminLoginResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_AdminLoginResp.Merge(dst, src) +} +func (m *AdminLoginResp) XXX_Size() int { + return xxx_messageInfo_AdminLoginResp.Size(m) +} +func (m *AdminLoginResp) XXX_DiscardUnknown() { + xxx_messageInfo_AdminLoginResp.DiscardUnknown(m) +} + +var xxx_messageInfo_AdminLoginResp proto.InternalMessageInfo + +func (m *AdminLoginResp) GetToken() string { + if m != nil { + return m.Token } return "" } -func (x *AdminLoginReq) GetAdminID() string { - if x != nil { - return x.AdminID +type AddUserRegisterAddFriendIDListReq struct { + OperationID string `protobuf:"bytes,1,opt,name=operationID" json:"operationID,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 *AddUserRegisterAddFriendIDListReq) Reset() { *m = AddUserRegisterAddFriendIDListReq{} } +func (m *AddUserRegisterAddFriendIDListReq) String() string { return proto.CompactTextString(m) } +func (*AddUserRegisterAddFriendIDListReq) ProtoMessage() {} +func (*AddUserRegisterAddFriendIDListReq) Descriptor() ([]byte, []int) { + return fileDescriptor_admin_cms_e0cc6ee28c5c634b, []int{2} +} +func (m *AddUserRegisterAddFriendIDListReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AddUserRegisterAddFriendIDListReq.Unmarshal(m, b) +} +func (m *AddUserRegisterAddFriendIDListReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AddUserRegisterAddFriendIDListReq.Marshal(b, m, deterministic) +} +func (dst *AddUserRegisterAddFriendIDListReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_AddUserRegisterAddFriendIDListReq.Merge(dst, src) +} +func (m *AddUserRegisterAddFriendIDListReq) XXX_Size() int { + return xxx_messageInfo_AddUserRegisterAddFriendIDListReq.Size(m) +} +func (m *AddUserRegisterAddFriendIDListReq) XXX_DiscardUnknown() { + xxx_messageInfo_AddUserRegisterAddFriendIDListReq.DiscardUnknown(m) +} + +var xxx_messageInfo_AddUserRegisterAddFriendIDListReq proto.InternalMessageInfo + +func (m *AddUserRegisterAddFriendIDListReq) GetOperationID() string { + if m != nil { + return m.OperationID } return "" } -func (x *AdminLoginReq) GetSecret() string { - if x != nil { - return x.Secret +func (m *AddUserRegisterAddFriendIDListReq) GetUserIDList() []string { + if m != nil { + return m.UserIDList } - return "" + return nil } -type AdminLoginResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields +type AddUserRegisterAddFriendIDListResp struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} - Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` +func (m *AddUserRegisterAddFriendIDListResp) Reset() { *m = AddUserRegisterAddFriendIDListResp{} } +func (m *AddUserRegisterAddFriendIDListResp) String() string { return proto.CompactTextString(m) } +func (*AddUserRegisterAddFriendIDListResp) ProtoMessage() {} +func (*AddUserRegisterAddFriendIDListResp) Descriptor() ([]byte, []int) { + return fileDescriptor_admin_cms_e0cc6ee28c5c634b, []int{3} +} +func (m *AddUserRegisterAddFriendIDListResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AddUserRegisterAddFriendIDListResp.Unmarshal(m, b) +} +func (m *AddUserRegisterAddFriendIDListResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AddUserRegisterAddFriendIDListResp.Marshal(b, m, deterministic) +} +func (dst *AddUserRegisterAddFriendIDListResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_AddUserRegisterAddFriendIDListResp.Merge(dst, src) +} +func (m *AddUserRegisterAddFriendIDListResp) XXX_Size() int { + return xxx_messageInfo_AddUserRegisterAddFriendIDListResp.Size(m) +} +func (m *AddUserRegisterAddFriendIDListResp) XXX_DiscardUnknown() { + xxx_messageInfo_AddUserRegisterAddFriendIDListResp.DiscardUnknown(m) } -func (x *AdminLoginResp) Reset() { - *x = AdminLoginResp{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_cms_admin_cms_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } +var xxx_messageInfo_AddUserRegisterAddFriendIDListResp proto.InternalMessageInfo + +type ReduceUserRegisterAddFriendIDListReq struct { + OperationID string `protobuf:"bytes,1,opt,name=operationID" json:"operationID,omitempty"` + Operation int32 `protobuf:"varint,2,opt,name=operation" json:"operation,omitempty"` + UserIDList []string `protobuf:"bytes,3,rep,name=userIDList" json:"userIDList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (x *AdminLoginResp) String() string { - return protoimpl.X.MessageStringOf(x) +func (m *ReduceUserRegisterAddFriendIDListReq) Reset() { *m = ReduceUserRegisterAddFriendIDListReq{} } +func (m *ReduceUserRegisterAddFriendIDListReq) String() string { return proto.CompactTextString(m) } +func (*ReduceUserRegisterAddFriendIDListReq) ProtoMessage() {} +func (*ReduceUserRegisterAddFriendIDListReq) Descriptor() ([]byte, []int) { + return fileDescriptor_admin_cms_e0cc6ee28c5c634b, []int{4} +} +func (m *ReduceUserRegisterAddFriendIDListReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ReduceUserRegisterAddFriendIDListReq.Unmarshal(m, b) +} +func (m *ReduceUserRegisterAddFriendIDListReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ReduceUserRegisterAddFriendIDListReq.Marshal(b, m, deterministic) +} +func (dst *ReduceUserRegisterAddFriendIDListReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_ReduceUserRegisterAddFriendIDListReq.Merge(dst, src) +} +func (m *ReduceUserRegisterAddFriendIDListReq) XXX_Size() int { + return xxx_messageInfo_ReduceUserRegisterAddFriendIDListReq.Size(m) +} +func (m *ReduceUserRegisterAddFriendIDListReq) XXX_DiscardUnknown() { + xxx_messageInfo_ReduceUserRegisterAddFriendIDListReq.DiscardUnknown(m) } -func (*AdminLoginResp) ProtoMessage() {} +var xxx_messageInfo_ReduceUserRegisterAddFriendIDListReq proto.InternalMessageInfo -func (x *AdminLoginResp) ProtoReflect() protoreflect.Message { - mi := &file_admin_cms_admin_cms_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms +func (m *ReduceUserRegisterAddFriendIDListReq) GetOperationID() string { + if m != nil { + return m.OperationID } - return mi.MessageOf(x) + return "" } -// Deprecated: Use AdminLoginResp.ProtoReflect.Descriptor instead. -func (*AdminLoginResp) Descriptor() ([]byte, []int) { - return file_admin_cms_admin_cms_proto_rawDescGZIP(), []int{1} +func (m *ReduceUserRegisterAddFriendIDListReq) GetOperation() int32 { + if m != nil { + return m.Operation + } + return 0 +} + +func (m *ReduceUserRegisterAddFriendIDListReq) GetUserIDList() []string { + if m != nil { + return m.UserIDList + } + return nil +} + +type ReduceUserRegisterAddFriendIDListResp struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ReduceUserRegisterAddFriendIDListResp) Reset() { *m = ReduceUserRegisterAddFriendIDListResp{} } +func (m *ReduceUserRegisterAddFriendIDListResp) String() string { return proto.CompactTextString(m) } +func (*ReduceUserRegisterAddFriendIDListResp) ProtoMessage() {} +func (*ReduceUserRegisterAddFriendIDListResp) Descriptor() ([]byte, []int) { + return fileDescriptor_admin_cms_e0cc6ee28c5c634b, []int{5} } +func (m *ReduceUserRegisterAddFriendIDListResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ReduceUserRegisterAddFriendIDListResp.Unmarshal(m, b) +} +func (m *ReduceUserRegisterAddFriendIDListResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ReduceUserRegisterAddFriendIDListResp.Marshal(b, m, deterministic) +} +func (dst *ReduceUserRegisterAddFriendIDListResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_ReduceUserRegisterAddFriendIDListResp.Merge(dst, src) +} +func (m *ReduceUserRegisterAddFriendIDListResp) XXX_Size() int { + return xxx_messageInfo_ReduceUserRegisterAddFriendIDListResp.Size(m) +} +func (m *ReduceUserRegisterAddFriendIDListResp) XXX_DiscardUnknown() { + xxx_messageInfo_ReduceUserRegisterAddFriendIDListResp.DiscardUnknown(m) +} + +var xxx_messageInfo_ReduceUserRegisterAddFriendIDListResp proto.InternalMessageInfo -func (x *AdminLoginResp) GetToken() string { - if x != nil { - return x.Token +type GetUserRegisterAddFriendIDListReq struct { + OperationID string `protobuf:"bytes,1,opt,name=operationID" json:"operationID,omitempty"` + Pagination *sdk_ws.RequestPagination `protobuf:"bytes,2,opt,name=Pagination" json:"Pagination,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetUserRegisterAddFriendIDListReq) Reset() { *m = GetUserRegisterAddFriendIDListReq{} } +func (m *GetUserRegisterAddFriendIDListReq) String() string { return proto.CompactTextString(m) } +func (*GetUserRegisterAddFriendIDListReq) ProtoMessage() {} +func (*GetUserRegisterAddFriendIDListReq) Descriptor() ([]byte, []int) { + return fileDescriptor_admin_cms_e0cc6ee28c5c634b, []int{6} +} +func (m *GetUserRegisterAddFriendIDListReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetUserRegisterAddFriendIDListReq.Unmarshal(m, b) +} +func (m *GetUserRegisterAddFriendIDListReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetUserRegisterAddFriendIDListReq.Marshal(b, m, deterministic) +} +func (dst *GetUserRegisterAddFriendIDListReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetUserRegisterAddFriendIDListReq.Merge(dst, src) +} +func (m *GetUserRegisterAddFriendIDListReq) XXX_Size() int { + return xxx_messageInfo_GetUserRegisterAddFriendIDListReq.Size(m) +} +func (m *GetUserRegisterAddFriendIDListReq) XXX_DiscardUnknown() { + xxx_messageInfo_GetUserRegisterAddFriendIDListReq.DiscardUnknown(m) +} + +var xxx_messageInfo_GetUserRegisterAddFriendIDListReq proto.InternalMessageInfo + +func (m *GetUserRegisterAddFriendIDListReq) GetOperationID() string { + if m != nil { + return m.OperationID } return "" } -var File_admin_cms_admin_cms_proto protoreflect.FileDescriptor - -var file_admin_cms_admin_cms_proto_rawDesc = []byte{ - 0x0a, 0x19, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x5f, 0x63, 0x6d, 0x73, 0x2f, 0x61, 0x64, 0x6d, 0x69, - 0x6e, 0x5f, 0x63, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x61, 0x64, 0x6d, - 0x69, 0x6e, 0x5f, 0x63, 0x6d, 0x73, 0x22, 0x63, 0x0a, 0x0d, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4c, - 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a, 0x0b, 0x4f, 0x70, 0x65, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x4f, 0x70, - 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x41, 0x64, 0x6d, - 0x69, 0x6e, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x41, 0x64, 0x6d, 0x69, - 0x6e, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x22, 0x26, 0x0a, 0x0e, 0x41, - 0x64, 0x6d, 0x69, 0x6e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, - 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x32, 0x4d, 0x0a, 0x08, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x43, 0x4d, 0x53, 0x12, - 0x41, 0x0a, 0x0a, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x18, 0x2e, - 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x5f, 0x63, 0x6d, 0x73, 0x2e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4c, - 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x5f, - 0x63, 0x6d, 0x73, 0x2e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, - 0x73, 0x70, 0x42, 0x17, 0x5a, 0x15, 0x2e, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x5f, 0x63, 0x6d, - 0x73, 0x3b, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x5f, 0x63, 0x6d, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_admin_cms_admin_cms_proto_rawDescOnce sync.Once - file_admin_cms_admin_cms_proto_rawDescData = file_admin_cms_admin_cms_proto_rawDesc -) +func (m *GetUserRegisterAddFriendIDListReq) GetPagination() *sdk_ws.RequestPagination { + if m != nil { + return m.Pagination + } + return nil +} -func file_admin_cms_admin_cms_proto_rawDescGZIP() []byte { - file_admin_cms_admin_cms_proto_rawDescOnce.Do(func() { - file_admin_cms_admin_cms_proto_rawDescData = protoimpl.X.CompressGZIP(file_admin_cms_admin_cms_proto_rawDescData) - }) - return file_admin_cms_admin_cms_proto_rawDescData -} - -var file_admin_cms_admin_cms_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_admin_cms_admin_cms_proto_goTypes = []interface{}{ - (*AdminLoginReq)(nil), // 0: admin_cms.AdminLoginReq - (*AdminLoginResp)(nil), // 1: admin_cms.AdminLoginResp -} -var file_admin_cms_admin_cms_proto_depIdxs = []int32{ - 0, // 0: admin_cms.adminCMS.AdminLogin:input_type -> admin_cms.AdminLoginReq - 1, // 1: admin_cms.adminCMS.AdminLogin:output_type -> admin_cms.AdminLoginResp - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_admin_cms_admin_cms_proto_init() } -func file_admin_cms_admin_cms_proto_init() { - if File_admin_cms_admin_cms_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_admin_cms_admin_cms_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminLoginReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_cms_admin_cms_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminLoginResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_admin_cms_admin_cms_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_admin_cms_admin_cms_proto_goTypes, - DependencyIndexes: file_admin_cms_admin_cms_proto_depIdxs, - MessageInfos: file_admin_cms_admin_cms_proto_msgTypes, - }.Build() - File_admin_cms_admin_cms_proto = out.File - file_admin_cms_admin_cms_proto_rawDesc = nil - file_admin_cms_admin_cms_proto_goTypes = nil - file_admin_cms_admin_cms_proto_depIdxs = nil +type GetUserRegisterAddFriendIDListResp struct { + UserInfoList []*sdk_ws.UserInfo `protobuf:"bytes,1,rep,name=UserInfoList" json:"UserInfoList,omitempty"` + Pagination *sdk_ws.ResponsePagination `protobuf:"bytes,2,opt,name=Pagination" json:"Pagination,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetUserRegisterAddFriendIDListResp) Reset() { *m = GetUserRegisterAddFriendIDListResp{} } +func (m *GetUserRegisterAddFriendIDListResp) String() string { return proto.CompactTextString(m) } +func (*GetUserRegisterAddFriendIDListResp) ProtoMessage() {} +func (*GetUserRegisterAddFriendIDListResp) Descriptor() ([]byte, []int) { + return fileDescriptor_admin_cms_e0cc6ee28c5c634b, []int{7} +} +func (m *GetUserRegisterAddFriendIDListResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetUserRegisterAddFriendIDListResp.Unmarshal(m, b) +} +func (m *GetUserRegisterAddFriendIDListResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetUserRegisterAddFriendIDListResp.Marshal(b, m, deterministic) +} +func (dst *GetUserRegisterAddFriendIDListResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetUserRegisterAddFriendIDListResp.Merge(dst, src) +} +func (m *GetUserRegisterAddFriendIDListResp) XXX_Size() int { + return xxx_messageInfo_GetUserRegisterAddFriendIDListResp.Size(m) +} +func (m *GetUserRegisterAddFriendIDListResp) XXX_DiscardUnknown() { + xxx_messageInfo_GetUserRegisterAddFriendIDListResp.DiscardUnknown(m) +} + +var xxx_messageInfo_GetUserRegisterAddFriendIDListResp proto.InternalMessageInfo + +func (m *GetUserRegisterAddFriendIDListResp) GetUserInfoList() []*sdk_ws.UserInfo { + if m != nil { + return m.UserInfoList + } + return nil +} + +func (m *GetUserRegisterAddFriendIDListResp) GetPagination() *sdk_ws.ResponsePagination { + if m != nil { + return m.Pagination + } + return nil +} + +func init() { + proto.RegisterType((*AdminLoginReq)(nil), "admin_cms.AdminLoginReq") + proto.RegisterType((*AdminLoginResp)(nil), "admin_cms.AdminLoginResp") + proto.RegisterType((*AddUserRegisterAddFriendIDListReq)(nil), "admin_cms.AddUserRegisterAddFriendIDListReq") + proto.RegisterType((*AddUserRegisterAddFriendIDListResp)(nil), "admin_cms.AddUserRegisterAddFriendIDListResp") + proto.RegisterType((*ReduceUserRegisterAddFriendIDListReq)(nil), "admin_cms.ReduceUserRegisterAddFriendIDListReq") + proto.RegisterType((*ReduceUserRegisterAddFriendIDListResp)(nil), "admin_cms.ReduceUserRegisterAddFriendIDListResp") + proto.RegisterType((*GetUserRegisterAddFriendIDListReq)(nil), "admin_cms.GetUserRegisterAddFriendIDListReq") + proto.RegisterType((*GetUserRegisterAddFriendIDListResp)(nil), "admin_cms.GetUserRegisterAddFriendIDListResp") } // Reference imports to suppress errors if they are not otherwise used. var _ context.Context -var _ grpc.ClientConnInterface +var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 +const _ = grpc.SupportPackageIsVersion4 + +// Client API for AdminCMS service -// AdminCMSClient is the client API for AdminCMS service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type AdminCMSClient interface { AdminLogin(ctx context.Context, in *AdminLoginReq, opts ...grpc.CallOption) (*AdminLoginResp, error) + AddUserRegisterAddFriendIDList(ctx context.Context, in *AddUserRegisterAddFriendIDListReq, opts ...grpc.CallOption) (*AddUserRegisterAddFriendIDListResp, error) + ReduceUserRegisterAddFriendIDList(ctx context.Context, in *ReduceUserRegisterAddFriendIDListReq, opts ...grpc.CallOption) (*ReduceUserRegisterAddFriendIDListResp, error) + GetUserRegisterAddFriendIDList(ctx context.Context, in *GetUserRegisterAddFriendIDListReq, opts ...grpc.CallOption) (*GetUserRegisterAddFriendIDListResp, error) } type adminCMSClient struct { - cc grpc.ClientConnInterface + cc *grpc.ClientConn } -func NewAdminCMSClient(cc grpc.ClientConnInterface) AdminCMSClient { +func NewAdminCMSClient(cc *grpc.ClientConn) AdminCMSClient { return &adminCMSClient{cc} } func (c *adminCMSClient) AdminLogin(ctx context.Context, in *AdminLoginReq, opts ...grpc.CallOption) (*AdminLoginResp, error) { out := new(AdminLoginResp) - err := c.cc.Invoke(ctx, "/admin_cms.adminCMS/AdminLogin", in, out, opts...) + err := grpc.Invoke(ctx, "/admin_cms.adminCMS/AdminLogin", in, out, c.cc, opts...) if err != nil { return nil, err } return out, nil } -// AdminCMSServer is the server API for AdminCMS service. -type AdminCMSServer interface { - AdminLogin(context.Context, *AdminLoginReq) (*AdminLoginResp, error) +func (c *adminCMSClient) AddUserRegisterAddFriendIDList(ctx context.Context, in *AddUserRegisterAddFriendIDListReq, opts ...grpc.CallOption) (*AddUserRegisterAddFriendIDListResp, error) { + out := new(AddUserRegisterAddFriendIDListResp) + err := grpc.Invoke(ctx, "/admin_cms.adminCMS/AddUserRegisterAddFriendIDList", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil } -// UnimplementedAdminCMSServer can be embedded to have forward compatible implementations. -type UnimplementedAdminCMSServer struct { +func (c *adminCMSClient) ReduceUserRegisterAddFriendIDList(ctx context.Context, in *ReduceUserRegisterAddFriendIDListReq, opts ...grpc.CallOption) (*ReduceUserRegisterAddFriendIDListResp, error) { + out := new(ReduceUserRegisterAddFriendIDListResp) + err := grpc.Invoke(ctx, "/admin_cms.adminCMS/ReduceUserRegisterAddFriendIDList", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (*UnimplementedAdminCMSServer) AdminLogin(context.Context, *AdminLoginReq) (*AdminLoginResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method AdminLogin not implemented") +func (c *adminCMSClient) GetUserRegisterAddFriendIDList(ctx context.Context, in *GetUserRegisterAddFriendIDListReq, opts ...grpc.CallOption) (*GetUserRegisterAddFriendIDListResp, error) { + out := new(GetUserRegisterAddFriendIDListResp) + err := grpc.Invoke(ctx, "/admin_cms.adminCMS/GetUserRegisterAddFriendIDList", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for AdminCMS service + +type AdminCMSServer interface { + AdminLogin(context.Context, *AdminLoginReq) (*AdminLoginResp, error) + AddUserRegisterAddFriendIDList(context.Context, *AddUserRegisterAddFriendIDListReq) (*AddUserRegisterAddFriendIDListResp, error) + ReduceUserRegisterAddFriendIDList(context.Context, *ReduceUserRegisterAddFriendIDListReq) (*ReduceUserRegisterAddFriendIDListResp, error) + GetUserRegisterAddFriendIDList(context.Context, *GetUserRegisterAddFriendIDListReq) (*GetUserRegisterAddFriendIDListResp, error) } func RegisterAdminCMSServer(s *grpc.Server, srv AdminCMSServer) { @@ -303,6 +471,60 @@ func _AdminCMS_AdminLogin_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _AdminCMS_AddUserRegisterAddFriendIDList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddUserRegisterAddFriendIDListReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AdminCMSServer).AddUserRegisterAddFriendIDList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/admin_cms.adminCMS/AddUserRegisterAddFriendIDList", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AdminCMSServer).AddUserRegisterAddFriendIDList(ctx, req.(*AddUserRegisterAddFriendIDListReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _AdminCMS_ReduceUserRegisterAddFriendIDList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReduceUserRegisterAddFriendIDListReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AdminCMSServer).ReduceUserRegisterAddFriendIDList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/admin_cms.adminCMS/ReduceUserRegisterAddFriendIDList", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AdminCMSServer).ReduceUserRegisterAddFriendIDList(ctx, req.(*ReduceUserRegisterAddFriendIDListReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _AdminCMS_GetUserRegisterAddFriendIDList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserRegisterAddFriendIDListReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AdminCMSServer).GetUserRegisterAddFriendIDList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/admin_cms.adminCMS/GetUserRegisterAddFriendIDList", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AdminCMSServer).GetUserRegisterAddFriendIDList(ctx, req.(*GetUserRegisterAddFriendIDListReq)) + } + return interceptor(ctx, in, info, handler) +} + var _AdminCMS_serviceDesc = grpc.ServiceDesc{ ServiceName: "admin_cms.adminCMS", HandlerType: (*AdminCMSServer)(nil), @@ -311,7 +533,56 @@ var _AdminCMS_serviceDesc = grpc.ServiceDesc{ MethodName: "AdminLogin", Handler: _AdminCMS_AdminLogin_Handler, }, + { + MethodName: "AddUserRegisterAddFriendIDList", + Handler: _AdminCMS_AddUserRegisterAddFriendIDList_Handler, + }, + { + MethodName: "ReduceUserRegisterAddFriendIDList", + Handler: _AdminCMS_ReduceUserRegisterAddFriendIDList_Handler, + }, + { + MethodName: "GetUserRegisterAddFriendIDList", + Handler: _AdminCMS_GetUserRegisterAddFriendIDList_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "admin_cms/admin_cms.proto", } + +func init() { + proto.RegisterFile("admin_cms/admin_cms.proto", fileDescriptor_admin_cms_e0cc6ee28c5c634b) +} + +var fileDescriptor_admin_cms_e0cc6ee28c5c634b = []byte{ + // 460 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x94, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0xc7, 0xe5, 0x5a, 0x2d, 0x64, 0x02, 0x1c, 0x56, 0x7c, 0xb8, 0x01, 0x55, 0xc9, 0x2a, 0x85, + 0x1c, 0xc0, 0x46, 0xe1, 0xc8, 0x01, 0x05, 0x02, 0xc8, 0x52, 0xab, 0xa2, 0xad, 0xb8, 0x70, 0xb1, + 0x4c, 0x3c, 0x44, 0x56, 0x94, 0xdd, 0xed, 0xce, 0x86, 0x9e, 0xb8, 0xf6, 0xc2, 0xab, 0xf0, 0x38, + 0x3c, 0x10, 0xea, 0x26, 0x8d, 0x6d, 0xea, 0xd6, 0xad, 0x72, 0xf3, 0x7c, 0xfc, 0x77, 0x7f, 0x1e, + 0xfd, 0x67, 0x61, 0x37, 0xcd, 0xe6, 0xb9, 0x4c, 0x26, 0x73, 0x8a, 0xd6, 0x5f, 0xa1, 0x36, 0xca, + 0x2a, 0xd6, 0x5a, 0x27, 0x3a, 0xbd, 0x23, 0x8d, 0x32, 0x89, 0x0f, 0x23, 0x3d, 0x9b, 0x46, 0xae, + 0x1a, 0x51, 0x36, 0x4b, 0x4e, 0x29, 0x3a, 0x5d, 0x75, 0xf3, 0x09, 0xdc, 0x1f, 0x9d, 0xf7, 0x1f, + 0xa8, 0x69, 0x2e, 0x05, 0x9e, 0xb0, 0x2e, 0xb4, 0x8f, 0x34, 0x9a, 0xd4, 0xe6, 0x4a, 0xc6, 0xe3, + 0xc0, 0xeb, 0x7a, 0x83, 0x96, 0x28, 0xa7, 0x58, 0x00, 0x77, 0x9c, 0x24, 0x1e, 0x07, 0x5b, 0xae, + 0x7a, 0x11, 0xb2, 0xc7, 0xb0, 0x73, 0x8c, 0x13, 0x83, 0x36, 0xf0, 0x5d, 0x61, 0x15, 0xf1, 0xe7, + 0xf0, 0xa0, 0x7c, 0x09, 0x69, 0xf6, 0x10, 0xb6, 0xad, 0x9a, 0xa1, 0x5c, 0x9d, 0xbf, 0x0c, 0x38, + 0x42, 0x6f, 0x94, 0x65, 0x5f, 0x09, 0x8d, 0xc0, 0x69, 0x4e, 0x16, 0xcd, 0x28, 0xcb, 0x3e, 0x99, + 0x1c, 0x65, 0x16, 0x8f, 0x0f, 0x72, 0xb2, 0x2b, 0x40, 0x75, 0x19, 0xb0, 0x94, 0x62, 0x7b, 0x00, + 0x0b, 0x42, 0xb3, 0x94, 0x04, 0x5b, 0x5d, 0x7f, 0xd0, 0x12, 0xa5, 0x0c, 0xef, 0x03, 0x6f, 0xba, + 0x86, 0x34, 0x3f, 0xf3, 0xa0, 0x2f, 0x30, 0x5b, 0x4c, 0x70, 0x63, 0xa0, 0x67, 0xd0, 0x5a, 0x87, + 0x6e, 0x66, 0xdb, 0xa2, 0x48, 0xfc, 0x87, 0xeb, 0x5f, 0xc2, 0x7d, 0x01, 0xfb, 0x37, 0xe0, 0x20, + 0xcd, 0x7f, 0x7b, 0xd0, 0xfb, 0x8c, 0x76, 0x63, 0xdc, 0x31, 0xc0, 0x97, 0x74, 0x9a, 0xcb, 0x82, + 0xb7, 0x3d, 0xec, 0x87, 0x84, 0xe6, 0x27, 0x9a, 0x24, 0xd5, 0x79, 0xa2, 0x53, 0x93, 0xce, 0x29, + 0x14, 0x78, 0xb2, 0x40, 0xb2, 0x45, 0xaf, 0x28, 0xe9, 0xf8, 0x1f, 0x0f, 0x78, 0x13, 0x0d, 0x69, + 0xf6, 0x0e, 0xee, 0x9d, 0xb7, 0xc4, 0xf2, 0x87, 0x72, 0xff, 0xef, 0x75, 0xfd, 0x41, 0x7b, 0xf8, + 0xb4, 0xe6, 0xba, 0x8b, 0x36, 0x51, 0x11, 0xb0, 0x8f, 0x35, 0xb4, 0xfb, 0xb5, 0xb4, 0xa4, 0x95, + 0x24, 0xac, 0xc7, 0x1d, 0xfe, 0xf5, 0xe1, 0xae, 0xdb, 0x9c, 0x0f, 0x87, 0xc7, 0x6c, 0x04, 0x50, + 0x18, 0x96, 0x05, 0x61, 0xb1, 0x63, 0x95, 0x65, 0xe9, 0xec, 0x5e, 0x51, 0x21, 0xcd, 0x7e, 0xc1, + 0xde, 0xf5, 0x26, 0x63, 0x2f, 0x2b, 0xe2, 0x06, 0xdb, 0x77, 0x5e, 0xdd, 0xa2, 0x9b, 0x34, 0x3b, + 0xf3, 0xa0, 0xd7, 0xe8, 0x1a, 0x16, 0x95, 0x0e, 0xbd, 0x89, 0xd7, 0x3b, 0xaf, 0x6f, 0x27, 0x58, + 0xce, 0xe1, 0x7a, 0x17, 0x54, 0xe6, 0xd0, 0x68, 0xdf, 0xca, 0x1c, 0x9a, 0xed, 0xf5, 0xfe, 0xc9, + 0xb7, 0x47, 0x61, 0xf1, 0x44, 0xbe, 0x5d, 0x7f, 0x7d, 0xdf, 0x71, 0xef, 0xdf, 0x9b, 0x7f, 0x01, + 0x00, 0x00, 0xff, 0xff, 0x99, 0xbe, 0x8e, 0x2a, 0x4a, 0x05, 0x00, 0x00, +} diff --git a/pkg/proto/admin_cms/admin_cms.proto b/pkg/proto/admin_cms/admin_cms.proto index 6759268ed..acee32324 100644 --- a/pkg/proto/admin_cms/admin_cms.proto +++ b/pkg/proto/admin_cms/admin_cms.proto @@ -1,5 +1,6 @@ syntax = "proto3"; option go_package = "./admin_cms;admin_cms"; +import "Open_IM/pkg/proto/sdk_ws/ws.proto"; package admin_cms; message AdminLoginReq { @@ -13,6 +14,38 @@ message AdminLoginResp { string token = 1; } +message AddUserRegisterAddFriendIDListReq { + string operationID = 1; + repeated string userIDList = 2; +} + +message AddUserRegisterAddFriendIDListResp { + +} + +message ReduceUserRegisterAddFriendIDListReq { + string operationID = 1; + int32 operation = 2; + repeated string userIDList = 3; +} + +message ReduceUserRegisterAddFriendIDListResp { + +} + +message GetUserRegisterAddFriendIDListReq { + string operationID = 1; + server_api_params.RequestPagination Pagination = 2; +} + +message GetUserRegisterAddFriendIDListResp { + repeated server_api_params.UserInfo UserInfoList = 1; + server_api_params.ResponsePagination Pagination = 2; +} + service adminCMS { rpc AdminLogin(AdminLoginReq) returns(AdminLoginResp); + rpc AddUserRegisterAddFriendIDList(AddUserRegisterAddFriendIDListReq) returns(AddUserRegisterAddFriendIDListResp); + rpc ReduceUserRegisterAddFriendIDList(ReduceUserRegisterAddFriendIDListReq) returns(ReduceUserRegisterAddFriendIDListResp); + rpc GetUserRegisterAddFriendIDList(GetUserRegisterAddFriendIDListReq) returns(GetUserRegisterAddFriendIDListResp); } \ No newline at end of file