diff --git a/cmd/open_im_api/main.go b/cmd/open_im_api/main.go index f27e53277..817042f5c 100644 --- a/cmd/open_im_api/main.go +++ b/cmd/open_im_api/main.go @@ -19,55 +19,58 @@ import ( ) func main() { + gin.SetMode(gin.ReleaseMode) r := gin.Default() r.Use(utils.CorsHandler()) // user routing group, which handles user registration and login services userRouterGroup := r.Group("/user") { - userRouterGroup.POST("/update_user_info", user.UpdateUserInfo) - userRouterGroup.POST("/get_user_info", user.GetUserInfo) - userRouterGroup.POST("/get_users_online_status", user.GetUsersOnlineStatus) + userRouterGroup.POST("/update_user_info", user.UpdateUserInfo) //1 + userRouterGroup.POST("/get_users_info", user.GetUsersInfo) //1 + userRouterGroup.POST("/get_self_user_info", user.GetSelfUserInfo) //1 } //friend routing group friendRouterGroup := r.Group("/friend") { - friendRouterGroup.POST("/get_friends_info", friend.GetFriendsInfo) - friendRouterGroup.POST("/add_friend", friend.AddFriend) - friendRouterGroup.POST("/get_friend_apply_list", friend.GetFriendApplyList) - friendRouterGroup.POST("/get_self_apply_list", friend.GetSelfApplyList) - friendRouterGroup.POST("/get_friend_list", friend.GetFriendList) - friendRouterGroup.POST("/add_blacklist", friend.AddBlacklist) - friendRouterGroup.POST("/get_blacklist", friend.GetBlacklist) - friendRouterGroup.POST("/remove_blacklist", friend.RemoveBlacklist) - friendRouterGroup.POST("/delete_friend", friend.DeleteFriend) - friendRouterGroup.POST("/add_friend_response", friend.AddFriendResponse) - friendRouterGroup.POST("/set_friend_comment", friend.SetFriendComment) - friendRouterGroup.POST("/is_friend", friend.IsFriend) - friendRouterGroup.POST("/import_friend", friend.ImportFriend) + // friendRouterGroup.POST("/get_friends_info", friend.GetFriendsInfo) + friendRouterGroup.POST("/add_friend", friend.AddFriend) //1 + friendRouterGroup.POST("/delete_friend", friend.DeleteFriend) //1 + friendRouterGroup.POST("/get_friend_apply_list", friend.GetFriendApplyList) //1 + friendRouterGroup.POST("/get_self_friend_apply_list", friend.GetSelfFriendApplyList) //1 + friendRouterGroup.POST("/get_friend_list", friend.GetFriendList) //1 + friendRouterGroup.POST("/add_friend_response", friend.AddFriendResponse) //1 + friendRouterGroup.POST("/set_friend_remark", friend.SetFriendRemark) //1 + + friendRouterGroup.POST("/add_black", friend.AddBlack) //1 + friendRouterGroup.POST("/get_black_list", friend.GetBlacklist) //1 + friendRouterGroup.POST("/remove_black", friend.RemoveBlack) //1 + + friendRouterGroup.POST("/import_friend", friend.ImportFriend) //1 + friendRouterGroup.POST("/is_friend", friend.IsFriend) //1 } //group related routing group groupRouterGroup := r.Group("/group") { - groupRouterGroup.POST("/create_group", group.CreateGroup) - groupRouterGroup.POST("/set_group_info", group.SetGroupInfo) - groupRouterGroup.POST("join_group", group.JoinGroup) - groupRouterGroup.POST("/quit_group", group.QuitGroup) - groupRouterGroup.POST("/group_application_response", group.ApplicationGroupResponse) - groupRouterGroup.POST("/transfer_group", group.TransferGroupOwner) - groupRouterGroup.POST("/get_group_applicationList", group.GetGroupApplicationList) - groupRouterGroup.POST("/get_groups_info", group.GetGroupsInfo) - groupRouterGroup.POST("/kick_group", group.KickGroupMember) - groupRouterGroup.POST("/get_group_member_list", group.GetGroupMemberList) - groupRouterGroup.POST("/get_group_all_member_list", group.GetGroupAllMember) - groupRouterGroup.POST("/get_group_members_info", group.GetGroupMembersInfo) - groupRouterGroup.POST("/invite_user_to_group", group.InviteUserToGroup) - groupRouterGroup.POST("/get_joined_group_list", group.GetJoinedGroupList) + groupRouterGroup.POST("/create_group", group.CreateGroup) //1 + groupRouterGroup.POST("/set_group_info", group.SetGroupInfo) //1 + groupRouterGroup.POST("join_group", group.JoinGroup) //1 + groupRouterGroup.POST("/quit_group", group.QuitGroup) //1 + groupRouterGroup.POST("/group_application_response", group.ApplicationGroupResponse) //1 + groupRouterGroup.POST("/transfer_group", group.TransferGroupOwner) //1 + groupRouterGroup.POST("/get_recv_group_applicationList", group.GetRecvGroupApplicationList) //1 + groupRouterGroup.POST("/get_groups_info", group.GetGroupsInfo) //1 + groupRouterGroup.POST("/kick_group", group.KickGroupMember) //1 + groupRouterGroup.POST("/get_group_member_list", group.GetGroupMemberList) //no use + groupRouterGroup.POST("/get_group_all_member_list", group.GetGroupAllMemberList) //1 + groupRouterGroup.POST("/get_group_members_info", group.GetGroupMembersInfo) //1 + groupRouterGroup.POST("/invite_user_to_group", group.InviteUserToGroup) //1 + groupRouterGroup.POST("/get_joined_group_list", group.GetJoinedGroupList) //1 } //certificate authRouterGroup := r.Group("/auth") { - authRouterGroup.POST("/user_register", apiAuth.UserRegister) - authRouterGroup.POST("/user_token", apiAuth.UserToken) + authRouterGroup.POST("/user_register", apiAuth.UserRegister) //1 + authRouterGroup.POST("/user_token", apiAuth.UserToken) //1 } //Third service thirdGroup := r.Group("/third") @@ -75,28 +78,27 @@ func main() { thirdGroup.POST("/tencent_cloud_storage_credential", apiThird.TencentCloudStorageCredential) } //Message - chatGroup := r.Group("/chat") + chatGroup := r.Group("/msg") { - chatGroup.POST("/newest_seq", apiChat.UserGetSeq) - chatGroup.POST("/pull_msg", apiChat.UserPullMsg) - chatGroup.POST("/send_msg", apiChat.UserSendMsg) - chatGroup.POST("/pull_msg_by_seq", apiChat.UserPullMsgBySeqList) + chatGroup.POST("/newest_seq", apiChat.GetSeq) + chatGroup.POST("/send_msg", apiChat.SendMsg) + chatGroup.POST("/pull_msg_by_seq", apiChat.PullMsgBySeqList) } //Manager managementGroup := r.Group("/manager") { - managementGroup.POST("/delete_user", manage.DeleteUser) + managementGroup.POST("/delete_user", manage.DeleteUser) //1 managementGroup.POST("/send_msg", manage.ManagementSendMsg) - managementGroup.POST("/get_all_users_uid", manage.GetAllUsersUid) - managementGroup.POST("/account_check", manage.AccountCheck) - managementGroup.POST("/get_users_online_status", manage.GetUsersOnlineStatus) + managementGroup.POST("/get_all_users_uid", manage.GetAllUsersUid) //1 + managementGroup.POST("/account_check", manage.AccountCheck) //1 + managementGroup.POST("/get_users_online_status", manage.GetUsersOnlineStatus) //1 } //Conversation conversationGroup := r.Group("/conversation") { - conversationGroup.POST("/set_receive_message_opt", conversation.SetReceiveMessageOpt) - conversationGroup.POST("/get_receive_message_opt", conversation.GetReceiveMessageOpt) - conversationGroup.POST("/get_all_conversation_message_opt", conversation.GetAllConversationMessageOpt) + conversationGroup.POST("/set_receive_message_opt", conversation.SetReceiveMessageOpt) //1 + conversationGroup.POST("/get_receive_message_opt", conversation.GetReceiveMessageOpt) //1 + conversationGroup.POST("/get_all_conversation_message_opt", conversation.GetAllConversationMessageOpt) //1 } log.NewPrivateLog("api") diff --git a/cmd/open_im_timer_task/main.go b/cmd/open_im_timer_task/main.go index 56fd6a4c0..954c41ae6 100644 --- a/cmd/open_im_timer_task/main.go +++ b/cmd/open_im_timer_task/main.go @@ -40,7 +40,7 @@ func main() { // } //} for { - uidList, err := im_mysql_model.SelectAllUID() + uidList, err := im_mysql_model.SelectAllUserID() if err != nil { //log.NewError("999999", err.Error()) } else { diff --git a/cmd/rpc/open_im_auth/main.go b/cmd/rpc/open_im_auth/main.go index ed4656d35..110ea05c6 100644 --- a/cmd/rpc/open_im_auth/main.go +++ b/cmd/rpc/open_im_auth/main.go @@ -10,4 +10,5 @@ func main() { flag.Parse() rpcServer := rpcAuth.NewRpcAuthServer(*rpcPort) rpcServer.Run() + } diff --git a/cmd/rpc/open_im_msg/main.go b/cmd/rpc/open_im_msg/main.go index 0dffe8aaa..7344facf4 100644 --- a/cmd/rpc/open_im_msg/main.go +++ b/cmd/rpc/open_im_msg/main.go @@ -1,7 +1,7 @@ package main import ( - rpcChat "Open_IM/internal/rpc/chat" + rpcChat "Open_IM/internal/rpc/msg" "flag" ) diff --git a/config/config.yaml b/config/config.yaml index ca754a55b..65696d2ba 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -85,9 +85,9 @@ credential: rpcport: openImUserPort: [ 10100 ] openImFriendPort: [ 10200 ] - openImOfflineMessagePort: [ 10300] + openImOfflineMessagePort: [ 10300 ] openImOnlineRelayPort: [ 10400 ] - openImGroupPort: [ 10500 ] + openImGroupPort: [ 10500 ] openImAuthPort: [ 10600 ] openImPushPort: [ 10700 ] c2c: @@ -144,8 +144,8 @@ push: pushUrl: "https://api.jpush.cn/v3/push" pushIntent: "intent:#Intent;component=io.openim.app.enterprisechat/io.openim.app.enterprisechat.MainActivity;end" manager: - appManagerUid: ["openIM123456","openIM654321"] - secrets: ["openIM1","openIM2"] + appManagerUid: [ "openIM123456","openIM654321" ] + secrets: [ "openIM1","openIM2" ] secret: tuoyun @@ -173,33 +173,254 @@ messagecallback: iOSPush: pushSound: "xxx" - badgeCount: 1 + badgeCount: true notification: + groupCreated: conversation: - conversationChanged: 1 - unreadCount: 1 + reliabilityLevel: 1 + unreadCount: true offlinePush: switch: true - title: "create group title" + title: "create group title" # xx create the group desc: "create group desc" ext: "create group ext" defaultTips: tips: "create the group" # xx create the group - groupInfoChanged: + groupInfoSet: conversation: - conversationChanged: 1 - unreadCount: 1 + reliabilityLevel: 1 + unreadCount: false offlinePush: - switch: true + switch: false title: "group info changed title" desc: "group info changed desc" ext: "group info changed ext" defaultTips: tips: "group info changed by" # group info changed by xx - conversationChanged: 0 + + joinGroupApplication: + conversation: + reliabilityLevel: 1 + unreadCount: false + offlinePush: + switch: false + title: "group info changed title" + desc: "group info changed desc" + ext: "group info changed ext" + defaultTips: + tips: "group info changed by" # group info changed by xx + + memberQuit: + conversation: + reliabilityLevel: 1 + unreadCount: false + offlinePush: + switch: false + title: "group info changed title" + desc: "group info changed desc" + ext: "group info changed ext" + defaultTips: + tips: "group info changed by" # group info changed by xx + + groupApplicationAccepted: + conversation: + reliabilityLevel: 1 + unreadCount: false + offlinePush: + switch: false + title: "group info changed title" + desc: "group info changed desc" + ext: "group info changed ext" + defaultTips: + tips: "group info changed by" # group info changed by xx + + groupApplicationRejected: + conversation: + reliabilityLevel: 1 + unreadCount: false + offlinePush: + switch: false + title: "group info changed title" + desc: "group info changed desc" + ext: "group info changed ext" + defaultTips: + tips: "group info changed by" # group info changed by xx + + groupOwnerTransferred: + conversation: + reliabilityLevel: 1 + unreadCount: false + offlinePush: + switch: false + title: "group info changed title" + desc: "group info changed desc" + ext: "group info changed ext" + defaultTips: + tips: "group info changed by" # group info changed by xx + + memberKicked: + conversation: + reliabilityLevel: 1 + unreadCount: false + offlinePush: + switch: false + title: "group info changed title" + desc: "group info changed desc" + ext: "group info changed ext" + defaultTips: + tips: "group info changed by" # group info changed by xx + + memberInvited: + conversation: + reliabilityLevel: 1 + unreadCount: false + offlinePush: + switch: false + title: "group info changed title" + desc: "group info changed desc" + ext: "group info changed ext" + defaultTips: + tips: "group info changed by" # group info changed by xx + + memberEnter: + conversation: + reliabilityLevel: 1 + unreadCount: false + offlinePush: + switch: false + title: "group info changed title" + desc: "group info changed desc" + ext: "group info changed ext" + defaultTips: + tips: "group info changed by" # group info changed by xx + + #############################friend################################# + + friendApplicationAdded: + conversation: + reliabilityLevel: 2 + unreadCount: false + offlinePush: + switch: true + title: "Somebody applies to add you as a friend" + desc: "Somebody applies to add you as a friend" + ext: "Somebody applies to add you as a friend" + defaultTips: + tips: "I applies to add you as a friend" # + + friendApplicationApproved: + conversation: + reliabilityLevel: 2 + unreadCount: false + offlinePush: + switch: true + title: "Someone applies to add your friend application" + desc: "Someone applies to add your friend application" + ext: "Someone applies to add your friend application" + defaultTips: + tips: "I applies to add your friend application" # + + + friendApplicationRejected: + conversation: + reliabilityLevel: 2 + unreadCount: false + offlinePush: + switch: true + title: "Someone rejected your friend application" + desc: "Someone rejected your friend application" + ext: "Someone rejected your friend application" + defaultTips: + tips: "I rejected your friend application" # + + + + + + friendAdded: + conversation: + reliabilityLevel: 3 + unreadCount: true + offlinePush: + switch: true + title: "We have become friends" + desc: "We have become friends" + ext: "We have become friends" + defaultTips: + tips: "We have become friends" # + + + + friendDeleted: + conversation: + reliabilityLevel: 2 + unreadCount: false + offlinePush: + switch: true + title: "Deleted a friend" + desc: "Deleted a friend" + ext: "Deleted a friend" + defaultTips: + tips: "Deleted a friend" # + + + friendRemarkSet: + conversation: + reliabilityLevel: 2 + unreadCount: false + offlinePush: + switch: true + title: "Your friend's profile has been changed" + desc: "Your friend's profile has been changed" + ext: "Your friend's profile has been changed" + defaultTips: + tips: "Your friend's profile has been changed" # + + + + blackAdded: + conversation: + reliabilityLevel: 2 + unreadCount: false + offlinePush: + switch: true + title: "Blocked a user" + desc: "Blocked a user" + ext: "Blocked a user" + defaultTips: + tips: "Blocked a user" # + + + blackDeleted: + conversation: + reliabilityLevel: 2 + unreadCount: false + offlinePush: + switch: true + title: "Remove a blocked user" + desc: "Remove a blocked user" + ext: "Remove a blocked user" + defaultTips: + tips: "Remove a blocked user" + + #####################user######################### + userInfoUpdated: + conversation: + reliabilityLevel: 2 + unreadCount: false + offlinePush: + switch: true + title: "Remove a blocked user" + desc: "Remove a blocked user" + ext: "Remove a blocked user" + defaultTips: + tips: "Remove a blocked user" + + + #---------------demo configuration---------------------# @@ -215,9 +436,9 @@ demo: superCode: 666666 mail: title: "openIM" - senderMail: "1765567899@qq.com" - senderAuthorizationCode: "1gxyausfoevlzbfag" - smtpAddr: "smtp.qq.com" - smtpPort: 25 +senderMail: "1765567899@qq.com" +senderAuthorizationCode: "1gxyausfoevlzbfag" +smtpAddr: "smtp.qq.com" +smtpPort: 25 diff --git a/go.mod b/go.mod index e86107f08..767401200 100644 --- a/go.mod +++ b/go.mod @@ -18,11 +18,14 @@ require ( github.com/garyburd/redigo v1.6.2 github.com/gin-gonic/gin v1.7.0 github.com/go-playground/validator/v10 v10.4.1 + github.com/go-sql-driver/mysql v1.6.0 // indirect github.com/golang-jwt/jwt/v4 v4.1.0 github.com/golang/protobuf v1.5.2 github.com/golang/snappy v0.0.4 // indirect github.com/gorilla/websocket v1.4.2 + github.com/jinzhu/copier v0.3.4 github.com/jinzhu/gorm v1.9.16 + github.com/jinzhu/now v1.1.3 // indirect github.com/jonboulle/clockwork v0.2.2 // indirect github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible github.com/lestrrat-go/strftime v1.0.4 // indirect @@ -32,6 +35,7 @@ require ( github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 github.com/olivere/elastic/v7 v7.0.23 github.com/pierrec/lz4 v2.6.1+incompatible // indirect + github.com/pkg/errors v0.9.1 github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 github.com/sirupsen/logrus v1.8.1 diff --git a/go.sum b/go.sum index 7a4dc5ae5..a708e28db 100644 --- a/go.sum +++ b/go.sum @@ -151,8 +151,9 @@ github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD87 github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= -github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= +github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -278,12 +279,15 @@ github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKEN github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jinzhu/copier v0.3.4 h1:mfU6jI9PtCeUjkjQ322dlff9ELjGDu975C2p/nrubVI= +github.com/jinzhu/copier v0.3.4/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= github.com/jinzhu/gorm v1.9.16 h1:+IyIjPEABKRpsu/F8OvDPy9fyQlgsg2luMV2ZIH5i5o= github.com/jinzhu/gorm v1.9.16/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBefADcs= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= -github.com/jinzhu/now v1.0.1 h1:HjfetcXq097iXP0uoPCdnM4Efp5/9MsM0/M+XOTeR3M= github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jinzhu/now v1.1.3 h1:PlHq1bSCSZL9K0wUhbm2pGLoTWs2GwVhsP6emvGV/ZI= +github.com/jinzhu/now v1.1.3/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= diff --git a/internal/api/auth/auth.go b/internal/api/auth/auth.go new file mode 100644 index 000000000..85d427fb8 --- /dev/null +++ b/internal/api/auth/auth.go @@ -0,0 +1,85 @@ +package apiAuth + +import ( + api "Open_IM/pkg/base_info" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" + rpc "Open_IM/pkg/proto/auth" + open_im_sdk "Open_IM/pkg/proto/sdk_ws" + "Open_IM/pkg/utils" + "context" + "github.com/gin-gonic/gin" + "net/http" + "strings" +) + +func UserRegister(c *gin.Context) { + params := api.UserRegisterReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + + if params.Secret != config.Config.Secret { + log.NewError(params.OperationID, "params.Secret != config.Config.Secret", params.Secret, config.Config.Secret) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "not authorized"}) + return + } + req := &rpc.UserRegisterReq{UserInfo: &open_im_sdk.UserInfo{}} + utils.CopyStructFields(req.UserInfo, ¶ms) + //copier.Copy(req.UserInfo, ¶ms) + req.OperationID = params.OperationID + log.NewInfo(req.OperationID, "UserRegister args ", req.String()) + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName) + client := rpc.NewAuthClient(etcdConn) + reply, err := client.UserRegister(context.Background(), req) + if err != nil || reply.CommonResp.ErrCode != 0 { + log.NewError(req.OperationID, "UserRegister failed ", err, reply.CommonResp.ErrCode) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": reply.CommonResp.ErrMsg}) + return + } + + pbDataToken := &rpc.UserTokenReq{Platform: params.Platform, FromUserID: params.UserID, OperationID: params.OperationID} + replyToken, err := client.UserToken(context.Background(), pbDataToken) + if err != nil { + log.NewError(req.OperationID, "UserToken failed ", err.Error(), pbDataToken) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) + return + } + resp := api.UserRegisterResp{CommResp: api.CommResp{ErrCode: replyToken.CommonResp.ErrCode, ErrMsg: replyToken.CommonResp.ErrMsg}, + UserToken: api.UserTokenInfo{UserID: req.UserInfo.UserID, Token: replyToken.Token, ExpiredTime: replyToken.ExpiredTime}} + log.NewInfo(req.OperationID, "UserRegister return ", resp) + c.JSON(http.StatusOK, resp) + +} + +func UserToken(c *gin.Context) { + params := api.UserTokenReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + + if params.Secret != config.Config.Secret { + log.NewError(params.OperationID, "params.Secret != config.Config.Secret", params.Secret, config.Config.Secret) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "not authorized"}) + return + } + req := &rpc.UserTokenReq{Platform: params.Platform, FromUserID: params.UserID, OperationID: params.OperationID} + log.NewInfo(req.OperationID, "UserToken args ", req.String()) + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName) + client := rpc.NewAuthClient(etcdConn) + reply, err := client.UserToken(context.Background(), req) + if err != nil { + log.NewError(req.OperationID, "UserToken failed ", err.Error(), req.String()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) + return + } + resp := api.UserTokenResp{CommResp: api.CommResp{ErrCode: reply.CommonResp.ErrCode, ErrMsg: reply.CommonResp.ErrMsg}, + UserToken: api.UserTokenInfo{UserID: req.FromUserID, Token: reply.Token, ExpiredTime: reply.ExpiredTime}} + log.NewInfo(req.OperationID, "UserRegister return ", resp) + c.JSON(http.StatusOK, resp) +} diff --git a/internal/api/auth/user_register.go b/internal/api/auth/user_register.go deleted file mode 100644 index e0d69eeda..000000000 --- a/internal/api/auth/user_register.go +++ /dev/null @@ -1,95 +0,0 @@ -package apiAuth - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pbAuth "Open_IM/pkg/proto/auth" - "context" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -type paramsUserRegister struct { - Secret string `json:"secret" binding:"required,max=32"` - Platform int32 `json:"platform" binding:"required,min=1,max=7"` - UID string `json:"uid" binding:"required,min=1,max=64"` - Name string `json:"name" binding:"required,min=1,max=64"` - Icon string `json:"icon" binding:"omitempty,max=1024"` - Gender int32 `json:"gender" binding:"omitempty,oneof=0 1 2"` - Mobile string `json:"mobile" binding:"omitempty,max=32"` - Birth string `json:"birth" binding:"omitempty,max=16"` - Email string `json:"email" binding:"omitempty,max=64"` - Ex string `json:"ex" binding:"omitempty,max=1024"` -} - -func newUserRegisterReq(params *paramsUserRegister) *pbAuth.UserRegisterReq { - pbData := pbAuth.UserRegisterReq{ - UID: params.UID, - Name: params.Name, - Icon: params.Icon, - Gender: params.Gender, - Mobile: params.Mobile, - Birth: params.Birth, - Email: params.Email, - Ex: params.Ex, - } - return &pbData -} - -func UserRegister(c *gin.Context) { - log.Info("", "", "api user_register init ....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName) - client := pbAuth.NewAuthClient(etcdConn) - //defer etcdConn.Close() - - params := paramsUserRegister{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - if params.Secret != config.Config.Secret { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "not authorized"}) - return - } - pbData := newUserRegisterReq(¶ms) - - log.Info("", "", "api user_register is server, [data: %s]", pbData.String()) - reply, err := client.UserRegister(context.Background(), pbData) - if err != nil || !reply.Success { - log.Error("", "", "api user_register call rpc fail, [data: %s] [err: %s]", pbData.String(), err.Error()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) - return - } - log.Info("", "", "api user_register call rpc success, [data: %s] [reply: %s]", pbData.String(), reply.String()) - - pbDataToken := &pbAuth.UserTokenReq{ - Platform: params.Platform, - UID: params.UID, - } - replyToken, err := client.UserToken(context.Background(), pbDataToken) - if err != nil { - log.Error("", "", "api user_register call rpc fail, [data: %s] [err: %s]", pbData.String(), err.Error()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) - return - } - log.Info("", "", "api user_register call success, [data: %s] [reply: %s]", pbData.String(), reply.String()) - - if replyToken.ErrCode == 0 { - c.JSON(http.StatusOK, gin.H{ - "errCode": replyToken.ErrCode, - "errMsg": replyToken.ErrMsg, - "data": gin.H{ - "uid": pbData.UID, - "token": replyToken.Token, - "expiredTime": replyToken.ExpiredTime, - }, - }) - } else { - c.JSON(http.StatusOK, gin.H{ - "errCode": replyToken.ErrCode, - "errMsg": replyToken.ErrMsg, - }) - } -} diff --git a/internal/api/auth/user_token.go b/internal/api/auth/user_token.go deleted file mode 100644 index 31839b6b0..000000000 --- a/internal/api/auth/user_token.go +++ /dev/null @@ -1,72 +0,0 @@ -package apiAuth - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pbAuth "Open_IM/pkg/proto/auth" - "context" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -type paramsUserToken struct { - Secret string `json:"secret" binding:"required,max=32"` - Platform int32 `json:"platform" binding:"required,min=1,max=8"` - UID string `json:"uid" binding:"required,min=1,max=64"` -} - -func newUserTokenReq(params *paramsUserToken) *pbAuth.UserTokenReq { - pbData := pbAuth.UserTokenReq{ - Platform: params.Platform, - UID: params.UID, - } - return &pbData -} - -func UserToken(c *gin.Context) { - log.Info("", "", "api user_token init ....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImAuthName) - client := pbAuth.NewAuthClient(etcdConn) - //defer etcdConn.Close() - - params := paramsUserToken{} - if err := c.BindJSON(¶ms); err != nil { - log.Error("", "", params.UID, params.Platform, params.Secret) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - if params.Secret != config.Config.Secret { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "not authorized"}) - return - } - pbData := newUserTokenReq(¶ms) - - log.Info("", "", "api user_token is server, [data: %s]", pbData.String()) - reply, err := client.UserToken(context.Background(), pbData) - if err != nil { - log.Error("", "", "api user_token call rpc fail, [data: %s] [err: %s]", pbData.String(), err.Error()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) - return - } - log.Info("", "", "api user_token call rpc success, [data: %s] [reply: %s]", pbData.String(), reply.String()) - - if reply.ErrCode == 0 { - c.JSON(http.StatusOK, gin.H{ - "errCode": reply.ErrCode, - "errMsg": reply.ErrMsg, - "data": gin.H{ - "uid": pbData.UID, - "token": reply.Token, - "expiredTime": reply.ExpiredTime, - }, - }) - } else { - c.JSON(http.StatusOK, gin.H{ - "errCode": reply.ErrCode, - "errMsg": reply.ErrMsg, - }) - } - -} diff --git a/internal/api/chat/get_max_min_seq.go b/internal/api/chat/get_max_min_seq.go index 984497c18..95a4b1340 100644 --- a/internal/api/chat/get_max_min_seq.go +++ b/internal/api/chat/get_max_min_seq.go @@ -19,7 +19,7 @@ type paramsUserNewestSeq struct { MsgIncr int `json:"msgIncr" binding:"required"` } -func UserGetSeq(c *gin.Context) { +func GetSeq(c *gin.Context) { params := paramsUserNewestSeq{} if err := c.BindJSON(¶ms); err != nil { c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) diff --git a/internal/api/chat/pull_msg.go b/internal/api/chat/pull_msg.go index c0fa578e9..0872319c6 100644 --- a/internal/api/chat/pull_msg.go +++ b/internal/api/chat/pull_msg.go @@ -6,6 +6,7 @@ import ( "Open_IM/pkg/common/token_verify" "Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/proto/chat" + open_im_sdk "Open_IM/pkg/proto/sdk_ws" "context" "github.com/gin-gonic/gin" "net/http" @@ -22,64 +23,14 @@ type paramsUserPullMsg struct { } } -func UserPullMsg(c *gin.Context) { - params := paramsUserPullMsg{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - - token := c.Request.Header.Get("token") - if ok, err := token_verify.VerifyToken(token, params.SendID); !ok { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err" + err.Error()}) - return - } - pbData := pbChat.PullMessageReq{} - pbData.UserID = params.SendID - pbData.OperationID = params.OperationID - pbData.SeqBegin = *params.Data.SeqBegin - pbData.SeqEnd = *params.Data.SeqEnd - grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) - msgClient := pbChat.NewChatClient(grpcConn) - reply, err := msgClient.PullMessage(context.Background(), &pbData) - if err != nil { - log.NewError(params.OperationID, "UserPullMsg rpc failed, ", params, err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "UserPullMsg rpc failed, " + err.Error()}) - return - } - log.InfoByKv("rpc call success to pullMsgRep", pbData.OperationID, "ReplyArgs", reply.String(), "maxSeq", reply.GetMaxSeq(), - "MinSeq", reply.GetMinSeq(), "singLen", len(reply.GetSingleUserMsg()), "groupLen", len(reply.GetGroupUserMsg())) - - msg := make(map[string]interface{}) - if v := reply.GetSingleUserMsg(); v != nil { - msg["single"] = v - } else { - msg["single"] = []pbChat.GatherFormat{} - } - if v := reply.GetGroupUserMsg(); v != nil { - msg["group"] = v - } else { - msg["group"] = []pbChat.GatherFormat{} - } - msg["maxSeq"] = reply.GetMaxSeq() - msg["minSeq"] = reply.GetMinSeq() - c.JSON(http.StatusOK, gin.H{ - "errCode": reply.ErrCode, - "errMsg": reply.ErrMsg, - "reqIdentifier": *params.ReqIdentifier, - "data": msg, - }) - -} - type paramsUserPullMsgBySeqList struct { - ReqIdentifier int `json:"reqIdentifier" binding:"required"` - SendID string `json:"sendID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` - SeqList []int64 `json:"seqList"` + ReqIdentifier int `json:"reqIdentifier" binding:"required"` + SendID string `json:"sendID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` + SeqList []uint32 `json:"seqList"` } -func UserPullMsgBySeqList(c *gin.Context) { +func PullMsgBySeqList(c *gin.Context) { params := paramsUserPullMsgBySeqList{} if err := c.BindJSON(¶ms); err != nil { c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) @@ -91,7 +42,7 @@ func UserPullMsgBySeqList(c *gin.Context) { c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err" + err.Error()}) return } - pbData := pbChat.PullMessageBySeqListReq{} + pbData := open_im_sdk.PullMessageBySeqListReq{} pbData.UserID = params.SendID pbData.OperationID = params.OperationID pbData.SeqList = params.SeqList @@ -103,26 +54,11 @@ func UserPullMsgBySeqList(c *gin.Context) { log.ErrorByKv("PullMessageBySeqList error", pbData.OperationID, "err", err.Error()) return } - log.InfoByKv("rpc call success to PullMessageBySeqList", pbData.OperationID, "ReplyArgs", reply.String(), "maxSeq", reply.GetMaxSeq(), - "MinSeq", reply.GetMinSeq(), "singLen", len(reply.GetSingleUserMsg()), "groupLen", len(reply.GetGroupUserMsg())) - - msg := make(map[string]interface{}) - if v := reply.GetSingleUserMsg(); v != nil { - msg["single"] = v - } else { - msg["single"] = []pbChat.GatherFormat{} - } - if v := reply.GetGroupUserMsg(); v != nil { - msg["group"] = v - } else { - msg["group"] = []pbChat.GatherFormat{} - } - msg["maxSeq"] = reply.GetMaxSeq() - msg["minSeq"] = reply.GetMinSeq() + log.InfoByKv("rpc call success to PullMessageBySeqList", pbData.OperationID, "ReplyArgs", reply.String(), len(reply.List)) c.JSON(http.StatusOK, gin.H{ "errCode": reply.ErrCode, "errMsg": reply.ErrMsg, "reqIdentifier": params.ReqIdentifier, - "data": msg, + "data": reply.List, }) } diff --git a/internal/api/chat/send_msg.go b/internal/api/chat/send_msg.go index e48582eb1..a28dcd1ce 100644 --- a/internal/api/chat/send_msg.go +++ b/internal/api/chat/send_msg.go @@ -4,7 +4,7 @@ import ( "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" pbChat "Open_IM/pkg/proto/chat" - "Open_IM/pkg/utils" + open_im_sdk "Open_IM/pkg/proto/sdk_ws" "context" "Open_IM/pkg/grpc-etcdv3/getcdv3" @@ -14,50 +14,51 @@ import ( ) type paramsUserSendMsg struct { - ReqIdentifier int32 `json:"reqIdentifier" binding:"required"` - PlatformID int32 `json:"platformID" binding:"required"` - SendID string `json:"sendID" binding:"required"` - SenderNickName string `json:"senderNickName"` - SenderFaceURL string `json:"senderFaceUrl"` - OperationID string `json:"operationID" binding:"required"` - Data struct { - SessionType int32 `json:"sessionType" binding:"required"` - MsgFrom int32 `json:"msgFrom" binding:"required"` - ContentType int32 `json:"contentType" binding:"required"` - RecvID string `json:"recvID" binding:"required"` - ForceList []string `json:"forceList"` - Content string `json:"content" binding:"required"` - Options map[string]int32 `json:"options" ` - ClientMsgID string `json:"clientMsgID" binding:"required"` - OffLineInfo map[string]interface{} `json:"offlineInfo" ` - Ex map[string]interface{} `json:"ext"` + SenderPlatformID int32 `json:"senderPlatformID" binding:"required"` + SendID string `json:"sendID" binding:"required"` + SenderNickName string `json:"senderNickName"` + SenderFaceURL string `json:"senderFaceUrl"` + OperationID string `json:"operationID" binding:"required"` + Data struct { + SessionType int32 `json:"sessionType" binding:"required"` + MsgFrom int32 `json:"msgFrom" binding:"required"` + ContentType int32 `json:"contentType" binding:"required"` + RecvID string `json:"recvID" ` + GroupID string `json:"groupID" ` + ForceList []string `json:"forceList"` + Content []byte `json:"content" binding:"required"` + Options map[string]bool `json:"options" ` + ClientMsgID string `json:"clientMsgID" binding:"required"` + CreateTime int64 `json:"createTime" binding:"required"` + OffLineInfo *open_im_sdk.OfflinePushInfo `json:"offlineInfo" ` } } -func newUserSendMsgReq(token string, params *paramsUserSendMsg) *pbChat.UserSendMsgReq { - pbData := pbChat.UserSendMsgReq{ - ReqIdentifier: params.ReqIdentifier, - Token: token, - SendID: params.SendID, - SenderNickName: params.SenderNickName, - SenderFaceURL: params.SenderFaceURL, - OperationID: params.OperationID, - PlatformID: params.PlatformID, - SessionType: params.Data.SessionType, - MsgFrom: params.Data.MsgFrom, - ContentType: params.Data.ContentType, - RecvID: params.Data.RecvID, - ForceList: params.Data.ForceList, - Content: params.Data.Content, - Options: utils.MapIntToJsonString(params.Data.Options), - ClientMsgID: params.Data.ClientMsgID, - OffLineInfo: utils.MapToJsonString(params.Data.OffLineInfo), - Ex: utils.MapToJsonString(params.Data.Ex), +func newUserSendMsgReq(token string, params *paramsUserSendMsg) *pbChat.SendMsgReq { + pbData := pbChat.SendMsgReq{ + Token: token, + OperationID: params.OperationID, + MsgData: &open_im_sdk.MsgData{ + SendID: params.SendID, + RecvID: params.Data.RecvID, + GroupID: params.Data.GroupID, + ClientMsgID: params.Data.ClientMsgID, + SenderPlatformID: params.SenderPlatformID, + SenderNickname: params.SenderNickName, + SenderFaceURL: params.SenderFaceURL, + SessionType: params.Data.SessionType, + MsgFrom: params.Data.MsgFrom, + ContentType: params.Data.ContentType, + Content: params.Data.Content, + CreateTime: params.Data.CreateTime, + Options: params.Data.Options, + OfflinePushInfo: params.Data.OffLineInfo, + }, } return &pbData } -func UserSendMsg(c *gin.Context) { +func SendMsg(c *gin.Context) { params := paramsUserSendMsg{} if err := c.BindJSON(¶ms); err != nil { c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) @@ -70,25 +71,24 @@ func UserSendMsg(c *gin.Context) { log.InfoByKv("api call success to sendMsgReq", params.OperationID, "Parameters", params) pbData := newUserSendMsgReq(token, ¶ms) - log.Info("", "", "api UserSendMsg call start..., [data: %s]", pbData.String()) + log.Info("", "", "api SendMsg call start..., [data: %s]", pbData.String()) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) client := pbChat.NewChatClient(etcdConn) - log.Info("", "", "api UserSendMsg call, api call rpc...") + log.Info("", "", "api SendMsg call, api call rpc...") - reply, err := client.UserSendMsg(context.Background(), pbData) + reply, err := client.SendMsg(context.Background(), pbData) if err != nil { - log.NewError(params.OperationID, "UserSendMsg rpc failed, ", params, err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "UserSendMsg rpc failed, " + err.Error()}) + log.NewError(params.OperationID, "SendMsg rpc failed, ", params, err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "SendMsg rpc failed, " + err.Error()}) return } - log.Info("", "", "api UserSendMsg call end..., [data: %s] [reply: %s]", pbData.String(), reply.String()) + log.Info("", "", "api SendMsg call end..., [data: %s] [reply: %s]", pbData.String(), reply.String()) c.JSON(http.StatusOK, gin.H{ - "errCode": reply.ErrCode, - "errMsg": reply.ErrMsg, - "reqIdentifier": reply.ReqIdentifier, + "errCode": reply.ErrCode, + "errMsg": reply.ErrMsg, "data": gin.H{ "clientMsgID": reply.ClientMsgID, "serverMsgID": reply.ServerMsgID, diff --git a/internal/api/conversation/conversation.go b/internal/api/conversation/conversation.go index 4e4316b05..d29e47c09 100644 --- a/internal/api/conversation/conversation.go +++ b/internal/api/conversation/conversation.go @@ -1,11 +1,13 @@ package conversation import ( + api "Open_IM/pkg/base_info" "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/proto/user" + rpc "Open_IM/pkg/proto/user" "Open_IM/pkg/utils" "context" "github.com/gin-gonic/gin" @@ -13,182 +15,110 @@ import ( "strings" ) -type paramsSetReceiveMessageOpt struct { - OperationID string `json:"operationID" binding:"required"` - Option *int32 `json:"option" binding:"required"` - ConversationIdList []string `json:"conversationIdList" binding:"required"` -} - -type OptResult struct { - ConversationId string `json:"conversationId" binding:"required"` - Result int32 `json:"result" binding:"required"` -} - -type SetReceiveMessageOptResp struct { - ErrCode int32 `json:"errCode"` - ErrMsg string `json:"errMsg"` - Data []OptResult `json:"data"` -} - -type paramGetReceiveMessageOpt struct { - ConversationIdList []string `json:"conversationIdList" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} - -type GetReceiveMessageOptResp struct { - SetReceiveMessageOptResp -} - -type paramGetAllConversationMessageOpt struct { - OperationID string `json:"operationID" binding:"required"` -} - -type GetAllConversationMessageOptResp struct { - SetReceiveMessageOptResp -} - -//CopyStructFields - func GetAllConversationMessageOpt(c *gin.Context) { - params := paramGetAllConversationMessageOpt{} + params := api.GetAllConversationMessageOptReq{} 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": "bind json failed " + err.Error()}) return } - - claims, err := token_verify.ParseToken(c.Request.Header.Get("token")) - if err != nil { - log.NewError(params.OperationID, "ParseToken failed, ", err.Error(), c.Request.Header.Get("token")) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "ParseToken failed, " + err.Error()}) + req := &rpc.GetAllConversationMsgOptReq{} + utils.CopyStructFields(req, ¶ms) + 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 or not set token in header"}) return } - - req := &user.GetAllConversationMsgOptReq{ - UId: claims.UID, - OperationID: params.OperationID, - } - log.NewInfo(req.OperationID, "GetAllConversationMsgOpt req: ", req) + log.NewInfo(params.OperationID, "GetAllConversationMessageOpt args ", req.String()) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) client := user.NewUserClient(etcdConn) - resp, err := client.GetAllConversationMsgOpt(context.Background(), req) + RpcResp, err := client.GetAllConversationMsgOpt(context.Background(), req) if err != nil { log.NewError(params.OperationID, "GetAllConversationMsgOpt rpc failed, ", req, err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "GetAllConversationMsgOpt rpc failed, " + err.Error()}) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": "GetAllConversationMsgOpt rpc failed, " + err.Error()}) return } - var ginResp GetAllConversationMessageOptResp - ginResp.ErrCode = resp.ErrCode - ginResp.ErrMsg = resp.ErrMsg - for _, v := range resp.ConversationOptResult { - var opt OptResult - err := utils.CopyStructFields(&opt, *v, "ConversationId", "Result") - if err != nil { - log.NewError(req.OperationID, "CopyStructFields failed ", err.Error()) - continue - } - ginResp.Data = append(ginResp.Data, opt) + optResult := make([]*api.OptResult, 0) + for _, v := range RpcResp.ConversationOptResultList { + temp := new(api.OptResult) + temp.ConversationID = v.ConversationID + temp.Result = &v.Result + optResult = append(optResult, temp) } - log.NewInfo(req.OperationID, "GetAllConversationMsgOpt resp: ", ginResp, req) - c.JSON(http.StatusOK, ginResp) + resp := api.GetAllConversationMessageOptResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, ConversationOptResultList: optResult} + log.NewInfo(req.OperationID, "GetAllConversationMsgOpt api return: ", resp) + c.JSON(http.StatusOK, resp) } func GetReceiveMessageOpt(c *gin.Context) { - params := paramGetReceiveMessageOpt{} + params := api.GetReceiveMessageOptReq{} 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": "bind json failed " + err.Error()}) return } - - claims, err := token_verify.ParseToken(c.Request.Header.Get("token")) - if err != nil { - log.NewError(params.OperationID, "ParseToken failed, ", err.Error(), c.Request.Header.Get("token")) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "ParseToken failed, " + err.Error()}) + req := &rpc.GetReceiveMessageOptReq{} + utils.CopyStructFields(req, ¶ms) + 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 } - - req := &user.GetReceiveMessageOptReq{ - UId: claims.UID, - ConversationId: params.ConversationIdList, - OperationID: params.OperationID, - } - log.NewInfo(req.OperationID, "GetReceiveMessageOptReq req: ", req) + log.NewInfo(params.OperationID, "GetReceiveMessageOpt args ", req.String()) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) client := user.NewUserClient(etcdConn) - resp, err := client.GetReceiveMessageOpt(context.Background(), req) + RpcResp, err := client.GetReceiveMessageOpt(context.Background(), req) if err != nil { log.NewError(params.OperationID, "GetReceiveMessageOpt rpc failed, ", req, err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "GetReceiveMessageOpt rpc failed, " + err.Error()}) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": "GetReceiveMessageOpt rpc failed, " + err.Error()}) return } - log.NewInfo(req.OperationID, "GetReceiveMessageOptReq req: ", req, resp) - var ginResp GetReceiveMessageOptResp - ginResp.ErrCode = resp.ErrCode - ginResp.ErrMsg = resp.ErrMsg - - for _, v := range resp.ConversationOptResult { - var opt OptResult - log.NewInfo("CopyStructFields begin ", v, req.OperationID) - err := utils.CopyStructFields(&opt, *v, "ConversationId", "Result") - log.NewInfo("CopyStructFields end ", v, req.OperationID) - if err != nil { - log.NewError(req.OperationID, "CopyStructFields failed ", err.Error()) - continue - } - ginResp.Data = append(ginResp.Data, opt) + optResult := make([]*api.OptResult, 0) + for _, v := range RpcResp.ConversationOptResultList { + temp := new(api.OptResult) + temp.ConversationID = v.ConversationID + temp.Result = &v.Result + optResult = append(optResult, temp) } - log.NewInfo(req.OperationID, "GetReceiveMessageOpt resp: ", ginResp) - c.JSON(http.StatusOK, ginResp) + resp := api.GetReceiveMessageOptResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, ConversationOptResultList: optResult} + log.NewInfo(req.OperationID, "GetReceiveMessageOpt api return: ", resp) + c.JSON(http.StatusOK, resp) } func SetReceiveMessageOpt(c *gin.Context) { - params := paramsSetReceiveMessageOpt{} + params := api.SetReceiveMessageOptReq{} 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": "bind json failed " + err.Error()}) return } - - claims, err := token_verify.ParseToken(c.Request.Header.Get("token")) - if err != nil { - log.NewError(params.OperationID, "ParseToken failed, ", err.Error(), c.Request.Header.Get("token")) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "ParseToken failed, " + err.Error()}) + req := &rpc.SetReceiveMessageOptReq{} + utils.CopyStructFields(req, ¶ms) + 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 } - - req := &user.SetReceiveMessageOptReq{ - UId: claims.UID, - Opt: *params.Option, - ConversationId: params.ConversationIdList, - OperationID: params.OperationID, - } - log.NewInfo(req.OperationID, "SetReceiveMessageOpt req: ", req) + log.NewInfo(params.OperationID, "SetReceiveMessageOpt args ", req.String()) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) client := user.NewUserClient(etcdConn) - resp, err := client.SetReceiveMessageOpt(context.Background(), req) + RpcResp, err := client.SetReceiveMessageOpt(context.Background(), req) if err != nil { log.NewError(params.OperationID, "SetReceiveMessageOpt rpc failed, ", req, err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "SetReceiveMessageOpt rpc failed, " + err.Error()}) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 500, "errMsg": "SetReceiveMessageOpt rpc failed, " + err.Error()}) return } - log.NewInfo(req.OperationID, "SetReceiveMessageOpt req: ", req, resp) - ginResp := SetReceiveMessageOptResp{ - ErrCode: resp.ErrCode, - ErrMsg: resp.ErrMsg, + optResult := make([]*api.OptResult, 0) + for _, v := range RpcResp.ConversationOptResultList { + temp := new(api.OptResult) + temp.ConversationID = v.ConversationID + temp.Result = &v.Result + optResult = append(optResult, temp) } - - for _, v := range resp.OptResult { - var opt OptResult - log.NewDebug("CopyStructFields begin ", v, req.OperationID) - err := utils.CopyStructFields(&opt, *v, "ConversationId", "Result") - log.NewDebug("CopyStructFields end ", v, req.OperationID) - if err != nil { - log.NewError(req.OperationID, "CopyStructFields failed ", err.Error()) - continue - } - ginResp.Data = append(ginResp.Data, opt) - } - log.NewInfo(req.OperationID, "SetReceiveMessageOpt resp: ", ginResp) - c.JSON(http.StatusOK, ginResp) + resp := api.SetReceiveMessageOptResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, ConversationOptResultList: optResult} + log.NewInfo(req.OperationID, "SetReceiveMessageOpt api return: ", resp) + c.JSON(http.StatusOK, resp) } diff --git a/internal/api/friend/add_blacklist.go b/internal/api/friend/add_blacklist.go deleted file mode 100644 index e5708c659..000000000 --- a/internal/api/friend/add_blacklist.go +++ /dev/null @@ -1,49 +0,0 @@ -package friend - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pbFriend "Open_IM/pkg/proto/friend" - "context" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -/* -type paramsAddBlackList struct { - OperationID string `json:"operationID" binding:"required"` - UID string `json:"uid" binding:"required"` -}*/ - -func AddBlacklist(c *gin.Context) { - log.Info("", "", "api add blacklist init ....") - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) - client := pbFriend.NewFriendClient(etcdConn) - //defer etcdConn.Close() - - params := paramsSearchFriend{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &pbFriend.AddBlacklistReq{ - Uid: params.UID, - OperationID: params.OperationID, - Token: c.Request.Header.Get("token"), - OwnerUid: params.OwnerUid, - } - log.Info(req.Token, req.OperationID, "api add blacklist is server:userID=%s", req.Uid) - RpcResp, err := client.AddBlacklist(context.Background(), req) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,call add blacklist rpc server failed", err) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add blacklist rpc server failed"}) - return - } - log.InfoByArgs("call add blacklist rpc server success,args=%s", RpcResp.String()) - resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg} - c.JSON(http.StatusOK, resp) - log.InfoByArgs("api add blacklist success return,get args=%s,return args=%s", req.String(), RpcResp.String()) -} diff --git a/internal/api/friend/add_friend.go b/internal/api/friend/add_friend.go deleted file mode 100644 index 8753a2350..000000000 --- a/internal/api/friend/add_friend.go +++ /dev/null @@ -1,88 +0,0 @@ -package friend - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pbFriend "Open_IM/pkg/proto/friend" - "context" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -type paramsImportFriendReq struct { - OperationID string `json:"operationID" binding:"required"` - UIDList []string `json:"uidList" binding:"required"` - OwnerUid string `json:"ownerUid" binding:"required"` -} - -type paramsAddFriend struct { - OperationID string `json:"operationID" binding:"required"` - UID string `json:"uid" binding:"required"` - ReqMessage string `json:"reqMessage"` -} - -// -func ImportFriend(c *gin.Context) { - log.Info("", "", "ImportFriend init ....") - log.NewDebug("", "api importFriend start") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) - client := pbFriend.NewFriendClient(etcdConn) - - params := paramsImportFriendReq{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &pbFriend.ImportFriendReq{ - UidList: params.UIDList, - OperationID: params.OperationID, - OwnerUid: params.OwnerUid, - Token: c.Request.Header.Get("token"), - } - log.NewDebug(req.OperationID, "args is ", req.String()) - RpcResp, err := client.ImportFriend(context.Background(), req) - if err != nil { - log.NewError(req.OperationID, "rpc importFriend failed", err.Error()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "cImportFriend failed " + err.Error()}) - return - } - failedUidList := make([]string, 0) - for _, v := range RpcResp.FailedUidList { - failedUidList = append(failedUidList, v) - } - log.NewDebug(req.OperationID, "rpc importFriend success", RpcResp.CommonResp.ErrorMsg, RpcResp.CommonResp.ErrorCode, RpcResp.FailedUidList) - c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.CommonResp.ErrorCode, "errMsg": RpcResp.CommonResp.ErrorMsg, "failedUidList": failedUidList}) -} - -func AddFriend(c *gin.Context) { - log.Info("", "", "api add friend init ....") - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) - client := pbFriend.NewFriendClient(etcdConn) - - params := paramsAddFriend{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &pbFriend.AddFriendReq{ - Uid: params.UID, - OperationID: params.OperationID, - ReqMessage: params.ReqMessage, - Token: c.Request.Header.Get("token"), - } - log.Info(req.Token, req.OperationID, "api add friend is server") - RpcResp, err := client.AddFriend(context.Background(), req) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,call add friend rpc server failed", err) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add friend rpc server failed"}) - return - } - log.InfoByArgs("call add friend rpc server success,args=%s", RpcResp.String()) - c.JSON(http.StatusOK, gin.H{ - "errCode": RpcResp.ErrorCode, - "errMsg": RpcResp.ErrorMsg, - }) -} diff --git a/internal/api/friend/add_friend_response.go b/internal/api/friend/add_friend_response.go deleted file mode 100644 index c29f2181e..000000000 --- a/internal/api/friend/add_friend_response.go +++ /dev/null @@ -1,49 +0,0 @@ -package friend - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pbFriend "Open_IM/pkg/proto/friend" - "context" - "fmt" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -type paramsAddFriendResponse struct { - OperationID string `json:"operationID" binding:"required"` - UID string `json:"uid" binding:"required"` - Flag int32 `json:"flag" binding:"required"` -} - -func AddFriendResponse(c *gin.Context) { - log.Info("", "", fmt.Sprintf("api add friend response init ....")) - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) - client := pbFriend.NewFriendClient(etcdConn) - //defer etcdConn.Close() - - params := paramsAddFriendResponse{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &pbFriend.AddFriendResponseReq{ - Uid: params.UID, - Flag: params.Flag, - OperationID: params.OperationID, - Token: c.Request.Header.Get("token"), - } - log.Info(req.Token, req.OperationID, "api add friend response is server:userID=%s", req.Uid) - RpcResp, err := client.AddFriendResponse(context.Background(), req) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,call add_friend_response rpc server failed", err) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add_friend_response rpc server failed"}) - return - } - log.InfoByArgs("call add friend response rpc server success,args=%s", RpcResp.String()) - c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg}) - log.InfoByArgs("api add friend response success return,get args=%s,return args=%s", req.String(), RpcResp.String()) -} diff --git a/internal/api/friend/delete_friend.go b/internal/api/friend/delete_friend.go deleted file mode 100644 index daf81f340..000000000 --- a/internal/api/friend/delete_friend.go +++ /dev/null @@ -1,48 +0,0 @@ -package friend - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pbFriend "Open_IM/pkg/proto/friend" - "context" - "fmt" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -type paramsDeleteFriend struct { - OperationID string `json:"operationID" binding:"required"` - UID string `json:"uid" binding:"required"` -} - -func DeleteFriend(c *gin.Context) { - log.Info("", "", fmt.Sprintf("api delete_friend init ....")) - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) - client := pbFriend.NewFriendClient(etcdConn) - //defer etcdConn.Close() - - params := paramsDeleteFriend{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &pbFriend.DeleteFriendReq{ - Uid: params.UID, - OperationID: params.OperationID, - Token: c.Request.Header.Get("token"), - } - log.Info(req.Token, req.OperationID, "api delete_friend is server:%s", req.Uid) - RpcResp, err := client.DeleteFriend(context.Background(), req) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,call delete_friend rpc server failed", err) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call delete_friend rpc server failed"}) - return - } - log.InfoByArgs("call delete_friend rpc server,args=%s", RpcResp.String()) - resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg} - c.JSON(http.StatusOK, resp) - log.InfoByArgs("api delete_friend success return,get args=%s,return args=%s", req.String(), RpcResp.String()) -} diff --git a/internal/api/friend/friend.go b/internal/api/friend/friend.go new file mode 100644 index 000000000..1c6b0a9b2 --- /dev/null +++ b/internal/api/friend/friend.go @@ -0,0 +1,456 @@ +package friend + +import ( + jsonData "Open_IM/internal/utils" + api "Open_IM/pkg/base_info" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/common/token_verify" + "Open_IM/pkg/grpc-etcdv3/getcdv3" + rpc "Open_IM/pkg/proto/friend" + open_im_sdk "Open_IM/pkg/proto/sdk_ws" + "Open_IM/pkg/utils" + "context" + "github.com/gin-gonic/gin" + "net/http" + "strings" +) + +func AddBlack(c *gin.Context) { + params := api.AddBlacklistReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + req := &rpc.AddBlacklistReq{CommID: &rpc.CommID{}} + utils.CopyStructFields(req.CommID, ¶ms) + 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()) + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + client := rpc.NewFriendClient(etcdConn) + RpcResp, err := client.AddBlacklist(context.Background(), req) + if err != nil { + log.NewError(req.CommID.OperationID, "AddBlacklist failed ", err.Error()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add blacklist rpc server failed"}) + return + } + resp := api.AddBlacklistResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} + log.NewInfo(req.CommID.OperationID, "AddBlacklist api return ", resp) + c.JSON(http.StatusOK, resp) +} + +func ImportFriend(c *gin.Context) { + params := api.ImportFriendReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + req := &rpc.ImportFriendReq{} + utils.CopyStructFields(req, ¶ms) + 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(req.OperationID, "ImportFriend args ", req.String()) + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + client := rpc.NewFriendClient(etcdConn) + RpcResp, err := client.ImportFriend(context.Background(), req) + if err != nil { + log.NewError(req.OperationID, "ImportFriend failed ", err.Error(), req.String()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "ImportFriend failed "}) + return + } + resp := api.ImportFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} + if resp.ErrCode == 0 { + for _, v := range RpcResp.UserIDResultList { + resp.UserIDResultList = append(resp.UserIDResultList, api.UserIDResult{UserID: v.UserID, Result: v.Result}) + } + } + if len(resp.UserIDResultList) == 0 { + resp.UserIDResultList = []api.UserIDResult{} + } + log.NewInfo(req.OperationID, "ImportFriend api return ", resp) + c.JSON(http.StatusOK, resp) +} + +func AddFriend(c *gin.Context) { + params := api.AddFriendReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + req := &rpc.AddFriendReq{CommID: &rpc.CommID{}} + utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) + req.ReqMsg = params.ReqMsg + 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(req.CommID.OperationID, "AddFriend args ", req.String()) + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + client := rpc.NewFriendClient(etcdConn) + RpcResp, err := client.AddFriend(context.Background(), req) + if err != nil { + log.NewError(req.CommID.OperationID, "AddFriend failed ", err.Error(), req.String()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call AddFriend rpc server failed"}) + return + } + + resp := api.AddFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} + log.NewInfo(req.CommID.OperationID, "AddFriend api return ", resp) + c.JSON(http.StatusOK, resp) +} + +func AddFriendResponse(c *gin.Context) { + params := api.AddFriendResponseReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + req := &rpc.AddFriendResponseReq{CommID: &rpc.CommID{}} + utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) + req.HandleMsg = params.HandleMsg + req.HandleResult = params.Flag + 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 + } + utils.CopyStructFields(req, ¶ms) + log.NewInfo(req.CommID.OperationID, "AddFriendResponse args ", req.String()) + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + client := rpc.NewFriendClient(etcdConn) + RpcResp, err := client.AddFriendResponse(context.Background(), req) + if err != nil { + log.NewError(req.CommID.OperationID, "AddFriendResponse failed ", err.Error(), req.String()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add_friend_response rpc server failed"}) + return + } + + resp := api.AddFriendResponseResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} + log.NewInfo(req.CommID.OperationID, "AddFriendResponse api return ", resp) + c.JSON(http.StatusOK, resp) +} + +func DeleteFriend(c *gin.Context) { + params := api.DeleteFriendReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + req := &rpc.DeleteFriendReq{CommID: &rpc.CommID{}} + utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) + 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(req.CommID.OperationID, "DeleteFriend args ", req.String()) + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + client := rpc.NewFriendClient(etcdConn) + RpcResp, err := client.DeleteFriend(context.Background(), req) + if err != nil { + log.NewError(req.CommID.OperationID, "DeleteFriend failed ", err, req.String()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call delete_friend rpc server failed"}) + return + } + + resp := api.DeleteFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} + log.NewInfo(req.CommID.OperationID, "DeleteFriend api return ", resp) + c.JSON(http.StatusOK, resp) +} + +func GetBlacklist(c *gin.Context) { + params := api.GetBlackListReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + req := &rpc.GetBlacklistReq{CommID: &rpc.CommID{}} + utils.CopyStructFields(req.CommID, ¶ms) + 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(req.CommID.OperationID, "GetBlacklist args ", req.String()) + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + client := rpc.NewFriendClient(etcdConn) + RpcResp, err := client.GetBlacklist(context.Background(), req) + if err != nil { + log.NewError(req.CommID.OperationID, "GetBlacklist failed ", err.Error(), req.String()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get blacklist rpc server failed"}) + return + } + + resp := api.GetBlackListResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}} + for _, v := range RpcResp.BlackUserInfoList { + black := open_im_sdk.PublicUserInfo{} + utils.CopyStructFields(&black, v) + resp.BlackUserInfoList = append(resp.BlackUserInfoList, &black) + } + resp.Data = jsonData.JsonDataList(resp.BlackUserInfoList) + log.NewInfo(req.CommID.OperationID, "GetBlacklist api return ", resp) + c.JSON(http.StatusOK, resp) +} + +func SetFriendRemark(c *gin.Context) { + params := api.SetFriendRemarkReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + req := &rpc.SetFriendRemarkReq{CommID: &rpc.CommID{}} + utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) + req.Remark = params.Remark + 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(req.CommID.OperationID, "SetFriendComment args ", req.String()) + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + client := rpc.NewFriendClient(etcdConn) + RpcResp, err := client.SetFriendRemark(context.Background(), req) + if err != nil { + log.NewError(req.CommID.OperationID, "SetFriendComment failed ", err.Error(), req.String()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call set friend comment rpc server failed"}) + return + } + resp := api.SetFriendRemarkResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} + + log.NewInfo(req.CommID.OperationID, "SetFriendComment api return ", resp) + c.JSON(http.StatusOK, resp) +} + +func RemoveBlack(c *gin.Context) { + params := api.RemoveBlackListReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + req := &rpc.RemoveBlacklistReq{CommID: &rpc.CommID{}} + utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) + 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(req.CommID.OperationID, "RemoveBlacklist args ", req.String()) + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + client := rpc.NewFriendClient(etcdConn) + RpcResp, err := client.RemoveBlacklist(context.Background(), req) + if err != nil { + log.NewError(req.CommID.OperationID, "RemoveBlacklist failed ", err.Error(), req.String()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call remove blacklist rpc server failed"}) + return + } + resp := api.RemoveBlackListResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} + log.NewInfo(req.CommID.OperationID, "RemoveBlacklist api return ", resp) + c.JSON(http.StatusOK, resp) +} + +func IsFriend(c *gin.Context) { + params := api.IsFriendReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + req := &rpc.IsFriendReq{CommID: &rpc.CommID{}} + utils.CopyStructFields(req.CommID, ¶ms.ParamsCommFriend) + 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(req.CommID.OperationID, "IsFriend args ", req.String()) + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + client := rpc.NewFriendClient(etcdConn) + RpcResp, err := client.IsFriend(context.Background(), req) + if err != nil { + log.NewError(req.CommID.OperationID, "IsFriend failed ", err.Error(), req.String()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add friend rpc server failed"}) + return + } + resp := api.IsFriendResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}} + resp.Response.Friend = RpcResp.Response + + log.NewInfo(req.CommID.OperationID, "IsFriend api return ", resp) + c.JSON(http.StatusOK, resp) +} + +// +//func GetFriendsInfo(c *gin.Context) { +// params := api.GetFriendsInfoReq{} +// if err := c.BindJSON(¶ms); err != nil { +// log.NewError("0", "BindJSON failed ", err.Error()) +// c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) +// return +// } +// req := &rpc.GetFriendsInfoReq{} +// 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(req.CommID.OperationID, "GetFriendsInfo args ", req.String()) +// +// etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) +// client := rpc.NewFriendClient(etcdConn) +// RpcResp, err := client.GetFriendsInfo(context.Background(), req) +// if err != nil { +// log.NewError(req.CommID.OperationID, "GetFriendsInfo failed ", err.Error(), req.String()) +// c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call search friend rpc server failed"}) +// return +// } +// +// resp := api.GetFriendsInfoResp{CommResp:api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}} +// utils.CopyStructFields(&resp, RpcResp) +// c.JSON(http.StatusOK, resp) +// log.NewInfo(req.CommID.OperationID, "GetFriendsInfo api return ", resp) +//} + +func GetFriendList(c *gin.Context) { + params := api.GetFriendListReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + req := &rpc.GetFriendListReq{CommID: &rpc.CommID{}} + utils.CopyStructFields(req.CommID, ¶ms) + 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(req.CommID.OperationID, "GetFriendList args ", req.String()) + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + client := rpc.NewFriendClient(etcdConn) + RpcResp, err := client.GetFriendList(context.Background(), req) + if err != nil { + log.NewError(req.CommID.OperationID, "GetFriendList failed ", err.Error(), req.String()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get friend list rpc server failed"}) + return + } + + resp := api.GetFriendListResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, FriendInfoList: RpcResp.FriendInfoList} + resp.Data = jsonData.JsonDataList(resp.FriendInfoList) + log.NewInfo(req.CommID.OperationID, "GetFriendList api return ", resp) + c.JSON(http.StatusOK, resp) + //c.JSON(http.StatusOK, resp) +} + +func GetFriendApplyList(c *gin.Context) { + params := api.GetFriendApplyListReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + req := &rpc.GetFriendApplyListReq{CommID: &rpc.CommID{}} + utils.CopyStructFields(req.CommID, ¶ms) + 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(req.CommID.OperationID, "GetFriendApplyList args ", req.String()) + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + client := rpc.NewFriendClient(etcdConn) + + RpcResp, err := client.GetFriendApplyList(context.Background(), req) + if err != nil { + log.NewError(req.CommID.OperationID, "GetFriendApplyList failed ", err.Error(), req.String()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get friend apply list rpc server failed"}) + return + } + + resp := api.GetFriendApplyListResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, FriendRequestList: RpcResp.FriendRequestList} + resp.Data = jsonData.JsonDataList(resp.FriendRequestList) + log.NewInfo(req.CommID.OperationID, "GetFriendApplyList api return ", resp) + c.JSON(http.StatusOK, resp) +} + +func GetSelfFriendApplyList(c *gin.Context) { + params := api.GetSelfApplyListReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + req := &rpc.GetSelfApplyListReq{CommID: &rpc.CommID{}} + utils.CopyStructFields(req.CommID, ¶ms) + 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(req.CommID.OperationID, "GetSelfApplyList args ", req.String()) + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) + client := rpc.NewFriendClient(etcdConn) + RpcResp, err := client.GetSelfApplyList(context.Background(), req) + if err != nil { + log.NewError(req.CommID.OperationID, "GetSelfApplyList failed ", err.Error(), req.String()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get self apply list rpc server failed"}) + return + } + resp := api.GetSelfApplyListResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, FriendRequestList: RpcResp.FriendRequestList} + resp.Data = jsonData.JsonDataList(resp.FriendRequestList) + log.NewInfo(req.CommID.OperationID, "GetSelfApplyList api return ", resp) + c.JSON(http.StatusOK, resp) +} diff --git a/internal/api/friend/get_blcaklist.go b/internal/api/friend/get_blcaklist.go deleted file mode 100644 index 3b36dc107..000000000 --- a/internal/api/friend/get_blcaklist.go +++ /dev/null @@ -1,79 +0,0 @@ -package friend - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pbFriend "Open_IM/pkg/proto/friend" - "context" - "fmt" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -type paramsGetBlackList struct { - OperationID string `json:"operationID" binding:"required"` -} - -type blackListUserInfo 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"` -} - -func GetBlacklist(c *gin.Context) { - log.Info("", "", "api get blacklist init ....") - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) - client := pbFriend.NewFriendClient(etcdConn) - //defer etcdConn.Close() - - params := paramsGetBlackList{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &pbFriend.GetBlacklistReq{ - OperationID: params.OperationID, - Token: c.Request.Header.Get("token"), - } - log.Info(req.Token, req.OperationID, fmt.Sprintf("api get blacklist is server")) - RpcResp, err := client.GetBlacklist(context.Background(), req) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,call get_friend_list rpc server failed", err) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get blacklist rpc server failed"}) - return - } - log.InfoByArgs("call get blacklist rpc server success,args=%s", RpcResp.String()) - if RpcResp.ErrorCode == 0 { - userBlackList := make([]blackListUserInfo, 0) - for _, friend := range RpcResp.Data { - var fi blackListUserInfo - fi.UID = friend.Uid - fi.Name = friend.Name - fi.Icon = friend.Icon - fi.Gender = friend.Gender - fi.Mobile = friend.Mobile - fi.Birth = friend.Birth - fi.Email = friend.Email - fi.Ex = friend.Ex - userBlackList = append(userBlackList, fi) - } - resp := gin.H{ - "errCode": RpcResp.ErrorCode, - "errMsg": RpcResp.ErrorMsg, - "data": userBlackList, - } - c.JSON(http.StatusOK, resp) - } else { - resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg} - c.JSON(http.StatusOK, resp) - } - log.InfoByArgs("api get black list success return,get args=%s,return=%s", req.String(), RpcResp.String()) -} diff --git a/internal/api/friend/get_friend_apply_list.go b/internal/api/friend/get_friend_apply_list.go deleted file mode 100644 index 1ace2bcac..000000000 --- a/internal/api/friend/get_friend_apply_list.go +++ /dev/null @@ -1,129 +0,0 @@ -package friend - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pbFriend "Open_IM/pkg/proto/friend" - "context" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -type paramsGetApplyList struct { - OperationID string `json:"operationID" binding:"required"` -} -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"` - ReqMessage string `json:"reqMessage"` - ApplyTime string `json:"applyTime"` - Flag int32 `json:"flag"` -} - -func GetFriendApplyList(c *gin.Context) { - log.Info("", "", "api get_friend_apply_list init ....") - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) - client := pbFriend.NewFriendClient(etcdConn) - //defer etcdConn.Close() - - params := paramsGetApplyList{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &pbFriend.GetFriendApplyReq{ - OperationID: params.OperationID, - Token: c.Request.Header.Get("token"), - } - log.Info(req.Token, req.OperationID, "api get friend apply list is server") - RpcResp, err := client.GetFriendApplyList(context.Background(), req) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,call get friend apply list rpc server failed", err) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get friend apply list rpc server failed"}) - return - } - log.InfoByArgs("call get friend apply list rpc server success,args=%s", RpcResp.String()) - if RpcResp.ErrorCode == 0 { - userInfoList := make([]UserInfo, 0) - for _, applyUserinfo := range RpcResp.Data { - var un UserInfo - un.UID = applyUserinfo.Uid - un.Name = applyUserinfo.Name - un.Icon = applyUserinfo.Icon - un.Gender = applyUserinfo.Gender - un.Mobile = applyUserinfo.Mobile - un.Birth = applyUserinfo.Birth - un.Email = applyUserinfo.Email - un.Ex = applyUserinfo.Ex - un.Flag = applyUserinfo.Flag - un.ApplyTime = applyUserinfo.ApplyTime - un.ReqMessage = applyUserinfo.ReqMessage - userInfoList = append(userInfoList, un) - } - 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.InfoByArgs("api get friend apply list success return,get args=%s,return args=%s", req.String(), RpcResp.String()) -} - -func GetSelfApplyList(c *gin.Context) { - log.Info("", "", "api get self friend apply list init ....") - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) - client := pbFriend.NewFriendClient(etcdConn) - //defer etcdConn.Close() - - params := paramsGetApplyList{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &pbFriend.GetFriendApplyReq{ - OperationID: params.OperationID, - Token: c.Request.Header.Get("token"), - } - log.Info(req.Token, req.OperationID, "api get self apply list is server") - RpcResp, err := client.GetSelfApplyList(context.Background(), req) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,call get self apply list rpc server failed", err) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get self apply list rpc server failed"}) - return - } - log.InfoByArgs("call get self apply list rpc server success,args=%s", RpcResp.String()) - if RpcResp.ErrorCode == 0 { - userInfoList := make([]UserInfo, 0) - for _, selfApplyOtherUserinfo := range RpcResp.Data { - var un UserInfo - un.UID = selfApplyOtherUserinfo.Uid - un.Name = selfApplyOtherUserinfo.Name - un.Icon = selfApplyOtherUserinfo.Icon - un.Gender = selfApplyOtherUserinfo.Gender - un.Mobile = selfApplyOtherUserinfo.Mobile - un.Birth = selfApplyOtherUserinfo.Birth - un.Email = selfApplyOtherUserinfo.Email - un.Ex = selfApplyOtherUserinfo.Ex - un.Flag = selfApplyOtherUserinfo.Flag - un.ApplyTime = selfApplyOtherUserinfo.ApplyTime - un.ReqMessage = selfApplyOtherUserinfo.ReqMessage - userInfoList = append(userInfoList, un) - } - 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.InfoByArgs("api get self apply list success return,get args=%s,return args=%s", req.String(), RpcResp.String()) -} diff --git a/internal/api/friend/get_friend_list.go b/internal/api/friend/get_friend_list.go deleted file mode 100644 index 3c87e1ced..000000000 --- a/internal/api/friend/get_friend_list.go +++ /dev/null @@ -1,83 +0,0 @@ -package friend - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pbFriend "Open_IM/pkg/proto/friend" - "context" - "fmt" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -type paramsGetFriendLIst struct { - OperationID string `json:"operationID" binding:"required"` -} - -type friendInfo 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"` - Comment string `json:"comment"` - IsInBlackList int32 `json:"isInBlackList"` -} - -func GetFriendList(c *gin.Context) { - log.Info("", "", fmt.Sprintf("api get_friendlist init ....")) - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) - client := pbFriend.NewFriendClient(etcdConn) - //defer etcdConn.Close() - - params := paramsGetFriendLIst{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &pbFriend.GetFriendListReq{ - OperationID: params.OperationID, - Token: c.Request.Header.Get("token"), - } - log.Info(req.Token, req.OperationID, "api get friend list is server") - RpcResp, err := client.GetFriendList(context.Background(), req) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,call get friend list rpc server failed", err) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call get friend list rpc server failed"}) - return - } - log.InfoByArgs("call get friend list rpc server success,args=%s", RpcResp.String()) - if RpcResp.ErrorCode == 0 { - friendsInfo := make([]friendInfo, 0) - for _, friend := range RpcResp.Data { - var fi friendInfo - fi.UID = friend.Uid - fi.Name = friend.Name - fi.Icon = friend.Icon - fi.Gender = friend.Gender - fi.Mobile = friend.Mobile - fi.Birth = friend.Birth - fi.Email = friend.Email - fi.Ex = friend.Ex - fi.Comment = friend.Comment - fi.IsInBlackList = friend.IsInBlackList - friendsInfo = append(friendsInfo, fi) - } - resp := gin.H{ - "errCode": RpcResp.ErrorCode, - "errMsg": RpcResp.ErrorMsg, - "data": friendsInfo, - } - c.JSON(http.StatusOK, resp) - } else { - resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg} - c.JSON(http.StatusOK, resp) - } - log.InfoByArgs("api get friend list success return,get args=%s,return=%s", req.String(), RpcResp.String()) -} diff --git a/internal/api/friend/get_friends_info.go b/internal/api/friend/get_friends_info.go deleted file mode 100644 index 636d4db7c..000000000 --- a/internal/api/friend/get_friends_info.go +++ /dev/null @@ -1,70 +0,0 @@ -package friend - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pbFriend "Open_IM/pkg/proto/friend" - "context" - "fmt" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -type paramsSearchFriend struct { - OperationID string `json:"operationID" binding:"required"` - UID string `json:"uid" binding:"required"` - OwnerUid string `json:"ownerUid"` -} - -func GetFriendsInfo(c *gin.Context) { - log.Info("", "", fmt.Sprintf("api search friend init ....")) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) - client := pbFriend.NewFriendClient(etcdConn) - //defer etcdConn.Close() - - params := paramsSearchFriend{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &pbFriend.GetFriendsInfoReq{ - Uid: params.UID, - OperationID: params.OperationID, - Token: c.Request.Header.Get("token"), - } - log.Info(req.Token, req.OperationID, "api search_friend is server") - RpcResp, err := client.GetFriendsInfo(context.Background(), req) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,call search friend rpc server failed", err) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call search friend rpc server failed"}) - return - } - log.InfoByArgs("call search friend rpc server success,args=%s", RpcResp.String()) - if RpcResp.ErrorCode == 0 { - resp := gin.H{ - "errCode": RpcResp.ErrorCode, - "errMsg": RpcResp.ErrorMsg, - "data": gin.H{ - "uid": RpcResp.Data.Uid, - "icon": RpcResp.Data.Icon, - "name": RpcResp.Data.Name, - "gender": RpcResp.Data.Gender, - "mobile": RpcResp.Data.Mobile, - "birth": RpcResp.Data.Birth, - "email": RpcResp.Data.Email, - "ex": RpcResp.Data.Ex, - "comment": RpcResp.Data.Comment, - }, - } - c.JSON(http.StatusOK, resp) - } else { - resp := gin.H{ - "errCode": RpcResp.ErrorCode, - "errMsg": RpcResp.ErrorMsg, - } - c.JSON(http.StatusOK, resp) - } - log.InfoByArgs("api search_friend success return,get args=%s,return=%s", req.String(), RpcResp.String()) -} diff --git a/internal/api/friend/is_friend.go b/internal/api/friend/is_friend.go deleted file mode 100644 index e5e51ed8d..000000000 --- a/internal/api/friend/is_friend.go +++ /dev/null @@ -1,47 +0,0 @@ -package friend - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pbFriend "Open_IM/pkg/proto/friend" - "context" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -type paramsIsFriend struct { - OperationID string `json:"operationID" binding:"required"` - ReceiveUid string `json:"receive_uid"` -} - -func IsFriend(c *gin.Context) { - log.Info("", "", "api is friend init....") - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) - client := pbFriend.NewFriendClient(etcdConn) - //defer etcdConn.Close() - - params := paramsIsFriend{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &pbFriend.IsFriendReq{ - OperationID: params.OperationID, - ReceiveUid: params.OperationID, - Token: c.Request.Header.Get("token"), - } - log.Info(req.Token, req.OperationID, "api is friend is server") - RpcResp, err := client.IsFriend(context.Background(), req) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,call add friend rpc server failed", err) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call add friend rpc server failed"}) - return - } - log.InfoByArgs("call is friend rpc server success,args=%s", RpcResp.String()) - resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg, "isFriend": RpcResp.ShipType} - c.JSON(http.StatusOK, resp) - log.InfoByArgs("api is friend success return,get args=%s,return args=%s", req.String(), RpcResp.String()) -} diff --git a/internal/api/friend/remove_blacklist.go b/internal/api/friend/remove_blacklist.go deleted file mode 100644 index 6952da091..000000000 --- a/internal/api/friend/remove_blacklist.go +++ /dev/null @@ -1,47 +0,0 @@ -package friend - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pbFriend "Open_IM/pkg/proto/friend" - "context" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -type paramsRemoveBlackList struct { - OperationID string `json:"operationID" binding:"required"` - UID string `json:"uid" binding:"required"` -} - -func RemoveBlacklist(c *gin.Context) { - log.Info("", "", "api remove_blacklist init ....") - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) - client := pbFriend.NewFriendClient(etcdConn) - //defer etcdConn.Close() - - params := paramsRemoveBlackList{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &pbFriend.RemoveBlacklistReq{ - Uid: params.UID, - OperationID: params.OperationID, - Token: c.Request.Header.Get("token"), - } - log.Info(req.Token, req.OperationID, "api remove blacklist is server:userID=%s", req.Uid) - RpcResp, err := client.RemoveBlacklist(context.Background(), req) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,call remove blacklist rpc server failed", err) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call remove blacklist rpc server failed"}) - return - } - log.InfoByArgs("call remove blacklist rpc server success,args=%s", RpcResp.String()) - resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg} - c.JSON(http.StatusOK, resp) - log.InfoByArgs("api remove blacklist success return,get args=%s,return args=%s", req.String(), RpcResp.String()) -} diff --git a/internal/api/friend/set_friend_comment.go b/internal/api/friend/set_friend_comment.go deleted file mode 100644 index 77fe3411f..000000000 --- a/internal/api/friend/set_friend_comment.go +++ /dev/null @@ -1,48 +0,0 @@ -package friend - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pbFriend "Open_IM/pkg/proto/friend" - "context" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -type paramsSetFriendComment struct { - OperationID string `json:"operationID" binding:"required"` - UID string `json:"uid" binding:"required"` - Comment string `json:"comment"` -} - -func SetFriendComment(c *gin.Context) { - log.Info("", "", "api set friend comment init ....") - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImFriendName) - client := pbFriend.NewFriendClient(etcdConn) - //defer etcdConn.Close() - - params := paramsSetFriendComment{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &pbFriend.SetFriendCommentReq{ - Uid: params.UID, - OperationID: params.OperationID, - Comment: params.Comment, - Token: c.Request.Header.Get("token"), - } - log.Info(req.Token, req.OperationID, "api set friend comment is server") - RpcResp, err := client.SetFriendComment(context.Background(), req) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,call set friend comment rpc server failed", err) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call set friend comment rpc server failed"}) - return - } - log.Info("", "", "call set friend comment rpc server success,args=%s", RpcResp.String()) - c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg}) - log.Info("", "", "api set friend comment success return,get args=%s,return args=%s", req.String(), RpcResp.String()) -} diff --git a/internal/api/group/create_group.go b/internal/api/group/create_group.go deleted file mode 100644 index 564aee400..000000000 --- a/internal/api/group/create_group.go +++ /dev/null @@ -1,61 +0,0 @@ -package group - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pb "Open_IM/pkg/proto/group" - "context" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -type paramsCreateGroupStruct struct { - MemberList []*pb.GroupAddMemberInfo `json:"memberList"` - GroupName string `json:"groupName"` - Introduction string `json:"introduction"` - Notification string `json:"notification"` - FaceUrl string `json:"faceUrl"` - OperationID string `json:"operationID" binding:"required"` - Ex string `json:"ex"` -} - -func CreateGroup(c *gin.Context) { - log.Info("", "", "api create group init ....") - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) - client := pb.NewGroupClient(etcdConn) - //defer etcdConn.Close() - - params := paramsCreateGroupStruct{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &pb.CreateGroupReq{ - MemberList: params.MemberList, - GroupName: params.GroupName, - Introduction: params.Introduction, - Notification: params.Notification, - FaceUrl: params.FaceUrl, - OperationID: params.OperationID, - Ex: params.Ex, - Token: c.Request.Header.Get("token"), - } - log.Info(req.Token, req.OperationID, "api create group is server,params=%s", req.String()) - RpcResp, err := client.CreateGroup(context.Background(), req) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,call create group rpc server failed", err.Error()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"}) - return - } - log.InfoByArgs("call create group rpc server success,args=%s", RpcResp.String()) - if RpcResp.ErrorCode == 0 { - resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg, "data": gin.H{"groupID": RpcResp.GroupID}} - c.JSON(http.StatusOK, resp) - } else { - c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg}) - } - log.InfoByArgs("api create group success return,get args=%s,return args=%s", req.String(), RpcResp.String()) -} diff --git a/internal/api/group/get_group_applicationList.go b/internal/api/group/get_group_applicationList.go deleted file mode 100644 index a9fa1c73c..000000000 --- a/internal/api/group/get_group_applicationList.go +++ /dev/null @@ -1,113 +0,0 @@ -package group - -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/proto/group" - "context" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -type paramsGroupApplicationList struct { - OperationID string `json:"operationID" binding:"required"` -} - -func newUserRegisterReq(params *paramsGroupApplicationList) *group.GetGroupApplicationListReq { - pbData := group.GetGroupApplicationListReq{ - OperationID: params.OperationID, - } - return &pbData -} - -type paramsGroupApplicationListRet struct { - ID string `json:"id"` - GroupID string `json:"groupID"` - FromUserID string `json:"fromUserID"` - ToUserID string `json:"toUserID"` - Flag int32 `json:"flag"` - RequestMsg string `json:"reqMsg"` - HandledMsg string `json:"handledMsg"` - AddTime int64 `json:"createTime"` - FromUserNickname string `json:"fromUserNickName"` - ToUserNickname string `json:"toUserNickName"` - FromUserFaceUrl string `json:"fromUserFaceURL"` - ToUserFaceUrl string `json:"toUserFaceURL"` - HandledUser string `json:"handledUser"` - Type int32 `json:"type"` - HandleStatus int32 `json:"handleStatus"` - HandleResult int32 `json:"handleResult"` -} - -func GetGroupApplicationList(c *gin.Context) { - log.Info("", "", "api GetGroupApplicationList init ....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) - client := group.NewGroupClient(etcdConn) - //defer etcdConn.Close() - - params := paramsGroupApplicationList{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - pbData := newUserRegisterReq(¶ms) - - token := c.Request.Header.Get("token") - if claims, err := token_verify.ParseToken(token); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"}) - return - } else { - pbData.UID = claims.UID - } - - log.Info("", "", "api GetGroupApplicationList is server, [data: %s]", pbData.String()) - reply, err := client.GetGroupApplicationList(context.Background(), pbData) - if err != nil { - log.Error("", "", "api GetGroupApplicationList call rpc fail, [data: %s] [err: %s]", pbData.String(), err.Error()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) - return - } - log.Info("", "", "api GetGroupApplicationList call rpc success, [data: %s] [reply: %s]", pbData.String(), reply.String()) - - unProcessCount := 0 - userReq := make([]paramsGroupApplicationListRet, 0) - if reply != nil && reply.Data != nil && reply.Data.User != nil { - for i := 0; i < len(reply.Data.User); i++ { - req := paramsGroupApplicationListRet{} - req.ID = reply.Data.User[i].ID - req.GroupID = reply.Data.User[i].GroupID - req.FromUserID = reply.Data.User[i].FromUserID - req.ToUserID = reply.Data.User[i].ToUserID - req.Flag = reply.Data.User[i].Flag - req.RequestMsg = reply.Data.User[i].RequestMsg - req.HandledMsg = reply.Data.User[i].HandledMsg - req.AddTime = reply.Data.User[i].AddTime - req.FromUserNickname = reply.Data.User[i].FromUserNickname - req.ToUserNickname = reply.Data.User[i].ToUserNickname - req.FromUserFaceUrl = reply.Data.User[i].FromUserFaceUrl - req.ToUserFaceUrl = reply.Data.User[i].ToUserFaceUrl - req.HandledUser = reply.Data.User[i].HandledUser - req.Type = reply.Data.User[i].Type - req.HandleStatus = reply.Data.User[i].HandleStatus - req.HandleResult = reply.Data.User[i].HandleResult - userReq = append(userReq, req) - - if req.Flag == 0 { - unProcessCount++ - } - } - } - - c.JSON(http.StatusOK, gin.H{ - "errCode": reply.ErrCode, - "errMsg": reply.ErrMsg, - "data": gin.H{ - "count": unProcessCount, - "user": userReq, - }, - }) - -} diff --git a/internal/api/group/get_groups_info.go b/internal/api/group/get_groups_info.go deleted file mode 100644 index 251cd8b09..000000000 --- a/internal/api/group/get_groups_info.go +++ /dev/null @@ -1,67 +0,0 @@ -package group - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pb "Open_IM/pkg/proto/group" - "context" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -type paramsGetGroupInfo struct { - GroupIDList []string `json:"groupIDList" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} - -func GetGroupsInfo(c *gin.Context) { - log.Info("", "", "api get groups info init ....") - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) - client := pb.NewGroupClient(etcdConn) - //defer etcdConn.Close() - - params := paramsGetGroupInfo{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &pb.GetGroupsInfoReq{ - GroupIDList: params.GroupIDList, - Token: c.Request.Header.Get("token"), - OperationID: params.OperationID, - } - log.Info(req.Token, req.OperationID, "get groups info is server,params=%s", req.String()) - RpcResp, err := client.GetGroupsInfo(context.Background(), req) - if err != nil { - log.Error(req.Token, req.OperationID, "call get groups info rpc server failed,err=%s", err.Error()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"}) - return - } - log.InfoByArgs("call get groups info rpc server success", RpcResp.String()) - if RpcResp.ErrorCode == 0 { - groupsInfo := make([]pb.GroupInfo, 0) - for _, v := range RpcResp.Data { - var groupInfo pb.GroupInfo - groupInfo.GroupId = v.GroupId - groupInfo.GroupName = v.GroupName - groupInfo.Notification = v.Notification - groupInfo.Introduction = v.Introduction - groupInfo.FaceUrl = v.FaceUrl - groupInfo.CreateTime = v.CreateTime - groupInfo.OwnerId = v.OwnerId - groupInfo.MemberCount = v.MemberCount - - groupsInfo = append(groupsInfo, groupInfo) - } - c.JSON(http.StatusOK, gin.H{ - "errCode": RpcResp.ErrorCode, - "errMsg": RpcResp.ErrorMsg, - "data": groupsInfo, - }) - } else { - c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg}) - } -} diff --git a/internal/api/group/group.go b/internal/api/group/group.go index 0fd05b3bd..c7b725a9e 100644 --- a/internal/api/group/group.go +++ b/internal/api/group/group.go @@ -1,351 +1,508 @@ package group import ( + api "Open_IM/pkg/base_info" "Open_IM/pkg/common/config" "Open_IM/pkg/common/log" + "Open_IM/pkg/common/token_verify" "Open_IM/pkg/grpc-etcdv3/getcdv3" - pb "Open_IM/pkg/proto/group" + rpc "Open_IM/pkg/proto/group" + open_im_sdk "Open_IM/pkg/proto/sdk_ws" + "Open_IM/pkg/utils" "context" - "fmt" + "github.com/gin-gonic/gin" + "net/http" "strings" + + jsonData "Open_IM/internal/utils" ) -type InviteUserToGroupReq struct { - GroupID string `json:"groupID" binding:"required"` - UidList []string `json:"uidList" binding:"required"` - Reason string `json:"reason"` - OperationID string `json:"operationID" binding:"required"` -} - -type GetJoinedGroupListReq struct { - OperationID string `json:"operationID" binding:"required"` -} - -type KickGroupMemberReq struct { - GroupID string `json:"groupID"` - UidListInfo []*pb.GroupMemberFullInfo `json:"uidListInfo" binding:"required"` - Reason string `json:"reason"` - OperationID string `json:"operationID" binding:"required"` -} - func KickGroupMember(c *gin.Context) { - log.Info("", "", "KickGroupMember start....") - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) - client := pb.NewGroupClient(etcdConn) - - params := KickGroupMemberReq{} + params := api.KickGroupMemberReq{} if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) return } - req := &pb.KickGroupMemberReq{ - OperationID: params.OperationID, - GroupID: params.GroupID, - Token: c.Request.Header.Get("token"), - - UidListInfo: params.UidListInfo, + req := &rpc.KickGroupMemberReq{} + utils.CopyStructFields(req, ¶ms) + 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.Info(req.Token, req.OperationID, "recv req: ", req.String()) + log.NewInfo(req.OperationID, "KickGroupMember args ", req.String()) + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + client := rpc.NewGroupClient(etcdConn) RpcResp, err := client.KickGroupMember(context.Background(), req) if err != nil { - log.Error(req.Token, req.OperationID, "GetGroupMemberList failed, err: ", err.Error()) + log.NewError(req.OperationID, "GetGroupMemberList failed ", err.Error(), req.String()) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) return } - type KickGroupMemberResp struct { - ErrorCode int32 `json:"errCode"` - ErrorMsg string `json:"errMsg"` - Data []Id2Result `json:"data"` + var memberListResp api.KickGroupMemberResp + memberListResp.ErrMsg = RpcResp.ErrMsg + memberListResp.ErrCode = RpcResp.ErrCode + for _, v := range RpcResp.Id2ResultList { + memberListResp.UserIDResultList = append(memberListResp.UserIDResultList, &api.UserIDResult{UserID: v.UserID, Result: v.Result}) + } + if len(memberListResp.UserIDResultList) == 0 { + memberListResp.UserIDResultList = []*api.UserIDResult{} } - var memberListResp KickGroupMemberResp - memberListResp.ErrorMsg = RpcResp.ErrorMsg - memberListResp.ErrorCode = RpcResp.ErrorCode - for _, v := range RpcResp.Id2Result { - memberListResp.Data = append(memberListResp.Data, - Id2Result{UId: v.UId, - Result: v.Result}) - } + log.NewInfo(req.OperationID, "KickGroupMember api return ", memberListResp) c.JSON(http.StatusOK, memberListResp) } -type GetGroupMembersInfoReq struct { - GroupID string `json:"groupID"` - MemberList []string `json:"memberList"` - OperationID string `json:"operationID"` -} -type GetGroupMembersInfoResp struct { - ErrorCode int32 `json:"errCode"` - ErrorMsg string `json:"errMsg"` - Data []MemberResult `json:"data"` -} - func GetGroupMembersInfo(c *gin.Context) { - log.Info("", "", "GetGroupMembersInfo start....") - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) - client := pb.NewGroupClient(etcdConn) - - params := GetGroupMembersInfoReq{} + params := api.GetGroupMembersInfoReq{} if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) return } - - req := &pb.GetGroupMembersInfoReq{ - OperationID: params.OperationID, - GroupID: params.GroupID, - MemberList: params.MemberList, - Token: c.Request.Header.Get("token"), + req := &rpc.GetGroupMembersInfoReq{} + 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"}) + api.SetErrCodeMsg(c, http.StatusInternalServerError) + return } - log.Info(req.Token, req.OperationID, "recv req: ", len(params.MemberList)) + log.NewInfo(req.OperationID, "GetGroupMembersInfo args ", req.String()) + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + client := rpc.NewGroupClient(etcdConn) RpcResp, err := client.GetGroupMembersInfo(context.Background(), req) if err != nil { - log.Error(req.Token, req.OperationID, "GetGroupMemberList failed, err: ", err.Error()) + log.NewError(req.OperationID, "GetGroupMemberList failed ", err.Error(), req.String()) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) return } - var memberListResp GetGroupMembersInfoResp - memberListResp.ErrorMsg = RpcResp.ErrorMsg - memberListResp.ErrorCode = RpcResp.ErrorCode - for _, v := range RpcResp.MemberList { - memberListResp.Data = append(memberListResp.Data, - MemberResult{GroupId: req.GroupID, - UserId: v.UserId, - Role: v.Role, - JoinTime: uint64(v.JoinTime), - Nickname: v.NickName, - FaceUrl: v.FaceUrl}) - } + memberListResp := api.GetGroupMembersInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, MemberList: RpcResp.MemberList} + memberListResp.Data = jsonData.JsonDataList(RpcResp.MemberList) + log.NewInfo(req.OperationID, "GetGroupMembersInfo api return ", memberListResp) c.JSON(http.StatusOK, memberListResp) } -type GetGroupMemberListReq struct { - GroupID string `json:"groupID"` - Filter int32 `json:"filter"` - NextSeq int32 `json:"nextSeq"` - OperationID string `json:"operationID"` -} -type getGroupAllMemberReq struct { - GroupID string `json:"groupID"` - OperationID string `json:"operationID"` -} - -type MemberResult struct { - GroupId string `json:"groupID"` - UserId string `json:"userId"` - Role int32 `json:"role"` - JoinTime uint64 `json:"joinTime"` - Nickname string `json:"nickName"` - FaceUrl string `json:"faceUrl"` -} - func GetGroupMemberList(c *gin.Context) { - log.Info("", "", "GetGroupMemberList start....") - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) - client := pb.NewGroupClient(etcdConn) - - params := GetGroupMemberListReq{} + params := api.GetGroupMemberListReq{} if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) return } - req := &pb.GetGroupMemberListReq{ - OperationID: params.OperationID, - Filter: params.Filter, - NextSeq: params.NextSeq, - GroupID: params.GroupID, - Token: c.Request.Header.Get("token"), + req := &rpc.GetGroupMemberListReq{} + 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.Info(req.Token, req.OperationID, "recv req: ", req.String()) + log.NewInfo(req.OperationID, "GetGroupMemberList args ", req.String()) + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + client := rpc.NewGroupClient(etcdConn) + RpcResp, err := client.GetGroupMemberList(context.Background(), req) if err != nil { - log.Error(req.Token, req.OperationID, "GetGroupMemberList failed, err: ", err.Error()) + log.NewError(req.OperationID, "GetGroupMemberList failed, ", err.Error(), req.String()) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) return } - type GetGroupMemberListResp struct { - ErrorCode int32 `json:"errCode"` - ErrorMsg string `json:"errMsg"` - NextSeq int32 `json:"nextSeq"` - Data []MemberResult `json:"data"` - } + memberListResp := api.GetGroupMemberListResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, MemberList: RpcResp.MemberList, NextSeq: RpcResp.NextSeq} + memberListResp.Data = jsonData.JsonDataList(memberListResp.MemberList) - var memberListResp GetGroupMemberListResp - memberListResp.ErrorMsg = RpcResp.ErrorMsg - memberListResp.ErrorCode = RpcResp.ErrorCode - memberListResp.NextSeq = RpcResp.NextSeq - for _, v := range RpcResp.MemberList { - memberListResp.Data = append(memberListResp.Data, - MemberResult{GroupId: req.GroupID, - UserId: v.UserId, - Role: v.Role, - JoinTime: uint64(v.JoinTime), - Nickname: v.NickName, - FaceUrl: v.FaceUrl}) - } + log.NewInfo(req.OperationID, "GetGroupMemberList api return ", memberListResp) c.JSON(http.StatusOK, memberListResp) - } -func GetGroupAllMember(c *gin.Context) { - log.Info("", "", "GetGroupAllMember start....") - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) - client := pb.NewGroupClient(etcdConn) - - params := getGroupAllMemberReq{} +func GetGroupAllMemberList(c *gin.Context) { + params := api.GetGroupAllMemberReq{} if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) return } - req := &pb.GetGroupAllMemberReq{ - GroupID: params.GroupID, - OperationID: params.OperationID, - Token: c.Request.Header.Get("token"), + req := &rpc.GetGroupAllMemberReq{} + utils.CopyStructFields(req, ¶ms) + 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.Info(req.Token, req.OperationID, "recv req: ", req.String()) + log.NewInfo(req.OperationID, "GetGroupAllMember args ", req.String()) + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + client := rpc.NewGroupClient(etcdConn) RpcResp, err := client.GetGroupAllMember(context.Background(), req) if err != nil { - log.Error(req.Token, req.OperationID, "GetGroupAllMember failed, err: ", err.Error()) + log.NewError(req.OperationID, "GetGroupAllMember failed ", err.Error(), req.String()) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) return } - type GetGroupMemberListResp struct { - ErrorCode int32 `json:"errCode"` - ErrorMsg string `json:"errMsg"` - Data []MemberResult `json:"data"` - } - - var memberListResp GetGroupMemberListResp - memberListResp.ErrorMsg = RpcResp.ErrorMsg - memberListResp.ErrorCode = RpcResp.ErrorCode - for _, v := range RpcResp.MemberList { - memberListResp.Data = append(memberListResp.Data, - MemberResult{GroupId: req.GroupID, - UserId: v.UserId, - Role: v.Role, - JoinTime: uint64(v.JoinTime), - Nickname: v.NickName, - FaceUrl: v.FaceUrl}) - } + memberListResp := api.GetGroupAllMemberResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, MemberList: RpcResp.MemberList} + memberListResp.Data = jsonData.JsonDataList(memberListResp.MemberList) + log.NewInfo(req.OperationID, "GetGroupAllMember api return ", memberListResp) c.JSON(http.StatusOK, memberListResp) } -type groupResult struct { - GroupId string `json:"groupId"` - GroupName string `json:"groupName"` - Notification string `json:"notification"` - Introduction string `json:"introduction"` - FaceUrl string `json:"faceUrl"` - OwnerId string `json:"ownerId"` - CreateTime uint64 `json:"createTime"` - MemberCount uint32 `json:"memberCount"` -} - func GetJoinedGroupList(c *gin.Context) { - log.Info("", "", "GetJoinedGroupList start....") - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) - fmt.Println("config: ", etcdConn, config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) - client := pb.NewGroupClient(etcdConn) - - params := GetJoinedGroupListReq{} + params := api.GetJoinedGroupListReq{} if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) return } - req := &pb.GetJoinedGroupListReq{ - OperationID: params.OperationID, - Token: c.Request.Header.Get("token"), + req := &rpc.GetJoinedGroupListReq{} + 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.Info(req.Token, req.OperationID, "recv req: ", req.String()) + log.NewInfo(req.OperationID, "GetJoinedGroupList args ", req.String()) + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + client := rpc.NewGroupClient(etcdConn) RpcResp, err := client.GetJoinedGroupList(context.Background(), req) if err != nil { - log.Error(req.Token, req.OperationID, "GetJoinedGroupList failed, err: ", err.Error()) + log.NewError(req.OperationID, "GetJoinedGroupList failed ", err.Error(), req.String()) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) return } - log.Info(req.Token, req.OperationID, "GetJoinedGroupList: ", RpcResp) - type GetJoinedGroupListResp struct { - ErrorCode int32 `json:"errCode"` - ErrorMsg string `json:"errMsg"` - Data []groupResult `json:"data"` - } - - var GroupListResp GetJoinedGroupListResp - GroupListResp.ErrorCode = RpcResp.ErrorCode - GroupListResp.ErrorMsg = RpcResp.ErrorMsg - for _, v := range RpcResp.GroupList { - GroupListResp.Data = append(GroupListResp.Data, - groupResult{GroupId: v.GroupId, GroupName: v.GroupName, - Notification: v.Notification, - Introduction: v.Introduction, - FaceUrl: v.FaceUrl, - OwnerId: v.OwnerId, - CreateTime: v.CreateTime, - MemberCount: v.MemberCount}) - } + GroupListResp := api.GetJoinedGroupListResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, GroupInfoList: RpcResp.GroupList} + GroupListResp.Data = jsonData.JsonDataList(GroupListResp.GroupInfoList) + log.NewInfo(req.OperationID, "GetJoinedGroupList api return ", GroupListResp) c.JSON(http.StatusOK, GroupListResp) } -type Id2Result struct { - UId string `json:"uid"` - Result int32 `json:"result"` -} - func InviteUserToGroup(c *gin.Context) { - log.Info("", "", "InviteUserToGroup start....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) - client := pb.NewGroupClient(etcdConn) - - params := InviteUserToGroupReq{} + params := api.InviteUserToGroupReq{} if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) return } - req := &pb.InviteUserToGroupReq{ - OperationID: params.OperationID, - GroupID: params.GroupID, - Reason: params.Reason, - UidList: params.UidList, - Token: c.Request.Header.Get("token"), + req := &rpc.InviteUserToGroupReq{} + utils.CopyStructFields(req, ¶ms) + 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.Info(req.Token, req.OperationID, "recv req: ", req.String()) + log.NewInfo(req.OperationID, "InviteUserToGroup args ", req.String()) + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + client := rpc.NewGroupClient(etcdConn) RpcResp, err := client.InviteUserToGroup(context.Background(), req) if err != nil { - log.Error(req.Token, req.OperationID, "InviteUserToGroup failed, err: ", err.Error()) + log.NewError(req.OperationID, "InviteUserToGroup failed ", err.Error(), req.String()) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) return } - type InviteUserToGroupResp struct { - ErrorCode int32 `json:"errCode"` - ErrorMsg string `json:"errMsg"` - I2R []Id2Result `json:"data"` + resp := api.InviteUserToGroupResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}} + for _, v := range RpcResp.Id2ResultList { + resp.UserIDResultList = append(resp.UserIDResultList, &api.UserIDResult{UserID: v.UserID, Result: v.Result}) } - var iResp InviteUserToGroupResp - iResp.ErrorMsg = RpcResp.ErrorMsg - iResp.ErrorCode = RpcResp.ErrorCode - for _, v := range RpcResp.Id2Result { - iResp.I2R = append(iResp.I2R, Id2Result{UId: v.UId, Result: v.Result}) + if len(resp.UserIDResultList) == 0 { + resp.UserIDResultList = *new([]*api.UserIDResult) } - //resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg, "data": RpcResp.Id2Result} - c.JSON(http.StatusOK, iResp) + log.NewInfo(req.OperationID, "InviteUserToGroup api return ", resp) + c.JSON(http.StatusOK, resp) +} + +func CreateGroup(c *gin.Context) { + params := api.CreateGroupReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + req := &rpc.CreateGroupReq{GroupInfo: &open_im_sdk.GroupInfo{}} + utils.CopyStructFields(req.GroupInfo, ¶ms) + + for _, v := range params.MemberList { + req.InitMemberList = append(req.InitMemberList, &rpc.GroupAddMemberInfo{UserID: v.UserID, RoleLevel: v.RoleLevel}) + } + 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 + } + req.OwnerUserID = req.OpUserID + req.OperationID = params.OperationID + log.NewInfo(req.OperationID, "CreateGroup args ", req.String()) + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + client := rpc.NewGroupClient(etcdConn) + RpcResp, err := client.CreateGroup(context.Background(), req) + if err != nil { + log.NewError(req.OperationID, "CreateGroup failed ", err.Error(), req.String()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"}) + return + } + + resp := api.CreateGroupResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}} + if RpcResp.ErrCode == 0 { + utils.CopyStructFields(&resp.GroupInfo, RpcResp.GroupInfo) + resp.Data = jsonData.JsonDataOne(&resp.GroupInfo) + } + log.NewInfo(req.OperationID, "CreateGroup api return ", resp) + c.JSON(http.StatusOK, resp) +} + +// 群主或管理员收到的 +func GetRecvGroupApplicationList(c *gin.Context) { + params := api.GetGroupApplicationListReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + req := &rpc.GetGroupApplicationListReq{} + 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(req.OperationID, "GetGroupApplicationList args ", req.String()) + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + client := rpc.NewGroupClient(etcdConn) + reply, err := client.GetGroupApplicationList(context.Background(), req) + if err != nil { + log.NewError(req.OperationID, "GetGroupApplicationList failed ", err.Error(), req.String()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) + return + } + + resp := api.GetGroupApplicationListResp{CommResp: api.CommResp{ErrCode: reply.ErrCode, ErrMsg: reply.ErrMsg}, GroupRequestList: reply.GroupRequestList} + resp.Data = jsonData.JsonDataList(resp.GroupRequestList) + log.NewInfo(req.OperationID, "GetGroupApplicationList api return ", resp) + c.JSON(http.StatusOK, resp) +} + +func GetGroupsInfo(c *gin.Context) { + params := api.GetGroupInfoReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + req := &rpc.GetGroupsInfoReq{} + utils.CopyStructFields(req, ¶ms) + 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(req.OperationID, "GetGroupsInfo args ", req.String()) + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + client := rpc.NewGroupClient(etcdConn) + RpcResp, err := client.GetGroupsInfo(context.Background(), req) + if err != nil { + log.NewError(req.OperationID, "GetGroupsInfo failed ", err.Error(), req.String()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"}) + return + } + + resp := api.GetGroupInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}, GroupInfoList: RpcResp.GroupInfoList} + resp.Data = jsonData.JsonDataList(resp.GroupInfoList) + log.NewInfo(req.OperationID, "GetGroupsInfo api return ", resp) + c.JSON(http.StatusOK, resp) +} + +//process application +func ApplicationGroupResponse(c *gin.Context) { + params := api.ApplicationGroupResponseReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + req := &rpc.GroupApplicationResponseReq{} + utils.CopyStructFields(req, ¶ms) + 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(req.OperationID, "ApplicationGroupResponse args ", req.String()) + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + client := rpc.NewGroupClient(etcdConn) + reply, err := client.GroupApplicationResponse(context.Background(), req) + if err != nil { + log.NewError(req.OperationID, "GroupApplicationResponse failed ", req.String()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) + return + } + + resp := api.ApplicationGroupResponseResp{CommResp: api.CommResp{ErrCode: reply.CommonResp.ErrCode, ErrMsg: reply.CommonResp.ErrMsg}} + log.NewInfo(req.OperationID, "ApplicationGroupResponse api return ", resp) + c.JSON(http.StatusOK, resp) +} + +func JoinGroup(c *gin.Context) { + params := api.JoinGroupReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + req := &rpc.JoinGroupReq{} + 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(req.OperationID, "JoinGroup args ", req.String()) + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + client := rpc.NewGroupClient(etcdConn) + + RpcResp, err := client.JoinGroup(context.Background(), req) + if err != nil { + log.NewError(req.OperationID, "JoinGroup failed ", err.Error(), req.String()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"}) + return + } + resp := api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg} + log.NewInfo(req.OperationID, "JoinGroup api return", RpcResp.String()) + c.JSON(http.StatusOK, resp) +} + +func QuitGroup(c *gin.Context) { + params := api.QuitGroupReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + req := &rpc.QuitGroupReq{} + utils.CopyStructFields(req, ¶ms) + 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(req.OperationID, "QuitGroup args ", req.String()) + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + client := rpc.NewGroupClient(etcdConn) + RpcResp, err := client.QuitGroup(context.Background(), req) + if err != nil { + log.NewError(req.OperationID, "call quit group rpc server failed,err=%s", err.Error()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"}) + return + } + resp := api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg} + log.NewInfo(req.OperationID, "QuitGroup api return", RpcResp.String()) + c.JSON(http.StatusOK, resp) +} + +func SetGroupInfo(c *gin.Context) { + params := api.SetGroupInfoReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + req := &rpc.SetGroupInfoReq{GroupInfo: &open_im_sdk.GroupInfo{}} + utils.CopyStructFields(req.GroupInfo, ¶ms) + req.OperationID = params.OperationID + 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(req.OperationID, "SetGroupInfo args ", req.String()) + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + client := rpc.NewGroupClient(etcdConn) + RpcResp, err := client.SetGroupInfo(context.Background(), req) + if err != nil { + log.NewError(req.OperationID, "SetGroupInfo failed ", err.Error(), req.String()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"}) + return + } + resp := api.SetGroupInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} + c.JSON(http.StatusOK, resp) + log.NewInfo(req.OperationID, "SetGroupInfo api return ", resp) +} + +func TransferGroupOwner(c *gin.Context) { + params := api.TransferGroupOwnerReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + req := &rpc.TransferGroupOwnerReq{} + utils.CopyStructFields(req, ¶ms) + 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(req.OperationID, "TransferGroupOwner args ", req.String()) + + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + client := rpc.NewGroupClient(etcdConn) + reply, err := client.TransferGroupOwner(context.Background(), req) + if err != nil { + log.NewError(req.OperationID, "TransferGroupOwner failed ", req.String()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) + return + } + + resp := api.TransferGroupOwnerResp{CommResp: api.CommResp{ErrCode: reply.CommonResp.ErrCode, ErrMsg: reply.CommonResp.ErrMsg}} + log.NewInfo(req.OperationID, "TransferGroupOwner api return ", resp) + c.JSON(http.StatusOK, resp) + } diff --git a/internal/api/group/group_application_response.go b/internal/api/group/group_application_response.go deleted file mode 100644 index ea38d45a1..000000000 --- a/internal/api/group/group_application_response.go +++ /dev/null @@ -1,87 +0,0 @@ -package group - -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/proto/group" - "context" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -type paramsGroupApplicationResponse struct { - OperationID string `json:"operationID" binding:"required"` - GroupID string `json:"groupID" binding:"required"` - FromUserID string `json:"fromUserID" binding:"required"` - FromUserNickName string `json:"fromUserNickName"` - FromUserFaceUrl string `json:"fromUserFaceUrl"` - ToUserID string `json:"toUserID" binding:"required"` - ToUserNickName string `json:"toUserNickName"` - ToUserFaceUrl string `json:"toUserFaceUrl"` - AddTime int64 `json:"addTime"` - RequestMsg string `json:"requestMsg"` - HandledMsg string `json:"handledMsg"` - Type int32 `json:"type"` - HandleStatus int32 `json:"handleStatus"` - HandleResult int32 `json:"handleResult"` -} - -func newGroupApplicationResponse(params *paramsGroupApplicationResponse) *group.GroupApplicationResponseReq { - pbData := group.GroupApplicationResponseReq{ - OperationID: params.OperationID, - GroupID: params.GroupID, - FromUserID: params.FromUserID, - FromUserNickName: params.FromUserNickName, - FromUserFaceUrl: params.FromUserFaceUrl, - ToUserID: params.ToUserID, - ToUserNickName: params.ToUserNickName, - ToUserFaceUrl: params.ToUserFaceUrl, - AddTime: params.AddTime, - RequestMsg: params.RequestMsg, - HandledMsg: params.HandledMsg, - Type: params.Type, - HandleStatus: params.HandleStatus, - HandleResult: params.HandleResult, - } - return &pbData -} - -func ApplicationGroupResponse(c *gin.Context) { - log.Info("", "", "api GroupApplicationResponse init ....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) - client := group.NewGroupClient(etcdConn) - //defer etcdConn.Close() - - params := paramsGroupApplicationResponse{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - pbData := newGroupApplicationResponse(¶ms) - - token := c.Request.Header.Get("token") - if claims, err := token_verify.ParseToken(token); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"}) - return - } else { - pbData.OwnerID = claims.UID - } - - log.Info("", "", "api GroupApplicationResponse is server, [data: %s]", pbData.String()) - reply, err := client.GroupApplicationResponse(context.Background(), pbData) - if err != nil { - log.Error("", "", "api GroupApplicationResponse call rpc fail, [data: %s] [err: %s]", pbData.String(), err.Error()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) - return - } - log.Info("", "", "api GroupApplicationResponse call rpc success, [data: %s] [reply: %s]", pbData.String(), reply.String()) - - c.JSON(http.StatusOK, gin.H{ - "errCode": reply.ErrCode, - "errMsg": reply.ErrMsg, - }) - -} diff --git a/internal/api/group/join_group.go b/internal/api/group/join_group.go deleted file mode 100644 index cc4600333..000000000 --- a/internal/api/group/join_group.go +++ /dev/null @@ -1,47 +0,0 @@ -package group - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pb "Open_IM/pkg/proto/group" - "context" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -type paramsJoinGroup struct { - GroupID string `json:"groupID" binding:"required"` - Message string `json:"message"` - OperationID string `json:"operationID" binding:"required"` -} - -func JoinGroup(c *gin.Context) { - log.Info("", "", "api join group init....") - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) - client := pb.NewGroupClient(etcdConn) - //defer etcdConn.Close() - - params := paramsJoinGroup{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &pb.JoinGroupReq{ - GroupID: params.GroupID, - Message: params.Message, - Token: c.Request.Header.Get("token"), - OperationID: params.OperationID, - } - log.Info(req.Token, req.OperationID, "api join group is server,params=%s", req.String()) - RpcResp, err := client.JoinGroup(context.Background(), req) - if err != nil { - log.Error(req.Token, req.OperationID, "call join group rpc server failed,err=%s", err.Error()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"}) - return - } - log.InfoByArgs("call join group rpc server success,args=%s", RpcResp.String()) - c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg}) -} diff --git a/internal/api/group/quit_group.go b/internal/api/group/quit_group.go deleted file mode 100644 index 5ee485459..000000000 --- a/internal/api/group/quit_group.go +++ /dev/null @@ -1,46 +0,0 @@ -package group - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pb "Open_IM/pkg/proto/group" - "context" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -type paramsQuitGroup struct { - GroupID string `json:"groupID" binding:"required"` - OperationID string `json:"operationID" binding:"required"` -} - -func QuitGroup(c *gin.Context) { - log.Info("", "", "api quit group init ....") - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) - client := pb.NewGroupClient(etcdConn) - //defer etcdConn.Close() - - params := paramsQuitGroup{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &pb.QuitGroupReq{ - GroupID: params.GroupID, - OperationID: params.OperationID, - Token: c.Request.Header.Get("token"), - } - log.Info(req.Token, req.OperationID, "api quit group is server,params=%s", req.String()) - RpcResp, err := client.QuitGroup(context.Background(), req) - if err != nil { - log.Error(req.Token, req.OperationID, "call quit group rpc server failed,err=%s", err.Error()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"}) - return - } - log.InfoByArgs("call quit group rpc server success,args=%s", RpcResp.String()) - c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg}) - log.InfoByArgs("api quit group success return,get args=%s,return args=%s", req.String(), RpcResp.String()) -} diff --git a/internal/api/group/set_group_info.go b/internal/api/group/set_group_info.go deleted file mode 100644 index 0075acc86..000000000 --- a/internal/api/group/set_group_info.go +++ /dev/null @@ -1,53 +0,0 @@ -package group - -import ( - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pb "Open_IM/pkg/proto/group" - "context" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -type paramsSetGroupInfo struct { - GroupID string `json:"groupId" binding:"required"` - GroupName string `json:"groupName"` - Notification string `json:"notification"` - Introduction string `json:"introduction"` - FaceUrl string `json:"faceUrl"` - OperationID string `json:"operationID" binding:"required"` -} - -func SetGroupInfo(c *gin.Context) { - log.Info("", "", "api set group info init...") - - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) - client := pb.NewGroupClient(etcdConn) - //defer etcdConn.Close() - - params := paramsSetGroupInfo{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - req := &pb.SetGroupInfoReq{ - GroupID: params.GroupID, - GroupName: params.GroupName, - Notification: params.Notification, - Introduction: params.Introduction, - FaceUrl: params.FaceUrl, - Token: c.Request.Header.Get("token"), - OperationID: params.OperationID, - } - log.Info(req.Token, req.OperationID, "api set group info is server,params=%s", req.String()) - RpcResp, err := client.SetGroupInfo(context.Background(), req) - if err != nil { - log.Error(req.Token, req.OperationID, "call set group info rpc server failed,err=%s", err.Error()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"}) - return - } - log.InfoByArgs("call set group info rpc server success,args=%s", RpcResp.String()) - c.JSON(http.StatusOK, gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg}) -} diff --git a/internal/api/group/transfer_group_owner.go b/internal/api/group/transfer_group_owner.go deleted file mode 100644 index d8cc9d662..000000000 --- a/internal/api/group/transfer_group_owner.go +++ /dev/null @@ -1,65 +0,0 @@ -package group - -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/proto/group" - "context" - "github.com/gin-gonic/gin" - "net/http" - "strings" -) - -type paramsTransferGroupOwner struct { - OperationID string `json:"operationID" binding:"required"` - GroupID string `json:"groupID" binding:"required"` - UID string `json:"uid" binding:"required"` -} - -func newTransferGroupOwnerReq(params *paramsTransferGroupOwner) *group.TransferGroupOwnerReq { - pbData := group.TransferGroupOwnerReq{ - OperationID: params.OperationID, - GroupID: params.GroupID, - NewOwner: params.UID, - } - return &pbData -} - -func TransferGroupOwner(c *gin.Context) { - log.Info("", "", "api TransferGroupOwner init ....") - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) - client := group.NewGroupClient(etcdConn) - //defer etcdConn.Close() - - params := paramsTransferGroupOwner{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) - return - } - pbData := newTransferGroupOwnerReq(¶ms) - - token := c.Request.Header.Get("token") - if claims, err := token_verify.ParseToken(token); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"}) - return - } else { - pbData.OldOwner = claims.UID - } - - log.Info("", "", "api TransferGroupOwner is server, [data: %s]", pbData.String()) - reply, err := client.TransferGroupOwner(context.Background(), pbData) - if err != nil { - log.Error("", "", "api TransferGroupOwner call rpc fail, [data: %s] [err: %s]", pbData.String(), err.Error()) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) - return - } - log.Info("", "", "api TransferGroupOwner call rpc success, [data: %s] [reply: %s]", pbData.String(), reply.String()) - - c.JSON(http.StatusOK, gin.H{ - "errCode": reply.ErrCode, - "errMsg": reply.ErrMsg, - }) - -} diff --git a/internal/api/manage/management_chat.go b/internal/api/manage/management_chat.go index a72fb1c02..f09b9acd7 100644 --- a/internal/api/manage/management_chat.go +++ b/internal/api/manage/management_chat.go @@ -13,6 +13,7 @@ import ( "Open_IM/pkg/common/token_verify" "Open_IM/pkg/grpc-etcdv3/getcdv3" pbChat "Open_IM/pkg/proto/chat" + open_im_sdk "Open_IM/pkg/proto/sdk_ws" "Open_IM/pkg/utils" "context" "github.com/gin-gonic/gin" @@ -24,21 +25,7 @@ import ( var validate *validator.Validate -type paramsManagementSendMsg struct { - OperationID string `json:"operationID" binding:"required"` - SendID string `json:"sendID" binding:"required"` - RecvID string `json:"recvID" binding:"required"` - SenderNickName string `json:"senderNickName" ` - SenderFaceURL string `json:"senderFaceURL" ` - SenderPlatformID int32 `json:"senderPlatformID"` - ForceList []string `json:"forceList" ` - Content map[string]interface{} `json:"content" binding:"required"` - ContentType int32 `json:"contentType" binding:"required"` - SessionType int32 `json:"sessionType" binding:"required"` - IsOnlineOnly bool `json:"isOnlineOnly"` -} - -func newUserSendMsgReq(params *paramsManagementSendMsg) *pbChat.UserSendMsgReq { +func newUserSendMsgReq(params *ManagementSendMsgReq) *pbChat.SendMsgReq { var newContent string switch params.ContentType { case constant.Text: @@ -53,35 +40,41 @@ func newUserSendMsgReq(params *paramsManagementSendMsg) *pbChat.UserSendMsgReq { newContent = utils.StructToJsonString(params.Content) default: } - options := make(map[string]int32, 2) + options := make(map[string]bool, 2) if params.IsOnlineOnly { - options["history"] = 0 - options["persistent"] = 0 + utils.SetSwitchFromOptions(options, constant.IsOfflinePush, false) + utils.SetSwitchFromOptions(options, constant.IsHistory, false) + utils.SetSwitchFromOptions(options, constant.IsPersistent, false) } - pbData := pbChat.UserSendMsgReq{ - ReqIdentifier: constant.WSSendMsg, - SendID: params.SendID, - SenderNickName: params.SenderNickName, - SenderFaceURL: params.SenderFaceURL, - OperationID: params.OperationID, - PlatformID: params.SenderPlatformID, - SessionType: params.SessionType, - MsgFrom: constant.UserMsgType, - ContentType: params.ContentType, - RecvID: params.RecvID, - ForceList: params.ForceList, - Content: newContent, - ClientMsgID: utils.GetMsgID(params.SendID), - Options: utils.MapIntToJsonString(options), + pbData := pbChat.SendMsgReq{ + OperationID: params.OperationID, + MsgData: &open_im_sdk.MsgData{ + SendID: params.SendID, + RecvID: params.RecvID, + GroupID: params.GroupID, + ClientMsgID: utils.GetMsgID(params.SendID), + SenderPlatformID: params.SenderPlatformID, + SenderNickname: params.SenderNickname, + SenderFaceURL: params.SenderFaceURL, + SessionType: params.SessionType, + MsgFrom: constant.SysMsgType, + ContentType: params.ContentType, + Content: []byte(newContent), + // ForceList: params.ForceList, + CreateTime: utils.GetCurrentTimestampByMill(), + Options: options, + OfflinePushInfo: params.OfflinePushInfo, + }, } return &pbData } func init() { validate = validator.New() } + func ManagementSendMsg(c *gin.Context) { var data interface{} - params := paramsManagementSendMsg{} + params := ManagementSendMsgReq{} if err := c.BindJSON(¶ms); err != nil { c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) log.ErrorByKv("json unmarshal err", c.PostForm("operationID"), "err", err.Error(), "content", c.PostForm("content")) @@ -135,6 +128,19 @@ func ManagementSendMsg(c *gin.Context) { c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "not authorized", "sendTime": 0, "MsgID": ""}) return + } + switch params.SessionType { + case constant.SingleChatType: + if len(params.RecvID) == 0 { + log.NewError(params.OperationID, "recvID is a null string") + c.JSON(http.StatusBadRequest, gin.H{"errCode": 405, "errMsg": "recvID is a null string", "sendTime": 0, "MsgID": ""}) + } + case constant.GroupChatType: + if len(params.GroupID) == 0 { + log.NewError(params.OperationID, "groupID is a null string") + c.JSON(http.StatusBadRequest, gin.H{"errCode": 405, "errMsg": "groupID is a null string", "sendTime": 0, "MsgID": ""}) + } + } log.InfoByKv("Ws call success to ManagementSendMsgReq", params.OperationID, "Parameters", params) @@ -146,7 +152,7 @@ func ManagementSendMsg(c *gin.Context) { log.Info("", "", "api ManagementSendMsg call, api call rpc...") - reply, err := client.UserSendMsg(context.Background(), pbData) + reply, err := client.SendMsg(context.Background(), pbData) if err != nil { log.NewError(params.OperationID, "call delete UserSendMsg rpc server failed", err.Error()) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call UserSendMsg rpc server failed"}) @@ -163,6 +169,33 @@ func ManagementSendMsg(c *gin.Context) { } +// +//type MergeElem struct { +// Title string `json:"title"` +// AbstractList []string `json:"abstractList"` +// MultiMessage []*MsgStruct `json:"multiMessage"` +//} +// +//type QuoteElem struct { +// Text string `json:"text"` +// QuoteMessage *MsgStruct `json:"quoteMessage"` +//} +type ManagementSendMsgReq struct { + OperationID string `json:"operationID" binding:"required"` + SendID string `json:"sendID" binding:"required"` + RecvID string `json:"recvID" ` + GroupID string `json:"groupID" ` + SenderNickname string `json:"senderNickname" ` + SenderFaceURL string `json:"senderFaceURL" ` + SenderPlatformID int32 `json:"senderPlatformID"` + ForceList []string `json:"forceList" ` + Content map[string]interface{} `json:"content" binding:"required"` + ContentType int32 `json:"contentType" binding:"required"` + SessionType int32 `json:"sessionType" binding:"required"` + IsOnlineOnly bool `json:"isOnlineOnly"` + OfflinePushInfo *open_im_sdk.OfflinePushInfo `json:"offlinePushInfo"` +} + type PictureBaseInfo struct { UUID string `mapstructure:"uuid"` Type string `mapstructure:"type" validate:"required"` @@ -206,12 +239,6 @@ type FileElem struct { FileName string `mapstructure:"fileName"` FileSize int64 `mapstructure:"fileSize"` } - -//type MergeElem struct { -// Title string `json:"title"` -// AbstractList []string `json:"abstractList"` -// MultiMessage []*MsgStruct `json:"multiMessage"` -//} type AtElem struct { Text string `mapstructure:"text"` AtUserList []string `mapstructure:"atUserList"` @@ -230,8 +257,3 @@ type CustomElem struct { type TextElem struct { Text string `mapstructure:"text" validate:"required"` } - -//type QuoteElem struct { -// Text string `json:"text"` -// QuoteMessage *MsgStruct `json:"quoteMessage"` -//} diff --git a/internal/api/manage/management_user.go b/internal/api/manage/management_user.go index b911935c2..6ef6f678f 100644 --- a/internal/api/manage/management_user.go +++ b/internal/api/manage/management_user.go @@ -7,13 +7,14 @@ package manage import ( + api "Open_IM/pkg/base_info" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" "Open_IM/pkg/common/token_verify" "Open_IM/pkg/grpc-etcdv3/getcdv3" pbRelay "Open_IM/pkg/proto/relay" - pbUser "Open_IM/pkg/proto/user" + rpc "Open_IM/pkg/proto/user" "Open_IM/pkg/utils" "context" "github.com/gin-gonic/gin" @@ -21,128 +22,121 @@ import ( "strings" ) -type paramsDeleteUsers struct { - OperationID string `json:"operationID" binding:"required"` - DeleteUidList []string `json:"deleteUidList" binding:"required"` -} -type paramsGetAllUsersUid struct { - OperationID string `json:"operationID" binding:"required"` -} -type paramsGetUsersOnlineStatus struct { - OperationID string `json:"operationID" binding:"required"` - UserIDList []string `json:"userIDList" binding:"required,lte=200"` -} -type paramsAccountCheck struct { - OperationID string `json:"operationID" binding:"required"` - UserIDList []string `json:"userIDList" binding:"required,lte=100"` -} - func DeleteUser(c *gin.Context) { - params := paramsDeleteUsers{} + params := api.DeleteUsersReq{} if err := c.BindJSON(¶ms); err != nil { c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) return } - log.InfoByKv("DeleteUser req come here", params.OperationID, "DeleteUidList", params.DeleteUidList) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) - client := pbUser.NewUserClient(etcdConn) - //defer etcdConn.Close() - - req := &pbUser.DeleteUsersReq{ - OperationID: params.OperationID, - DeleteUidList: params.DeleteUidList, - Token: c.Request.Header.Get("token"), + req := &rpc.DeleteUsersReq{} + utils.CopyStructFields(req, ¶ms) + 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, "DeleteUser 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.DeleteUsers(context.Background(), req) if err != nil { log.NewError(req.OperationID, "call delete users rpc server failed", err.Error()) c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call delete users rpc server failed"}) return } - failedUidList := make([]string, 0) - for _, v := range RpcResp.FailedUidList { - failedUidList = append(failedUidList, v) + resp := api.DeleteUsersResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, FailedUserIDList: RpcResp.FailedUserIDList} + if len(RpcResp.FailedUserIDList) == 0 { + resp.FailedUserIDList = []string{} } - log.InfoByKv("call delete user rpc server is success", params.OperationID, "resp args", RpcResp.String()) - resp := gin.H{"errCode": RpcResp.CommonResp.ErrorCode, "errMsg": RpcResp.CommonResp.ErrorMsg, "failedUidList": RpcResp.FailedUidList} + log.NewInfo(req.OperationID, "DeleteUser api return", resp) c.JSON(http.StatusOK, resp) } func GetAllUsersUid(c *gin.Context) { - params := paramsGetAllUsersUid{} + params := api.GetAllUsersUidReq{} if err := c.BindJSON(¶ms); err != nil { c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) return } - log.InfoByKv("GetAllUsersUid req come here", params.OperationID) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) - client := pbUser.NewUserClient(etcdConn) - //defer etcdConn.Close() - - req := &pbUser.GetAllUsersUidReq{ - OperationID: params.OperationID, - Token: c.Request.Header.Get("token"), - } - RpcResp, err := client.GetAllUsersUid(context.Background(), req) - if err != nil { - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error(), "uidList": []string{}}) + req := &rpc.GetAllUserIDReq{} + utils.CopyStructFields(req, ¶ms) + 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.InfoByKv("call GetAllUsersUid rpc server is success", params.OperationID, "resp args", RpcResp.String()) - resp := gin.H{"errCode": RpcResp.CommonResp.ErrorCode, "errMsg": RpcResp.CommonResp.ErrorMsg, "uidList": RpcResp.UidList} + log.NewInfo(params.OperationID, "GetAllUsersUid args ", req.String()) + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) + client := rpc.NewUserClient(etcdConn) + RpcResp, err := client.GetAllUserID(context.Background(), req) + if err != nil { + log.NewError(req.OperationID, "call GetAllUsersUid users rpc server failed", err.Error()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call GetAllUsersUid users rpc server failed"}) + return + } + resp := api.GetAllUsersUidResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, UserIDList: RpcResp.UserIDList} + if len(RpcResp.UserIDList) == 0 { + resp.UserIDList = []string{} + } + log.NewInfo(req.OperationID, "GetAllUsersUid api return", resp) c.JSON(http.StatusOK, resp) } func AccountCheck(c *gin.Context) { - params := paramsAccountCheck{} + params := api.AccountCheckReq{} if err := c.BindJSON(¶ms); err != nil { c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) return } - log.InfoByKv("AccountCheck req come here", params.OperationID, params.UserIDList) - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImUserName) - client := pbUser.NewUserClient(etcdConn) - //defer etcdConn.Close() - - req := &pbUser.AccountCheckReq{ - OperationID: params.OperationID, - Token: c.Request.Header.Get("token"), - UidList: params.UserIDList, + req := &rpc.AccountCheckReq{} + utils.CopyStructFields(req, ¶ms) + 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, "AccountCheck 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.AccountCheck(context.Background(), req) if err != nil { - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": err.Error()}) + log.NewError(req.OperationID, "call AccountCheck users rpc server failed", err.Error()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call AccountCheck users rpc server failed"}) return } - log.InfoByKv("call AccountCheck rpc server is success", params.OperationID, "resp args", RpcResp.String()) - resp := gin.H{"errCode": RpcResp.CommonResp.ErrorCode, "errMsg": RpcResp.CommonResp.ErrorMsg, "result": RpcResp.Result} + resp := api.AccountCheckResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, ResultList: RpcResp.ResultList} + if len(RpcResp.ResultList) == 0 { + resp.ResultList = []*rpc.AccountCheckResp_SingleUserStatus{} + } + log.NewInfo(req.OperationID, "AccountCheck api return", resp) c.JSON(http.StatusOK, resp) - } func GetUsersOnlineStatus(c *gin.Context) { - params := paramsGetUsersOnlineStatus{} + params := api.GetUsersOnlineStatusReq{} if err := c.BindJSON(¶ms); err != nil { c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) return } - claims, err := token_verify.ParseToken(c.Request.Header.Get("token")) - if err != nil { - log.ErrorByKv("parse token failed", params.OperationID, "err", err.Error()) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": err.Error()}) + req := &pbRelay.GetUsersOnlineStatusReq{} + utils.CopyStructFields(req, ¶ms) + 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 } - if !utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) { - log.ErrorByKv(" Authentication failed", params.OperationID, "args", c) - c.JSON(http.StatusBadRequest, gin.H{"errCode": 402, "errMsg": "not authorized"}) - return - } - req := &pbRelay.GetUsersOnlineStatusReq{ - OperationID: params.OperationID, - UserIDList: params.UserIDList, - } + log.NewInfo(params.OperationID, "GetUsersOnlineStatus args ", req.String()) 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) @@ -156,7 +150,7 @@ func GetUsersOnlineStatus(c *gin.Context) { } } } - log.NewDebug(params.OperationID, "call GetUsersOnlineStatus rpc server is success", wsResult) + log.NewInfo(params.OperationID, "call GetUsersOnlineStatus rpc server is success", wsResult) //Online data merge of each node for _, v1 := range params.UserIDList { flag = false @@ -176,8 +170,11 @@ func GetUsersOnlineStatus(c *gin.Context) { } respResult = append(respResult, temp) } - log.NewDebug(params.OperationID, "Finished merged data", respResult) - resp := gin.H{"errCode": 0, "errMsg": "", "successResult": respResult} + resp := api.GetUsersOnlineStatusResp{CommResp: api.CommResp{ErrCode: 0, ErrMsg: ""}, SuccessResult: respResult} + if len(respResult) == 0 { + resp.SuccessResult = []*pbRelay.GetUsersOnlineStatusResp_SuccessResult{} + } + log.NewInfo(req.OperationID, "GetUsersOnlineStatus api return", resp) c.JSON(http.StatusOK, resp) } diff --git a/internal/api/third/tencent_cloud_storage_credential.go b/internal/api/third/tencent_cloud_storage_credential.go index d6814bc93..537641dee 100644 --- a/internal/api/third/tencent_cloud_storage_credential.go +++ b/internal/api/third/tencent_cloud_storage_credential.go @@ -1,51 +1,37 @@ package apiThird import ( + api "Open_IM/pkg/base_info" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" - log2 "Open_IM/pkg/common/log" + "Open_IM/pkg/common/log" + "Open_IM/pkg/common/token_verify" "github.com/gin-gonic/gin" sts "github.com/tencentyun/qcloud-cos-sts-sdk/go" "net/http" "time" ) -type paramsTencentCloudStorageCredential struct { - Token string `json:"token"` - OperationID string `json:"operationID"` -} - -var lastTime int64 -var lastRes *sts.CredentialResult - func TencentCloudStorageCredential(c *gin.Context) { - params := paramsTencentCloudStorageCredential{} - if err := c.BindJSON(¶ms); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "Parameter parsing error,please check the parameters and request service again"}) + req := api.TencentCloudStorageCredentialReq{} + if err := c.BindJSON(&req); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) return } - - log2.Info(params.Token, params.OperationID, "api TencentUpLoadCredential call start...") - - if time.Now().Unix()-lastTime < 10 && lastRes != nil { - c.JSON(http.StatusOK, gin.H{ - "errCode": 0, - "errMsg": "", - "region": config.Config.Credential.Tencent.Region, - "bucket": config.Config.Credential.Tencent.Bucket, - "data": lastRes, - }) + ok, userID := 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 } - - lastTime = time.Now().Unix() + log.NewInfo(req.OperationID, "TencentCloudStorageCredential args ", userID) cli := sts.NewClient( config.Config.Credential.Tencent.SecretID, config.Config.Credential.Tencent.SecretKey, nil, ) - log2.Info(c.Request.Header.Get("token"), c.PostForm("optionID"), "api TencentUpLoadCredential sts.NewClient cli = %v", cli) opt := &sts.CredentialOptions{ DurationSeconds: int64(time.Hour.Seconds()), @@ -65,29 +51,15 @@ func TencentCloudStorageCredential(c *gin.Context) { }, }, } - log2.Info(c.Request.Header.Get("token"), c.PostForm("optionID"), "api TencentUpLoadCredential sts.CredentialOptions opt = %v", opt) - res, err := cli.GetCredential(opt) + resp := api.TencentCloudStorageCredentialResp{} if err != nil { - log2.Error(c.Request.Header.Get("token"), c.PostForm("optionID"), "api TencentUpLoadCredential cli.GetCredential err = %s", err.Error()) - c.JSON(http.StatusOK, gin.H{ - "errCode": constant.ErrTencentCredential.ErrCode, - "errMsg": err.Error(), - "bucket": "", - "region": "", - "data": res, - }) - return + resp.ErrCode = constant.ErrTencentCredential.ErrCode + resp.ErrMsg = err.Error() + } else { + resp.Data.Bucket = config.Config.Credential.Tencent.Bucket + resp.Data.Region = config.Config.Credential.Tencent.Region + resp.Data.CredentialResult = res } - log2.Info(c.Request.Header.Get("token"), c.PostForm("optionID"), "api TencentUpLoadCredential cli.GetCredential success res = %v, res.Credentials = %v", res, res.Credentials) - - lastRes = res - - c.JSON(http.StatusOK, gin.H{ - "errCode": 0, - "errMsg": "", - "region": config.Config.Credential.Tencent.Region, - "bucket": config.Config.Credential.Tencent.Bucket, - "data": res, - }) + c.JSON(http.StatusOK, resp) } 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 deleted file mode 100644 index 89628ded4..000000000 --- a/internal/api/user/update_user_info.go +++ /dev/null @@ -1,62 +0,0 @@ -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..e42f0d1b8 --- /dev/null +++ b/internal/api/user/user.go @@ -0,0 +1,129 @@ +package user + +import ( + jsonData "Open_IM/internal/utils" + api "Open_IM/pkg/base_info" + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/log" + "Open_IM/pkg/common/token_verify" + "Open_IM/pkg/grpc-etcdv3/getcdv3" + open_im_sdk "Open_IM/pkg/proto/sdk_ws" + rpc "Open_IM/pkg/proto/user" + "Open_IM/pkg/utils" + "context" + "github.com/gin-gonic/gin" + "net/http" + "strings" +) + +func GetUsersInfo(c *gin.Context) { + params := api.GetUsersInfoReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": http.StatusBadRequest, "errMsg": err.Error()}) + return + } + req := &rpc.GetUserInfoReq{} + utils.CopyStructFields(req, ¶ms) + 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 + } + var publicUserInfoList []*open_im_sdk.PublicUserInfo + for _, v := range RpcResp.UserInfoList { + publicUserInfoList = append(publicUserInfoList, + &open_im_sdk.PublicUserInfo{UserID: v.UserID, Nickname: v.Nickname, FaceURL: v.FaceURL, Gender: v.Gender, AppMangerLevel: v.AppMangerLevel}) + } + + resp := api.GetUsersInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, UserInfoList: publicUserInfoList} + resp.Data = jsonData.JsonDataList(resp.UserInfoList) + log.NewInfo(req.OperationID, "GetUserInfo api return ", resp) + c.JSON(http.StatusOK, resp) +} + +func UpdateUserInfo(c *gin.Context) { + params := api.UpdateSelfUserInfoReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()}) + return + } + req := &rpc.UpdateUserInfoReq{UserInfo: &open_im_sdk.UserInfo{}} + utils.CopyStructFields(req.UserInfo, ¶ms) + + req.OperationID = params.OperationID + 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, "UpdateUserInfo 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.UpdateUserInfo(context.Background(), req) + if err != nil { + log.NewError(req.OperationID, "UpdateUserInfo failed ", err.Error(), req.String()) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "call rpc server failed"}) + return + } + resp := api.UpdateUserInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} + log.NewInfo(req.OperationID, "UpdateUserInfo api return ", resp) + c.JSON(http.StatusOK, resp) +} + +func GetSelfUserInfo(c *gin.Context) { + params := api.GetSelfUserInfoReq{} + if err := c.BindJSON(¶ms); err != nil { + log.NewError("0", "BindJSON failed ", err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": http.StatusBadRequest, "errMsg": err.Error()}) + return + } + req := &rpc.GetUserInfoReq{} + + utils.CopyStructFields(req, ¶ms) + 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 + } + req.UserIDList = append(req.UserIDList, req.OpUserID) + 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 + } + if len(RpcResp.UserInfoList) == 1 { + resp := api.GetSelfUserInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}, UserInfo: RpcResp.UserInfoList[0]} + resp.Data = jsonData.JsonDataOne(resp.UserInfo) + log.NewInfo(req.OperationID, "GetUserInfo api return ", resp) + c.JSON(http.StatusOK, resp) + } else { + resp := api.GetSelfUserInfoResp{CommResp: api.CommResp{ErrCode: RpcResp.CommonResp.ErrCode, ErrMsg: RpcResp.CommonResp.ErrMsg}} + log.NewInfo(req.OperationID, "GetUserInfo api return ", resp) + c.JSON(http.StatusOK, resp) + } + +} diff --git a/internal/demo/register/login.go b/internal/demo/register/login.go index bc2605e08..b6702bbf4 100644 --- a/internal/demo/register/login.go +++ b/internal/demo/register/login.go @@ -65,7 +65,7 @@ func Login(c *gin.Context) { defer resp.Body.Close() if err != nil { log.ErrorByKv("Failed to read file", account, "err", err.Error()) - c.JSON(http.StatusOK, gin.H{"errCode": constant.IoErrot, "errMsg": err.Error()}) + c.JSON(http.StatusOK, gin.H{"errCode": constant.IoError, "errMsg": err.Error()}) return } imRep := IMRegisterResp{} diff --git a/internal/demo/register/set_password.go b/internal/demo/register/set_password.go index 7dca79dc6..9d66a09b0 100644 --- a/internal/demo/register/set_password.go +++ b/internal/demo/register/set_password.go @@ -86,7 +86,7 @@ openIMRegisterTab: response, err := ioutil.ReadAll(resp.Body) defer resp.Body.Close() if err != nil { - c.JSON(http.StatusOK, gin.H{"errCode": constant.IoErrot, "errMsg": err.Error()}) + c.JSON(http.StatusOK, gin.H{"errCode": constant.IoError, "errMsg": err.Error()}) return } imrep := IMRegisterResp{} diff --git a/internal/msg_gateway/gate/logic.go b/internal/msg_gateway/gate/logic.go index 9b449d4b2..d1756093c 100644 --- a/internal/msg_gateway/gate/logic.go +++ b/internal/msg_gateway/gate/logic.go @@ -6,12 +6,10 @@ import ( "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" pbChat "Open_IM/pkg/proto/chat" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" - "Open_IM/pkg/utils" + sdk_ws "Open_IM/pkg/proto/sdk_ws" "bytes" "context" "encoding/gob" - "encoding/json" "github.com/golang/protobuf/proto" "github.com/gorilla/websocket" "runtime" @@ -51,42 +49,39 @@ func (ws *WServer) msgParse(conn *UserConn, binaryMsg []byte) { switch m.ReqIdentifier { case constant.WSGetNewestSeq: - go ws.getSeqReq(conn, &m) - case constant.WSPullMsg: - go ws.pullMsgReq(conn, &m) + ws.getSeqReq(conn, &m) case constant.WSSendMsg: - sendTime := utils.GetCurrentTimestampByNano() - go ws.sendMsgReq(conn, &m, sendTime) + ws.sendMsgReq(conn, &m) case constant.WSPullMsgBySeqList: - go ws.pullMsgBySeqListReq(conn, &m) + ws.pullMsgBySeqListReq(conn, &m) default: } log.NewInfo("", "goroutine num is ", runtime.NumGoroutine()) } func (ws *WServer) getSeqReq(conn *UserConn, m *Req) { log.NewInfo(m.OperationID, "Ws call success to getNewSeq", m.MsgIncr, m.SendID, m.ReqIdentifier) - pbData := pbChat.GetMaxAndMinSeqReq{} + rpcReq := pbChat.GetMaxAndMinSeqReq{} nReply := new(pbChat.GetMaxAndMinSeqResp) - pbData.UserID = m.SendID - pbData.OperationID = m.OperationID + rpcReq.UserID = m.SendID + rpcReq.OperationID = m.OperationID grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) if grpcConn == nil { - log.ErrorByKv("get grpcConn err", pbData.OperationID, "args", m) + log.ErrorByKv("get grpcConn err", rpcReq.OperationID, "args", m) } msgClient := pbChat.NewChatClient(grpcConn) - reply, err := msgClient.GetMaxAndMinSeq(context.Background(), &pbData) + rpcReply, err := msgClient.GetMaxAndMinSeq(context.Background(), &rpcReq) if err != nil { - log.ErrorByKv("rpc call failed to getSeqReq", pbData.OperationID, "err", err, "pbData", pbData.String()) - nReply.ErrCode = 200 + log.Error(rpcReq.OperationID, "rpc call failed to getSeqReq", err, rpcReq.String()) + nReply.ErrCode = 500 nReply.ErrMsg = err.Error() ws.getSeqResp(conn, m, nReply) } else { - log.InfoByKv("rpc call success to getSeqReq", pbData.OperationID, "replyData", reply.String()) - ws.getSeqResp(conn, m, reply) + log.InfoByKv("rpc call success to getSeqReq", rpcReq.OperationID, "replyData", rpcReply.String()) + ws.getSeqResp(conn, m, rpcReply) } } func (ws *WServer) getSeqResp(conn *UserConn, m *Req, pb *pbChat.GetMaxAndMinSeqResp) { - var mReplyData open_im_sdk.GetMaxAndMinSeqResp + var mReplyData sdk_ws.GetMaxAndMinSeqResp mReplyData.MaxSeq = pb.GetMaxSeq() mReplyData.MinSeq = pb.GetMinSeq() b, _ := proto.Marshal(&mReplyData) @@ -100,58 +95,38 @@ func (ws *WServer) getSeqResp(conn *UserConn, m *Req, pb *pbChat.GetMaxAndMinSeq } ws.sendMsg(conn, mReply) } -func (ws *WServer) pullMsgReq(conn *UserConn, m *Req) { - log.NewInfo(m.OperationID, "Ws call success to pullMsgReq", m.ReqIdentifier, m.MsgIncr, m.SendID) - nReply := new(pbChat.PullMessageResp) - isPass, errCode, errMsg, data := ws.argsValidate(m, constant.WSPullMsg) + +func (ws *WServer) pullMsgBySeqListReq(conn *UserConn, m *Req) { + log.NewInfo(m.OperationID, "Ws call success to pullMsgBySeqListReq start", m.SendID, m.ReqIdentifier, m.MsgIncr) + nReply := new(sdk_ws.PullMessageBySeqListResp) + isPass, errCode, errMsg, data := ws.argsValidate(m, constant.WSPullMsgBySeqList) + log.NewInfo(m.OperationID, "Ws call success to pullMsgBySeqListReq middle", m.SendID, m.ReqIdentifier, m.MsgIncr, data.(sdk_ws.PullMessageBySeqListReq).SeqList) if isPass { - pbData := pbChat.PullMessageReq{} - pbData.UserID = m.SendID - pbData.OperationID = m.OperationID - pbData.SeqBegin = data.(SeqData).SeqBegin - pbData.SeqEnd = data.(SeqData).SeqEnd + rpcReq := sdk_ws.PullMessageBySeqListReq{} + rpcReq.SeqList = data.(sdk_ws.PullMessageBySeqListReq).SeqList + rpcReq.UserID = m.SendID + rpcReq.OperationID = m.OperationID grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) msgClient := pbChat.NewChatClient(grpcConn) - reply, err := msgClient.PullMessage(context.Background(), &pbData) + reply, err := msgClient.PullMessageBySeqList(context.Background(), &rpcReq) if err != nil { - log.ErrorByKv("PullMessage error", pbData.OperationID, "err", err.Error()) + log.NewError(rpcReq.OperationID, "pullMsgBySeqListReq err", err.Error()) nReply.ErrCode = 200 nReply.ErrMsg = err.Error() - ws.pullMsgResp(conn, m, nReply) + ws.pullMsgBySeqListResp(conn, m, nReply) } else { - log.InfoByKv("rpc call success to pullMsgRep", pbData.OperationID, "ReplyArgs", reply.String(), "maxSeq", reply.GetMaxSeq(), - "MinSeq", reply.GetMinSeq(), "singLen", len(reply.GetSingleUserMsg()), "groupLen", len(reply.GetGroupUserMsg())) - ws.pullMsgResp(conn, m, reply) + log.NewInfo(rpcReq.OperationID, "rpc call success to pullMsgBySeqListReq", reply.String(), len(reply.List)) + ws.pullMsgBySeqListResp(conn, m, reply) } } else { nReply.ErrCode = errCode nReply.ErrMsg = errMsg - ws.pullMsgResp(conn, m, nReply) + ws.pullMsgBySeqListResp(conn, m, nReply) } } -func (ws *WServer) pullMsgResp(conn *UserConn, m *Req, pb *pbChat.PullMessageResp) { - log.NewInfo(m.OperationID, "pullMsgResp come here ", pb.String()) - var mReplyData open_im_sdk.PullMessageBySeqListResp - a, err := json.Marshal(pb.SingleUserMsg) - if err != nil { - log.NewError(m.OperationID, "GetSingleUserMsg,json marshal,err", err.Error()) - } - log.NewInfo(m.OperationID, "pullMsgResp json is ", len(pb.SingleUserMsg)) - err = json.Unmarshal(a, &mReplyData.SingleUserMsg) - if err != nil { - log.NewError(m.OperationID, "SingleUserMsg,json Unmarshal,err", err.Error()) - } - b, err := json.Marshal(pb.GroupUserMsg) - if err != nil { - log.NewError(m.OperationID, "mReplyData,json marshal,err", err.Error()) - } - err = json.Unmarshal(b, &mReplyData.GroupUserMsg) - if err != nil { - log.NewError(m.OperationID, "test SingleUserMsg,json Unmarshal,err", err.Error()) - } - c, err := proto.Marshal(&mReplyData) - log.NewInfo(m.OperationID, "test info is ", len(mReplyData.SingleUserMsg), mReplyData.SingleUserMsg) - +func (ws *WServer) pullMsgBySeqListResp(conn *UserConn, m *Req, pb *sdk_ws.PullMessageBySeqListResp) { + log.NewInfo(m.OperationID, "pullMsgBySeqListResp come here ", pb.String()) + c, _ := proto.Marshal(pb) mReply := Resp{ ReqIdentifier: m.ReqIdentifier, MsgIncr: m.MsgIncr, @@ -160,92 +135,51 @@ func (ws *WServer) pullMsgResp(conn *UserConn, m *Req, pb *pbChat.PullMessageRes OperationID: m.OperationID, Data: c, } - log.NewInfo(m.OperationID, "pullMsgResp all data is ", mReply.ReqIdentifier, mReply.MsgIncr, mReply.ErrCode, mReply.ErrMsg, + log.NewInfo(m.OperationID, "pullMsgBySeqListResp all data is ", mReply.ReqIdentifier, mReply.MsgIncr, mReply.ErrCode, mReply.ErrMsg, len(mReply.Data)) ws.sendMsg(conn, mReply) } -func (ws *WServer) pullMsgBySeqListReq(conn *UserConn, m *Req) { - log.NewInfo(m.OperationID, "Ws call success to pullMsgBySeqListReq start", m.SendID, m.ReqIdentifier, m.MsgIncr) - nReply := new(pbChat.PullMessageResp) - isPass, errCode, errMsg, data := ws.argsValidate(m, constant.WSPullMsgBySeqList) - log.NewInfo(m.OperationID, "Ws call success to pullMsgBySeqListReq middle", m.SendID, m.ReqIdentifier, m.MsgIncr, data.(open_im_sdk.PullMessageBySeqListReq).SeqList) - if isPass { - pbData := pbChat.PullMessageBySeqListReq{} - pbData.SeqList = data.(open_im_sdk.PullMessageBySeqListReq).SeqList - pbData.UserID = m.SendID - pbData.OperationID = m.OperationID - grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) - msgClient := pbChat.NewChatClient(grpcConn) - reply, err := msgClient.PullMessageBySeqList(context.Background(), &pbData) - if err != nil { - log.NewError(pbData.OperationID, "pullMsgBySeqListReq err", err.Error()) - nReply.ErrCode = 200 - nReply.ErrMsg = err.Error() - ws.pullMsgResp(conn, m, nReply) - } else { - log.NewInfo(pbData.OperationID, "rpc call success to pullMsgBySeqListReq", reply.String(), reply.GetMaxSeq(), reply.GetMinSeq(), len(reply.GetSingleUserMsg()), len(reply.GetGroupUserMsg())) - ws.pullMsgResp(conn, m, reply) - } - } else { - nReply.ErrCode = errCode - nReply.ErrMsg = errMsg - ws.pullMsgResp(conn, m, nReply) - } -} -func (ws *WServer) sendMsgReq(conn *UserConn, m *Req, sendTime int64) { - log.NewInfo(m.OperationID, "Ws call success to sendMsgReq start", m.MsgIncr, m.ReqIdentifier, m.SendID, sendTime) - nReply := new(pbChat.UserSendMsgResp) +func (ws *WServer) sendMsgReq(conn *UserConn, m *Req) { + log.NewInfo(m.OperationID, "Ws call success to sendMsgReq start", m.MsgIncr, m.ReqIdentifier, m.SendID) + nReply := new(pbChat.SendMsgResp) isPass, errCode, errMsg, pData := ws.argsValidate(m, constant.WSSendMsg) if isPass { - data := pData.(open_im_sdk.UserSendMsgReq) - pbData := pbChat.UserSendMsgReq{ - ReqIdentifier: m.ReqIdentifier, - Token: m.Token, - SendID: m.SendID, - OperationID: m.OperationID, - PlatformID: data.PlatformID, - SessionType: data.SessionType, - MsgFrom: data.MsgFrom, - ContentType: data.ContentType, - RecvID: data.RecvID, - ForceList: data.ForceList, - SenderNickName: data.SenderNickName, - SenderFaceURL: data.SenderFaceURL, - Content: data.Content, - Options: utils.MapIntToJsonString(data.Options), - ClientMsgID: data.ClientMsgID, - SendTime: sendTime, + data := pData.(sdk_ws.MsgData) + pbData := pbChat.SendMsgReq{ + Token: m.Token, + OperationID: m.OperationID, + MsgData: &data, } log.NewInfo(m.OperationID, "Ws call success to sendMsgReq middle", m.ReqIdentifier, m.SendID, m.MsgIncr, data) etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) client := pbChat.NewChatClient(etcdConn) - reply, err := client.UserSendMsg(context.Background(), &pbData) + reply, err := client.SendMsg(context.Background(), &pbData) if err != nil { log.NewError(pbData.OperationID, "UserSendMsg err", err.Error()) nReply.ErrCode = 200 nReply.ErrMsg = err.Error() - ws.sendMsgResp(conn, m, nReply, sendTime) + ws.sendMsgResp(conn, m, nReply) } else { log.NewInfo(pbData.OperationID, "rpc call success to sendMsgReq", reply.String()) - ws.sendMsgResp(conn, m, reply, sendTime) + ws.sendMsgResp(conn, m, reply) } } else { nReply.ErrCode = errCode nReply.ErrMsg = errMsg - ws.sendMsgResp(conn, m, nReply, sendTime) + ws.sendMsgResp(conn, m, nReply) } } -func (ws *WServer) sendMsgResp(conn *UserConn, m *Req, pb *pbChat.UserSendMsgResp, sendTime int64) { +func (ws *WServer) sendMsgResp(conn *UserConn, m *Req, pb *pbChat.SendMsgResp) { // := make(map[string]interface{}) - var mReplyData open_im_sdk.UserSendMsgResp + var mReplyData sdk_ws.UserSendMsgResp mReplyData.ClientMsgID = pb.GetClientMsgID() mReplyData.ServerMsgID = pb.GetServerMsgID() - mReplyData.SendTime = sendTime + mReplyData.SendTime = pb.GetSendTime() b, _ := proto.Marshal(&mReplyData) mReply := Resp{ ReqIdentifier: m.ReqIdentifier, @@ -263,12 +197,14 @@ func (ws *WServer) sendMsg(conn *UserConn, mReply interface{}) { enc := gob.NewEncoder(&b) err := enc.Encode(mReply) if err != nil { - log.NewError(mReply.(Resp).OperationID, mReply.(Resp).ReqIdentifier, mReply.(Resp).ErrCode, mReply.(Resp).ErrMsg, "Encode Msg error", conn.RemoteAddr().String(), ws.getUserUid(conn), err.Error()) + uid, platform := ws.getUserUid(conn) + log.NewError(mReply.(Resp).OperationID, mReply.(Resp).ReqIdentifier, mReply.(Resp).ErrCode, mReply.(Resp).ErrMsg, "Encode Msg error", conn.RemoteAddr().String(), uid, platform, err.Error()) return } err = ws.writeMsg(conn, websocket.BinaryMessage, b.Bytes()) if err != nil { - log.NewError(mReply.(Resp).OperationID, mReply.(Resp).ReqIdentifier, mReply.(Resp).ErrCode, mReply.(Resp).ErrMsg, "WS WriteMsg error", conn.RemoteAddr().String(), ws.getUserUid(conn), err.Error()) + uid, platform := ws.getUserUid(conn) + log.NewError(mReply.(Resp).OperationID, mReply.(Resp).ReqIdentifier, mReply.(Resp).ErrCode, mReply.(Resp).ErrMsg, "WS WriteMsg error", conn.RemoteAddr().String(), uid, platform, err.Error()) } } func (ws *WServer) sendErrMsg(conn *UserConn, errCode int32, errMsg string, reqIdentifier int32, msgIncr string, operationID string) { diff --git a/internal/msg_gateway/gate/rpc_server.go b/internal/msg_gateway/gate/rpc_server.go index a3ef373d6..240934d3b 100644 --- a/internal/msg_gateway/gate/rpc_server.go +++ b/internal/msg_gateway/gate/rpc_server.go @@ -4,9 +4,9 @@ import ( "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" + "Open_IM/pkg/common/token_verify" "Open_IM/pkg/grpc-etcdv3/getcdv3" pbRelay "Open_IM/pkg/proto/relay" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" "Open_IM/pkg/utils" "bytes" "context" @@ -55,26 +55,10 @@ func (r *RPCServer) run() { return } } -func (r *RPCServer) MsgToUser(_ context.Context, in *pbRelay.MsgToUserReq) (*pbRelay.MsgToUserResp, error) { +func (r *RPCServer) OnlinePushMsg(_ context.Context, in *pbRelay.OnlinePushMsgReq) (*pbRelay.OnlinePushMsgResp, error) { log.InfoByKv("PushMsgToUser is arriving", in.OperationID, "args", in.String()) var resp []*pbRelay.SingleMsgToUser - var RecvID string - msg := open_im_sdk.MsgData{ - SendID: in.SendID, - RecvID: in.RecvID, - MsgFrom: in.MsgFrom, - ContentType: in.ContentType, - SessionType: in.SessionType, - SenderNickName: in.SenderNickName, - SenderFaceURL: in.SenderFaceURL, - ClientMsgID: in.ClientMsgID, - ServerMsgID: in.ServerMsgID, - Content: in.Content, - Seq: in.RecvSeq, - SendTime: in.SendTime, - SenderPlatformID: in.PlatformID, - } - msgBytes, _ := proto.Marshal(&msg) + msgBytes, _ := proto.Marshal(in.MsgData) mReply := Resp{ ReqIdentifier: constant.WSPushMsg, OperationID: in.OperationID, @@ -86,65 +70,56 @@ func (r *RPCServer) MsgToUser(_ context.Context, in *pbRelay.MsgToUserReq) (*pbR if err != nil { log.NewError(in.OperationID, "data encode err", err.Error()) } - switch in.GetSessionType() { - case constant.SingleChatType: - RecvID = in.GetRecvID() - case constant.GroupChatType: - RecvID = strings.Split(in.GetRecvID(), " ")[0] - } var tag bool - var UIDAndPID []string - userIDList := genUidPlatformArray(RecvID) - for _, v := range userIDList { - UIDAndPID = strings.Split(v, " ") - if conn := ws.getUserConn(v); conn != nil { + recvID := in.MsgData.RecvID + platformList := genPlatformArray() + for _, v := range platformList { + if conn := ws.getUserConn(recvID, v); conn != nil { tag = true - resultCode := sendMsgToUser(conn, replyBytes.Bytes(), in, UIDAndPID[1], UIDAndPID[0]) + resultCode := sendMsgToUser(conn, replyBytes.Bytes(), in, v, recvID) temp := &pbRelay.SingleMsgToUser{ ResultCode: resultCode, - RecvID: UIDAndPID[0], - RecvPlatFormID: constant.PlatformNameToID(UIDAndPID[1]), + RecvID: recvID, + RecvPlatFormID: constant.PlatformNameToID(v), } resp = append(resp, temp) } else { temp := &pbRelay.SingleMsgToUser{ ResultCode: -1, - RecvID: UIDAndPID[0], - RecvPlatFormID: constant.PlatformNameToID(UIDAndPID[1]), + RecvID: recvID, + RecvPlatFormID: constant.PlatformNameToID(v), } resp = append(resp, temp) } } //Single chat sender synchronization message - if in.GetSessionType() == constant.SingleChatType && in.ContentType <= constant.Quote && in.ContentType != constant.Typing && in.ContentType != constant.HasReadReceipt { - userIDList = genUidPlatformArray(in.SendID) - for _, v := range userIDList { - UIDAndPID = strings.Split(v, " ") - if conn := ws.getUserConn(v); conn != nil { - _ = sendMsgToUser(conn, replyBytes.Bytes(), in, UIDAndPID[1], UIDAndPID[0]) - } + if in.MsgData.GetSessionType() == constant.SingleChatType { + for k, v := range ws.getSingleUserAllConn(in.MsgData.SendID) { + _ = sendMsgToUser(v, replyBytes.Bytes(), in, k, in.MsgData.SendID) } } if !tag { log.NewError(in.OperationID, "push err ,no matched ws conn not in map", in.String()) } - return &pbRelay.MsgToUserResp{ + return &pbRelay.OnlinePushMsgResp{ Resp: resp, }, nil } func (r *RPCServer) GetUsersOnlineStatus(_ context.Context, req *pbRelay.GetUsersOnlineStatusReq) (*pbRelay.GetUsersOnlineStatusResp, error) { - log.NewDebug(req.OperationID, "rpc GetUsersOnlineStatus arrived server", req.String()) - var UIDAndPID []string + log.NewInfo(req.OperationID, "rpc GetUsersOnlineStatus arrived server", req.String()) + if !token_verify.IsMangerUserID(req.OpUserID) { + log.NewError(req.OperationID, "no permission GetUsersOnlineStatus ", req.OpUserID) + return &pbRelay.GetUsersOnlineStatusResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil + } var resp pbRelay.GetUsersOnlineStatusResp - for _, v1 := range req.UserIDList { - userIDList := genUidPlatformArray(v1) + for _, userID := range req.UserIDList { + platformList := genPlatformArray() temp := new(pbRelay.GetUsersOnlineStatusResp_SuccessResult) - temp.UserID = v1 - for _, v2 := range userIDList { - UIDAndPID = strings.Split(v2, " ") - if conn := ws.getUserConn(v2); conn != nil { + temp.UserID = userID + for _, platform := range platformList { + if conn := ws.getUserConn(userID, platform); conn != nil { ps := new(pbRelay.GetUsersOnlineStatusResp_SuccessDetail) - ps.Platform = UIDAndPID[1] + ps.Platform = platform ps.Status = constant.OnlineStatus temp.Status = constant.OnlineStatus temp.DetailPlatformStatus = append(temp.DetailPlatformStatus, ps) @@ -155,13 +130,14 @@ func (r *RPCServer) GetUsersOnlineStatus(_ context.Context, req *pbRelay.GetUser resp.SuccessResult = append(resp.SuccessResult, temp) } } + log.NewInfo(req.OperationID, "GetUsersOnlineStatus rpc return ", resp.String()) return &resp, nil } -func sendMsgToUser(conn *UserConn, bMsg []byte, in *pbRelay.MsgToUserReq, RecvPlatForm, RecvID string) (ResultCode int64) { +func sendMsgToUser(conn *UserConn, bMsg []byte, in *pbRelay.OnlinePushMsgReq, RecvPlatForm, RecvID string) (ResultCode int64) { err := ws.writeMsg(conn, websocket.BinaryMessage, bMsg) if err != nil { log.ErrorByKv("PushMsgToUser is failed By Ws", "", "Addr", conn.RemoteAddr().String(), - "error", err, "senderPlatform", constant.PlatformIDToName(in.PlatformID), "recvPlatform", RecvPlatForm, "args", in.String(), "recvID", RecvID) + "error", err, "senderPlatform", constant.PlatformIDToName(in.MsgData.SenderPlatformID), "recvPlatform", RecvPlatForm, "args", in.String(), "recvID", RecvID) ResultCode = -2 return ResultCode } else { @@ -171,9 +147,9 @@ func sendMsgToUser(conn *UserConn, bMsg []byte, in *pbRelay.MsgToUserReq, RecvPl } } -func genUidPlatformArray(uid string) (array []string) { +func genPlatformArray() (array []string) { for i := 1; i <= constant.LinuxPlatformID; i++ { - array = append(array, uid+" "+constant.PlatformIDToName(int32(i))) + array = append(array, constant.PlatformIDToName(int32(i))) } return array } diff --git a/internal/msg_gateway/gate/validate.go b/internal/msg_gateway/gate/validate.go index 269229e9c..fe1411a62 100644 --- a/internal/msg_gateway/gate/validate.go +++ b/internal/msg_gateway/gate/validate.go @@ -59,7 +59,7 @@ type SeqListData struct { func (ws *WServer) argsValidate(m *Req, r int32) (isPass bool, errCode int32, errMsg string, returnData interface{}) { switch r { case constant.WSSendMsg: - data := open_im_sdk.UserSendMsgReq{} + data := open_im_sdk.MsgData{} if err := proto.Unmarshal(m.Data, &data); err != nil { log.ErrorByKv("Decode Data struct err", "", "err", err.Error(), "reqIdentifier", r) return false, 203, err.Error(), nil diff --git a/internal/msg_gateway/gate/ws_server.go b/internal/msg_gateway/gate/ws_server.go index fc6151cf1..2197fbbc2 100644 --- a/internal/msg_gateway/gate/ws_server.go +++ b/internal/msg_gateway/gate/ws_server.go @@ -9,6 +9,7 @@ import ( "Open_IM/pkg/utils" "bytes" "encoding/gob" + "github.com/garyburd/redigo/redis" "net/http" "sync" "time" @@ -24,15 +25,15 @@ type WServer struct { wsAddr string wsMaxConnNum int wsUpGrader *websocket.Upgrader - wsConnToUser map[*UserConn]string - wsUserToConn map[string]*UserConn + wsConnToUser map[*UserConn]map[string]string + wsUserToConn map[string]map[string]*UserConn } func (ws *WServer) onInit(wsPort int) { ws.wsAddr = ":" + utils.IntToString(wsPort) ws.wsMaxConnNum = config.Config.LongConnSvr.WebsocketMaxConnNum - ws.wsConnToUser = make(map[*UserConn]string) - ws.wsUserToConn = make(map[string]*UserConn) + ws.wsConnToUser = make(map[*UserConn]map[string]string) + ws.wsUserToConn = make(map[string]map[string]*UserConn) ws.wsUpGrader = &websocket.Upgrader{ HandshakeTimeout: time.Duration(config.Config.LongConnSvr.WebsocketTimeOut) * time.Second, ReadBufferSize: config.Config.LongConnSvr.WebsocketMaxMsgLen, @@ -74,7 +75,8 @@ func (ws *WServer) readMsg(conn *UserConn) { log.NewInfo("", "this is a pingMessage") } if err != nil { - log.ErrorByKv("WS ReadMsg error", "", "userIP", conn.RemoteAddr().String(), "userUid", ws.getUserUid(conn), "error", err) + uid, platform := ws.getUserUid(conn) + log.ErrorByKv("WS ReadMsg error", "", "userIP", conn.RemoteAddr().String(), "userUid", uid, "platform", platform, "error", err.Error()) ws.delUserConn(conn) return } else { @@ -94,34 +96,43 @@ func (ws *WServer) writeMsg(conn *UserConn, a int, msg []byte) error { func (ws *WServer) MultiTerminalLoginChecker(uid string, platformID int32, newConn *UserConn, token string) { switch config.Config.MultiLoginPolicy { case constant.AllLoginButSameTermKick: - if oldConn, ok := ws.wsUserToConn[genMapKey(uid, platformID)]; ok { - log.NewDebug("", uid, platformID, "kick old conn") - ws.sendKickMsg(oldConn, newConn) - m, err := db.DB.GetTokenMapByUidPid(uid, constant.PlatformIDToName(platformID)) - if err != nil { - log.NewError("", "get token from redis err", err.Error()) - return - } - if m == nil { - log.NewError("", "get token from redis err", "m is nil") - return - } - for k, _ := range m { - if k != token { - m[k] = constant.KickedToken + if oldConnMap, ok := ws.wsUserToConn[uid]; ok { + if oldConn, ok := oldConnMap[constant.PlatformIDToName(platformID)]; ok { + log.NewDebug("", uid, platformID, "kick old conn") + ws.sendKickMsg(oldConn, newConn) + m, err := db.DB.GetTokenMapByUidPid(uid, constant.PlatformIDToName(platformID)) + if err != nil && err != redis.ErrNil { + log.NewError("", "get token from redis err", err.Error()) + return } + if m == nil { + log.NewError("", "get token from redis err", "m is nil") + return + } + for k, _ := range m { + if k != token { + m[k] = constant.KickedToken + } + } + log.NewDebug("get map is ", m) + err = db.DB.SetTokenMapByUidPid(uid, platformID, m) + if err != nil { + log.NewError("", "SetTokenMapByUidPid err", err.Error()) + return + } + err = oldConn.Close() + delete(oldConnMap, constant.PlatformIDToName(platformID)) + ws.wsUserToConn[uid] = oldConnMap + if len(oldConnMap) == 0 { + delete(ws.wsUserToConn, uid) + } + delete(ws.wsConnToUser, oldConn) + if err != nil { + log.NewError("", "conn close err", err.Error(), uid, platformID) + } + } - log.NewDebug("get map is ", m) - err = db.DB.SetTokenMapByUidPid(uid, platformID, m) - if err != nil { - log.NewError("", "SetTokenMapByUidPid err", err.Error()) - return - } - err = oldConn.Close() - delete(ws.wsConnToUser, oldConn) - if err != nil { - log.NewError("", "conn close err", err.Error()) - } + } else { log.NewDebug("no other conn", ws.wsUserToConn) } @@ -149,53 +160,97 @@ func (ws *WServer) sendKickMsg(oldConn, newConn *UserConn) { } } func (ws *WServer) addUserConn(uid string, platformID int32, conn *UserConn, token string) { - key := genMapKey(uid, platformID) rwLock.Lock() defer rwLock.Unlock() ws.MultiTerminalLoginChecker(uid, platformID, conn, token) - ws.wsConnToUser[conn] = key - ws.wsUserToConn[key] = conn - log.WarnByKv("WS Add operation", "", "wsUser added", ws.wsUserToConn, "uid", uid, "online_num", len(ws.wsUserToConn)) + if oldConnMap, ok := ws.wsUserToConn[uid]; ok { + oldConnMap[constant.PlatformIDToName(platformID)] = conn + ws.wsUserToConn[uid] = oldConnMap + } else { + i := make(map[string]*UserConn) + i[constant.PlatformIDToName(platformID)] = conn + ws.wsUserToConn[uid] = i + } + if oldStringMap, ok := ws.wsConnToUser[conn]; ok { + oldStringMap[constant.PlatformIDToName(platformID)] = uid + ws.wsConnToUser[conn] = oldStringMap + } else { + i := make(map[string]string) + i[constant.PlatformIDToName(platformID)] = uid + ws.wsConnToUser[conn] = i + } + count := 0 + for _, v := range ws.wsUserToConn { + count = count + len(v) + } + log.WarnByKv("WS Add operation", "", "wsUser added", ws.wsUserToConn, "connection_uid", uid, "connection_platform", constant.PlatformIDToName(platformID), "online_user_num", len(ws.wsUserToConn), "online_conn_num", count) } func (ws *WServer) delUserConn(conn *UserConn) { rwLock.Lock() defer rwLock.Unlock() - var uidPlatform string - if uid, ok := ws.wsConnToUser[conn]; ok { - uidPlatform = uid - if _, ok = ws.wsUserToConn[uid]; ok { - delete(ws.wsUserToConn, uid) - log.WarnByKv("WS delete operation", "", "wsUser deleted", ws.wsUserToConn, "uid", uid, "online_num", len(ws.wsUserToConn)) + var platform, uid string + if oldStringMap, ok := ws.wsConnToUser[conn]; ok { + for k, v := range oldStringMap { + platform = k + uid = v + } + if oldConnMap, ok := ws.wsUserToConn[uid]; ok { + delete(oldConnMap, platform) + ws.wsUserToConn[uid] = oldConnMap + if len(oldConnMap) == 0 { + delete(ws.wsUserToConn, uid) + } + count := 0 + for _, v := range ws.wsUserToConn { + count = count + len(v) + } + log.WarnByKv("WS delete operation", "", "wsUser deleted", ws.wsUserToConn, "disconnection_uid", uid, "disconnection_platform", platform, "online_user_num", len(ws.wsUserToConn), "online_conn_num", count) } else { - log.WarnByKv("uid not exist", "", "wsUser deleted", ws.wsUserToConn, "uid", uid, "online_num", len(ws.wsUserToConn)) + log.WarnByKv("WS delete operation", "", "wsUser deleted", ws.wsUserToConn, "disconnection_uid", uid, "disconnection_platform", platform, "online_user_num", len(ws.wsUserToConn)) } delete(ws.wsConnToUser, conn) + } err := conn.Close() if err != nil { - log.ErrorByKv("close err", "", "uid", uidPlatform) + log.ErrorByKv("close err", "", "uid", uid, "platform", platform) + } } -func (ws *WServer) getUserConn(uid string) *UserConn { +func (ws *WServer) getUserConn(uid string, platform string) *UserConn { rwLock.RLock() defer rwLock.RUnlock() - if conn, ok := ws.wsUserToConn[uid]; ok { - return conn + if connMap, ok := ws.wsUserToConn[uid]; ok { + if conn, flag := connMap[platform]; flag { + return conn + } } return nil } -func (ws *WServer) getUserUid(conn *UserConn) string { +func (ws *WServer) getSingleUserAllConn(uid string) map[string]*UserConn { + rwLock.RLock() + defer rwLock.RUnlock() + if connMap, ok := ws.wsUserToConn[uid]; ok { + return connMap + } + return nil +} +func (ws *WServer) getUserUid(conn *UserConn) (uid, platform string) { rwLock.RLock() defer rwLock.RUnlock() - if uid, ok := ws.wsConnToUser[conn]; ok { - return uid + if stringMap, ok := ws.wsConnToUser[conn]; ok { + for k, v := range stringMap { + platform = k + uid = v + } + return uid, platform } - return "" + return "", "" } func (ws *WServer) headerCheck(w http.ResponseWriter, r *http.Request) bool { status := http.StatusUnauthorized @@ -217,7 +272,6 @@ func (ws *WServer) headerCheck(w http.ResponseWriter, r *http.Request) bool { http.Error(w, http.StatusText(status), status) return false } - } func genMapKey(uid string, platformID int32) string { return uid + " " + constant.PlatformIDToName(platformID) diff --git a/internal/msg_transfer/logic/db.go b/internal/msg_transfer/logic/db.go index 3d6e0e3f6..b9ce8b589 100644 --- a/internal/msg_transfer/logic/db.go +++ b/internal/msg_transfer/logic/db.go @@ -2,24 +2,21 @@ package logic import ( "Open_IM/pkg/common/db" - "Open_IM/pkg/common/db/mysql_model/im_mysql_model" "Open_IM/pkg/common/log" pbMsg "Open_IM/pkg/proto/chat" "Open_IM/pkg/utils" ) -func saveUserChat(uid string, pbMsg *pbMsg.MsgSvrToPushSvrChatMsg) error { +func saveUserChat(uid string, msg *pbMsg.MsgDataToMQ) error { time := utils.GetCurrentTimestampByMill() seq, err := db.DB.IncrUserSeq(uid) if err != nil { - log.NewError(pbMsg.OperationID, "data insert to redis err", err.Error(), pbMsg.String()) + log.NewError(msg.OperationID, "data insert to redis err", err.Error(), msg.String()) return err } - pbMsg.RecvSeq = seq - log.NewInfo(pbMsg.OperationID, "IncrUserSeq cost time", utils.GetCurrentTimestampByMill()-time) - return db.DB.SaveUserChat(uid, pbMsg.SendTime, pbMsg) -} - -func getGroupList(groupID string) ([]string, error) { - return im_mysql_model.SelectGroupList(groupID) + msg.MsgData.Seq = uint32(seq) + pbSaveData := pbMsg.MsgDataToDB{} + pbSaveData.MsgData = msg.MsgData + log.NewInfo(msg.OperationID, "IncrUserSeq cost time", utils.GetCurrentTimestampByMill()-time) + return db.DB.SaveUserChat(uid, pbSaveData.MsgData.SendTime, &pbSaveData) } diff --git a/internal/msg_transfer/logic/history_msg_handler.go b/internal/msg_transfer/logic/history_msg_handler.go index 4b25bd9bc..01677cdb0 100644 --- a/internal/msg_transfer/logic/history_msg_handler.go +++ b/internal/msg_transfer/logic/history_msg_handler.go @@ -32,80 +32,60 @@ func (mc *HistoryConsumerHandler) Init() { } func (mc *HistoryConsumerHandler) handleChatWs2Mongo(msg []byte, msgKey string) { - log.InfoByKv("chat come mongo!!!", "", "chat", string(msg)) + log.InfoByKv("msg come mongo!!!", "", "msg", string(msg)) time := utils.GetCurrentTimestampByNano() - pbData := pbMsg.WSToMsgSvrChatMsg{} - err := proto.Unmarshal(msg, &pbData) + msgFromMQ := pbMsg.MsgDataToMQ{} + err := proto.Unmarshal(msg, &msgFromMQ) if err != nil { - log.ErrorByKv("msg_transfer Unmarshal chat err", "", "chat", string(msg), "err", err.Error()) + log.ErrorByKv("msg_transfer Unmarshal msg err", "", "msg", string(msg), "err", err.Error()) return } - pbSaveData := pbMsg.MsgSvrToPushSvrChatMsg{} - pbSaveData.SendID = pbData.SendID - pbSaveData.SenderNickName = pbData.SenderNickName - pbSaveData.SenderFaceURL = pbData.SenderFaceURL - pbSaveData.ClientMsgID = pbData.ClientMsgID - pbSaveData.SendTime = pbData.SendTime - pbSaveData.Content = pbData.Content - pbSaveData.MsgFrom = pbData.MsgFrom - pbSaveData.ContentType = pbData.ContentType - pbSaveData.SessionType = pbData.SessionType - pbSaveData.MsgID = pbData.MsgID - pbSaveData.OperationID = pbData.OperationID - pbSaveData.RecvID = pbData.RecvID - pbSaveData.PlatformID = pbData.PlatformID - options := utils.JsonStringToMap(pbData.Options) + operationID := msgFromMQ.OperationID //Control whether to store offline messages (mongo) - isHistory := utils.GetSwitchFromOptions(options, "history") + isHistory := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsHistory) //Control whether to store history messages (mysql) - isPersist := utils.GetSwitchFromOptions(options, "persistent") - switch pbData.SessionType { + isPersist := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsPersistent) + switch msgFromMQ.MsgData.SessionType { case constant.SingleChatType: - log.NewDebug(pbSaveData.OperationID, "msg_transfer chat type = SingleChatType", isHistory, isPersist) + log.NewDebug(msgFromMQ.OperationID, "msg_transfer msg type = SingleChatType", isHistory, isPersist) if isHistory { - if msgKey == pbSaveData.RecvID { - err := saveUserChat(pbData.RecvID, &pbSaveData) + if msgKey == msgFromMQ.MsgData.RecvID { + err := saveUserChat(msgFromMQ.MsgData.RecvID, &msgFromMQ) if err != nil { - log.NewError(pbSaveData.OperationID, "single data insert to mongo err", err.Error(), pbSaveData.String()) + log.NewError(operationID, "single data insert to mongo err", err.Error(), msgFromMQ.String()) return } - } else if msgKey == pbSaveData.SendID { - err := saveUserChat(pbData.SendID, &pbSaveData) + } else if msgKey == msgFromMQ.MsgData.SendID { + err := saveUserChat(msgFromMQ.MsgData.SendID, &msgFromMQ) if err != nil { - log.NewError(pbSaveData.OperationID, "single data insert to mongo err", err.Error(), pbSaveData.String()) + log.NewError(operationID, "single data insert to mongo err", err.Error(), msgFromMQ.String()) return } - } - log.NewDebug(pbSaveData.OperationID, "saveUserChat cost time ", utils.GetCurrentTimestampByNano()-time) + log.NewDebug(operationID, "saveUserChat cost time ", utils.GetCurrentTimestampByNano()-time) } - if msgKey == pbSaveData.RecvID { - pbSaveData.Options = pbData.Options - pbSaveData.OfflineInfo = pbData.OfflineInfo - go sendMessageToPush(&pbSaveData) - log.NewDebug(pbSaveData.OperationID, "sendMessageToPush cost time ", utils.GetCurrentTimestampByNano()-time) + if msgKey == msgFromMQ.MsgData.RecvID { + go sendMessageToPush(&msgFromMQ) + log.NewDebug(msgFromMQ.OperationID, "sendMessageToPush cost time ", utils.GetCurrentTimestampByNano()-time) } case constant.GroupChatType: - log.NewDebug(pbSaveData.OperationID, "msg_transfer chat type = GroupChatType", isHistory, isPersist) + log.NewDebug(msgFromMQ.OperationID, "msg_transfer msg type = GroupChatType", isHistory, isPersist) if isHistory { - uidAndGroupID := strings.Split(pbData.RecvID, " ") - err := saveUserChat(uidAndGroupID[0], &pbSaveData) + err := saveUserChat(msgFromMQ.MsgData.RecvID, &msgFromMQ) if err != nil { - log.NewError(pbSaveData.OperationID, "group data insert to mongo err", pbSaveData.String(), uidAndGroupID[0], err.Error()) + log.NewError(operationID, "group data insert to mongo err", msgFromMQ.String(), msgFromMQ.MsgData.RecvID, err.Error()) return } } - pbSaveData.Options = pbData.Options - pbSaveData.OfflineInfo = pbData.OfflineInfo - go sendMessageToPush(&pbSaveData) + go sendMessageToPush(&msgFromMQ) default: - log.NewError(pbSaveData.OperationID, "SessionType error", pbSaveData.String()) + log.NewError(msgFromMQ.OperationID, "SessionType error", msgFromMQ.String()) return } - log.NewDebug(pbSaveData.OperationID, "msg_transfer handle topic data to database success...", pbSaveData.String()) + log.NewDebug(msgFromMQ.OperationID, "msg_transfer handle topic data to database success...", msgFromMQ.String()) } func (HistoryConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil } @@ -113,50 +93,35 @@ func (HistoryConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { ret func (mc *HistoryConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error { for msg := range claim.Messages() { - log.InfoByKv("kafka get info to mongo", "", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "chat", string(msg.Value)) + log.InfoByKv("kafka get info to mongo", "", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value)) mc.msgHandle[msg.Topic](msg.Value, string(msg.Key)) sess.MarkMessage(msg, "") } return nil } -func sendMessageToPush(message *pbMsg.MsgSvrToPushSvrChatMsg) { +func sendMessageToPush(message *pbMsg.MsgDataToMQ) { log.InfoByKv("msg_transfer send message to push", message.OperationID, "message", message.String()) - msg := pbPush.PushMsgReq{} - msg.OperationID = message.OperationID - msg.PlatformID = message.PlatformID - msg.Content = message.Content - msg.ContentType = message.ContentType - msg.SessionType = message.SessionType - msg.RecvID = message.RecvID - msg.SendID = message.SendID - msg.SenderNickName = message.SenderNickName - msg.SenderFaceURL = message.SenderFaceURL - msg.ClientMsgID = message.ClientMsgID - msg.MsgFrom = message.MsgFrom - msg.Options = message.Options - msg.RecvSeq = message.RecvSeq - msg.SendTime = message.SendTime - msg.MsgID = message.MsgID - msg.OfflineInfo = message.OfflineInfo + rpcPushMsg := pbPush.PushMsgReq{OperationID: message.OperationID, MsgData: message.MsgData} + mqPushMsg := pbMsg.PushMsgDataToMQ{OperationID: message.OperationID, MsgData: message.MsgData} grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImPushName) if grpcConn == nil { - log.ErrorByKv("rpc dial failed", msg.OperationID, "push data", msg.String()) - pid, offset, err := producer.SendMessage(message) + log.ErrorByKv("rpc dial failed", rpcPushMsg.OperationID, "push data", rpcPushMsg.String()) + pid, offset, err := producer.SendMessage(&mqPushMsg) if err != nil { - log.ErrorByKv("kafka send failed", msg.OperationID, "send data", message.String(), "pid", pid, "offset", offset, "err", err.Error()) + log.ErrorByKv("kafka send failed", mqPushMsg.OperationID, "send data", message.String(), "pid", pid, "offset", offset, "err", err.Error()) } return } msgClient := pbPush.NewPushMsgServiceClient(grpcConn) - _, err := msgClient.PushMsg(context.Background(), &msg) + _, err := msgClient.PushMsg(context.Background(), &rpcPushMsg) if err != nil { - log.ErrorByKv("rpc send failed", msg.OperationID, "push data", msg.String(), "err", err.Error()) - pid, offset, err := producer.SendMessage(message) + log.ErrorByKv("rpc send failed", rpcPushMsg.OperationID, "push data", rpcPushMsg.String(), "err", err.Error()) + pid, offset, err := producer.SendMessage(&mqPushMsg) if err != nil { - log.ErrorByKv("kafka send failed", msg.OperationID, "send data", message.String(), "pid", pid, "offset", offset, "err", err.Error()) + log.ErrorByKv("kafka send failed", mqPushMsg.OperationID, "send data", mqPushMsg.String(), "pid", pid, "offset", offset, "err", err.Error()) } } else { - log.InfoByKv("rpc send success", msg.OperationID, "push data", msg.String()) + log.InfoByKv("rpc send success", rpcPushMsg.OperationID, "push data", rpcPushMsg.String()) } } diff --git a/internal/msg_transfer/logic/persistent_msg_handler.go b/internal/msg_transfer/logic/persistent_msg_handler.go index 2a13bb4a2..c90901212 100644 --- a/internal/msg_transfer/logic/persistent_msg_handler.go +++ b/internal/msg_transfer/logic/persistent_msg_handler.go @@ -16,7 +16,6 @@ import ( "Open_IM/pkg/utils" "github.com/Shopify/sarama" "github.com/golang/protobuf/proto" - "strings" ) type PersistentConsumerHandler struct { @@ -32,30 +31,29 @@ func (pc *PersistentConsumerHandler) Init() { config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.ConsumerGroupID.MsgToMySql) } + func (pc *PersistentConsumerHandler) handleChatWs2Mysql(msg []byte, msgKey string) { - log.InfoByKv("chat come here mysql!!!", "", "chat", string(msg)) - pbData := pbMsg.WSToMsgSvrChatMsg{} - err := proto.Unmarshal(msg, &pbData) + log.InfoByKv("msg come here mysql!!!", "", "msg", string(msg)) + msgFromMQ := pbMsg.MsgDataToMQ{} + err := proto.Unmarshal(msg, &msgFromMQ) if err != nil { - log.ErrorByKv("msg_transfer Unmarshal chat err", "", "chat", string(msg), "err", err.Error()) + log.ErrorByKv("msg_transfer Unmarshal msg err", "", "msg", string(msg), "err", err.Error()) return } - options := utils.JsonStringToMap(pbData.Options) //Control whether to store history messages (mysql) - isPersist := utils.GetSwitchFromOptions(options, "persistent") + isPersist := utils.GetSwitchFromOptions(msgFromMQ.MsgData.Options, constant.IsPersistent) //Only process receiver data if isPersist { - if msgKey == pbData.RecvID && pbData.SessionType == constant.SingleChatType { - log.InfoByKv("msg_transfer chat persisting", pbData.OperationID) - if err = im_mysql_msg_model.InsertMessageToChatLog(pbData); err != nil { - log.ErrorByKv("Message insert failed", pbData.OperationID, "err", err.Error(), "chat", pbData.String()) + if msgKey == msgFromMQ.MsgData.RecvID && msgFromMQ.MsgData.SessionType == constant.SingleChatType { + log.InfoByKv("msg_transfer msg persisting", msgFromMQ.OperationID) + if err = im_mysql_msg_model.InsertMessageToChatLog(msgFromMQ); err != nil { + log.ErrorByKv("Message insert failed", msgFromMQ.OperationID, "err", err.Error(), "msg", msgFromMQ.String()) return } - } else if pbData.SessionType == constant.GroupChatType && msgKey == "0" { - pbData.RecvID = strings.Split(pbData.RecvID, " ")[1] - log.InfoByKv("msg_transfer chat persisting", pbData.OperationID) - if err = im_mysql_msg_model.InsertMessageToChatLog(pbData); err != nil { - log.ErrorByKv("Message insert failed", pbData.OperationID, "err", err.Error(), "chat", pbData.String()) + } else if msgFromMQ.MsgData.SessionType == constant.GroupChatType && msgKey == msgFromMQ.MsgData.SendID { + log.InfoByKv("msg_transfer msg persisting", msgFromMQ.OperationID) + if err = im_mysql_msg_model.InsertMessageToChatLog(msgFromMQ); err != nil { + log.ErrorByKv("Message insert failed", msgFromMQ.OperationID, "err", err.Error(), "msg", msgFromMQ.String()) return } } @@ -67,7 +65,7 @@ func (PersistentConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { func (pc *PersistentConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error { for msg := range claim.Messages() { - log.InfoByKv("kafka get info to mysql", "", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "chat", string(msg.Value)) + log.InfoByKv("kafka get info to mysql", "", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value)) pc.msgHandle[msg.Topic](msg.Value, string(msg.Key)) sess.MarkMessage(msg, "") } diff --git a/internal/push/jpush/push.go b/internal/push/jpush/push.go index 1258a80a7..f0843a3f0 100644 --- a/internal/push/jpush/push.go +++ b/internal/push/jpush/push.go @@ -13,14 +13,14 @@ import ( type JPushResp struct { } -func JGAccountListPush(accounts []string, content, detailContent, platform string) ([]byte, error) { +func JGAccountListPush(accounts []string, alert, detailContent, platform string) ([]byte, error) { var pf requestBody.Platform _ = pf.SetPlatform(platform) var au requestBody.Audience au.SetAlias(accounts) var no requestBody.Notification - no.SetAlert(content, platform) + no.SetAlert(alert, platform) var me requestBody.Message me.SetMsgContent(detailContent) var o requestBody.Options diff --git a/internal/push/logic/push_handler.go b/internal/push/logic/push_handler.go index 5058ce26d..294c48f15 100644 --- a/internal/push/logic/push_handler.go +++ b/internal/push/logic/push_handler.go @@ -11,8 +11,7 @@ import ( kfk "Open_IM/pkg/common/kafka" "Open_IM/pkg/common/log" pbChat "Open_IM/pkg/proto/chat" - pbRelay "Open_IM/pkg/proto/relay" - "Open_IM/pkg/utils" + pbPush "Open_IM/pkg/proto/push" "github.com/Shopify/sarama" "github.com/golang/protobuf/proto" ) @@ -33,28 +32,13 @@ func (ms *PushConsumerHandler) Init() { } func (ms *PushConsumerHandler) handleMs2PsChat(msg []byte) { log.InfoByKv("msg come from kafka And push!!!", "", "msg", string(msg)) - pbData := pbChat.MsgSvrToPushSvrChatMsg{} - if err := proto.Unmarshal(msg, &pbData); err != nil { + msgFromMQ := pbChat.PushMsgDataToMQ{} + if err := proto.Unmarshal(msg, &msgFromMQ); err != nil { log.ErrorByKv("push Unmarshal msg err", "", "msg", string(msg), "err", err.Error()) return } - sendPbData := pbRelay.MsgToUserReq{} - sendPbData.SendTime = pbData.SendTime - sendPbData.OperationID = pbData.OperationID - sendPbData.ServerMsgID = pbData.MsgID - sendPbData.MsgFrom = pbData.MsgFrom - sendPbData.ContentType = pbData.ContentType - sendPbData.SessionType = pbData.SessionType - sendPbData.RecvID = pbData.RecvID - sendPbData.Content = pbData.Content - sendPbData.SendID = pbData.SendID - sendPbData.SenderNickName = pbData.SenderNickName - sendPbData.SenderFaceURL = pbData.SenderFaceURL - sendPbData.ClientMsgID = pbData.ClientMsgID - sendPbData.PlatformID = pbData.PlatformID - sendPbData.RecvSeq = pbData.RecvSeq //Call push module to send message to the user - MsgToUser(&sendPbData, pbData.OfflineInfo, utils.JsonStringToMap(pbData.Options)) + MsgToUser((*pbPush.PushMsgReq)(&msgFromMQ)) } func (PushConsumerHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil } func (PushConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return nil } diff --git a/internal/push/logic/push_rpc_server.go b/internal/push/logic/push_rpc_server.go index 570f5c28b..b622ba721 100644 --- a/internal/push/logic/push_rpc_server.go +++ b/internal/push/logic/push_rpc_server.go @@ -5,7 +5,6 @@ import ( "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/proto/push" - pbRelay "Open_IM/pkg/proto/relay" "Open_IM/pkg/utils" "context" "google.golang.org/grpc" @@ -49,23 +48,8 @@ func (r *RPCServer) run() { } } func (r *RPCServer) PushMsg(_ context.Context, pbData *pbPush.PushMsgReq) (*pbPush.PushMsgResp, error) { - sendPbData := pbRelay.MsgToUserReq{} - sendPbData.SendTime = pbData.SendTime - sendPbData.OperationID = pbData.OperationID - sendPbData.ServerMsgID = pbData.MsgID - sendPbData.MsgFrom = pbData.MsgFrom - sendPbData.ContentType = pbData.ContentType - sendPbData.SenderNickName = pbData.SenderNickName - sendPbData.SenderFaceURL = pbData.SenderFaceURL - sendPbData.ClientMsgID = pbData.ClientMsgID - sendPbData.SessionType = pbData.SessionType - sendPbData.RecvID = pbData.RecvID - sendPbData.Content = pbData.Content - sendPbData.SendID = pbData.SendID - sendPbData.PlatformID = pbData.PlatformID - sendPbData.RecvSeq = pbData.RecvSeq //Call push module to send message to the user - MsgToUser(&sendPbData, pbData.OfflineInfo, utils.JsonStringToMap(pbData.Options)) + MsgToUser(pbData) return &pbPush.PushMsgResp{ ResultCode: 0, }, nil diff --git a/internal/push/logic/push_to_client.go b/internal/push/logic/push_to_client.go index b7c8c94af..803bb5b3b 100644 --- a/internal/push/logic/push_to_client.go +++ b/internal/push/logic/push_to_client.go @@ -8,13 +8,11 @@ package logic import ( push "Open_IM/internal/push/jpush" - rpcChat "Open_IM/internal/rpc/chat" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" "Open_IM/pkg/grpc-etcdv3/getcdv3" - pbChat "Open_IM/pkg/proto/chat" - pbGroup "Open_IM/pkg/proto/group" + pbPush "Open_IM/pkg/proto/push" pbRelay "Open_IM/pkg/proto/relay" "Open_IM/pkg/utils" "context" @@ -26,7 +24,7 @@ type OpenIMContent struct { SessionType int `json:"sessionType"` From string `json:"from"` To string `json:"to"` - Seq int64 `json:"seq"` + Seq uint32 `json:"seq"` } type AtContent struct { Text string `json:"text"` @@ -34,122 +32,123 @@ type AtContent struct { IsAtSelf bool `json:"isAtSelf"` } -func MsgToUser(sendPbData *pbRelay.MsgToUserReq, OfflineInfo string, Options map[string]int32) { +func MsgToUser(pushMsg *pbPush.PushMsgReq) { var wsResult []*pbRelay.SingleMsgToUser - isOfflinePush := utils.GetSwitchFromOptions(Options, "offlinePush") - log.InfoByKv("Get chat from msg_transfer And push chat", sendPbData.OperationID, "PushData", sendPbData, Options, isOfflinePush) + isOfflinePush := utils.GetSwitchFromOptions(pushMsg.MsgData.Options, constant.IsOfflinePush) + log.InfoByKv("Get msg from msg_transfer And push msg", pushMsg.OperationID, "PushData", pushMsg.String()) grpcCons := getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName) //Online push message - log.InfoByKv("test", sendPbData.OperationID, "len grpc", len(grpcCons), "data", sendPbData) + log.InfoByKv("test", pushMsg.OperationID, "len grpc", len(grpcCons), "data", pushMsg.String()) for _, v := range grpcCons { msgClient := pbRelay.NewOnlineMessageRelayServiceClient(v) - reply, err := msgClient.MsgToUser(context.Background(), sendPbData) + reply, err := msgClient.OnlinePushMsg(context.Background(), &pbRelay.OnlinePushMsgReq{OperationID: pushMsg.OperationID, MsgData: pushMsg.MsgData}) if err != nil { - log.InfoByKv("push data to client rpc err", sendPbData.OperationID, "err", err) + log.InfoByKv("push data to client rpc err", pushMsg.OperationID, "err", err) continue } if reply != nil && reply.Resp != nil { wsResult = append(wsResult, reply.Resp...) } } - log.InfoByKv("push_result", sendPbData.OperationID, "result", wsResult, "sendData", sendPbData) - if sendPbData.ContentType != constant.Typing && sendPbData.ContentType != constant.HasReadReceipt { - if isOfflinePush { - for _, v := range wsResult { - if v.ResultCode == 0 { - continue - } - //supported terminal - for _, t := range pushTerminal { - if v.RecvPlatFormID == t { - //Use offline push messaging - var UIDList []string - UIDList = append(UIDList, v.RecvID) - customContent := OpenIMContent{ - SessionType: int(sendPbData.SessionType), - From: sendPbData.SendID, - To: sendPbData.RecvID, - Seq: sendPbData.RecvSeq, - } - bCustomContent, _ := json.Marshal(customContent) - jsonCustomContent := string(bCustomContent) - var content string - switch sendPbData.ContentType { - case constant.Text: - content = constant.ContentType2PushContent[constant.Text] - case constant.Picture: - content = constant.ContentType2PushContent[constant.Picture] - case constant.Voice: - content = constant.ContentType2PushContent[constant.Voice] - case constant.Video: - content = constant.ContentType2PushContent[constant.Video] - case constant.File: - content = constant.ContentType2PushContent[constant.File] - case constant.AtText: - a := AtContent{} - _ = utils.JsonStringToStruct(sendPbData.Content, &a) - if utils.IsContain(v.RecvID, a.AtUserList) { - content = constant.ContentType2PushContent[constant.AtText] + constant.ContentType2PushContent[constant.Common] - } else { - content = constant.ContentType2PushContent[constant.GroupMsg] - } - default: - content = constant.ContentType2PushContent[constant.Common] - } - pushResult, err := push.JGAccountListPush(UIDList, content, jsonCustomContent, constant.PlatformIDToName(t)) - if err != nil { - log.NewError(sendPbData.OperationID, "offline push error", sendPbData.String(), err.Error(), constant.PlatformIDToName(t)) + log.InfoByKv("push_result", pushMsg.OperationID, "result", wsResult, "sendData", pushMsg.MsgData) + if isOfflinePush { + for _, v := range wsResult { + if v.ResultCode == 0 { + continue + } + //supported terminal + for _, t := range pushTerminal { + if v.RecvPlatFormID == t { + //Use offline push messaging + var UIDList []string + UIDList = append(UIDList, v.RecvID) + customContent := OpenIMContent{ + SessionType: int(pushMsg.MsgData.SessionType), + From: pushMsg.MsgData.SendID, + To: pushMsg.MsgData.RecvID, + Seq: pushMsg.MsgData.Seq, + } + bCustomContent, _ := json.Marshal(customContent) + jsonCustomContent := string(bCustomContent) + var content string + switch pushMsg.MsgData.ContentType { + case constant.Text: + content = constant.ContentType2PushContent[constant.Text] + case constant.Picture: + content = constant.ContentType2PushContent[constant.Picture] + case constant.Voice: + content = constant.ContentType2PushContent[constant.Voice] + case constant.Video: + content = constant.ContentType2PushContent[constant.Video] + case constant.File: + content = constant.ContentType2PushContent[constant.File] + case constant.AtText: + a := AtContent{} + _ = utils.JsonStringToStruct(string(pushMsg.MsgData.Content), &a) + if utils.IsContain(v.RecvID, a.AtUserList) { + content = constant.ContentType2PushContent[constant.AtText] + constant.ContentType2PushContent[constant.Common] } else { - log.NewDebug(sendPbData.OperationID, "offline push return result is ", string(pushResult), sendPbData, constant.PlatformIDToName(t)) + content = constant.ContentType2PushContent[constant.GroupMsg] } + default: + content = constant.ContentType2PushContent[constant.Common] + } + if pushMsg.MsgData.OfflinePushInfo != nil { + content = pushMsg.MsgData.OfflinePushInfo.Title } + pushResult, err := push.JGAccountListPush(UIDList, content, jsonCustomContent, constant.PlatformIDToName(t)) + if err != nil { + log.NewError(pushMsg.OperationID, "offline push error", pushMsg.String(), err.Error(), constant.PlatformIDToName(t)) + } else { + log.NewDebug(pushMsg.OperationID, "offline push return result is ", string(pushResult), pushMsg.MsgData, constant.PlatformIDToName(t)) + } + } } - } - } - -} - -func SendMsgByWS(m *pbChat.WSToMsgSvrChatMsg) { - m.MsgID = rpcChat.GetMsgID(m.SendID) - m.ClientMsgID = m.MsgID - switch m.SessionType { - case constant.SingleChatType: - sendMsgToKafka(m, m.SendID, "msgKey--sendID") - sendMsgToKafka(m, m.RecvID, "msgKey--recvID") - case constant.GroupChatType: - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) - client := pbGroup.NewGroupClient(etcdConn) - req := &pbGroup.GetGroupAllMemberReq{ - GroupID: m.RecvID, - Token: config.Config.Secret, - OperationID: m.OperationID, - } - reply, err := client.GetGroupAllMember(context.Background(), req) - if err != nil { - log.Error(m.Token, m.OperationID, "rpc getGroupInfo failed, err = %s", err.Error()) - return - } - if reply.ErrorCode != 0 { - log.Error(m.Token, m.OperationID, "rpc getGroupInfo failed, err = %s", reply.ErrorMsg) - return - } - groupID := m.RecvID - for i, v := range reply.MemberList { - m.RecvID = v.UserId + " " + groupID - sendMsgToKafka(m, utils.IntToString(i), "msgKey--recvID+\" \"+groupID") - } - default: } } -func sendMsgToKafka(m *pbChat.WSToMsgSvrChatMsg, key string, flag string) { - pid, offset, err := producer.SendMessage(m, key) - if err != nil { - log.ErrorByKv("kafka send failed", m.OperationID, "send data", m.String(), "pid", pid, "offset", offset, "err", err.Error(), flag, key) - } - -} +//func SendMsgByWS(m *pbChat.WSToMsgSvrChatMsg) { +// m.MsgID = rpcChat.GetMsgID(m.SendID) +// m.ClientMsgID = m.MsgID +// switch m.SessionType { +// case constant.SingleChatType: +// sendMsgToKafka(m, m.SendID, "msgKey--sendID") +// sendMsgToKafka(m, m.RecvID, "msgKey--recvID") +// case constant.GroupChatType: +// etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) +// client := pbGroup.NewGroupClient(etcdConn) +// req := &pbGroup.GetGroupAllMemberReq{ +// GroupID: m.RecvID, +// Token: config.Config.Secret, +// OperationID: m.OperationID, +// } +// reply, err := client.GetGroupAllMember(context.Background(), req) +// if err != nil { +// log.Error(m.Token, m.OperationID, "rpc getGroupInfo failed, err = %s", err.Error()) +// return +// } +// if reply.ErrorCode != 0 { +// log.Error(m.Token, m.OperationID, "rpc getGroupInfo failed, err = %s", reply.ErrorMsg) +// return +// } +// groupID := m.RecvID +// for i, v := range reply.MemberList { +// m.RecvID = v.UserId + " " + groupID +// sendMsgToKafka(m, utils.IntToString(i), "msgKey--recvID+\" \"+groupID") +// } +// default: +// +// } +//} +// +//func sendMsgToKafka(m *pbChat.WSToMsgSvrChatMsg, key string, flag string) { +// pid, offset, err := producer.SendMessage(m, key) +// if err != nil { +// log.ErrorByKv("kafka send failed", m.OperationID, "send data", m.String(), "pid", pid, "offset", offset, "err", err.Error(), flag, key) +// } +// +//} diff --git a/internal/rpc/auth/auth.go b/internal/rpc/auth/auth.go new file mode 100644 index 000000000..bb804d6e2 --- /dev/null +++ b/internal/rpc/auth/auth.go @@ -0,0 +1,104 @@ +package auth + +import ( + "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" + 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 db.User + utils.CopyStructFields(&user, req.UserInfo) + if req.UserInfo.Birth != 0 { + user.Birth = utils.UnixSecondToTime(int64(req.UserInfo.Birth)) + } + 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{CommonResp: &pbAuth.CommonResp{}, 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 5f7aa9023..000000000 --- a/internal/rpc/auth/user_register.go +++ /dev/null @@ -1,23 +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 len(pb.UID) == 0 { - // pb.UID = utils.GenID() - //} - 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/chat/pull_message.go b/internal/rpc/chat/pull_message.go deleted file mode 100644 index 725725037..000000000 --- a/internal/rpc/chat/pull_message.go +++ /dev/null @@ -1,159 +0,0 @@ -package chat - -import ( - "context" - "github.com/garyburd/redigo/redis" - - commonDB "Open_IM/pkg/common/db" - "Open_IM/pkg/common/log" - - "sort" - "strings" - - pbMsg "Open_IM/pkg/proto/chat" -) - -func (rpc *rpcChat) GetMaxAndMinSeq(_ context.Context, in *pbMsg.GetMaxAndMinSeqReq) (*pbMsg.GetMaxAndMinSeqResp, error) { - log.InfoByKv("rpc getMaxAndMinSeq is arriving", in.OperationID, in.String()) - //seq, err := model.GetBiggestSeqFromReceive(in.UserID) - maxSeq, err1 := commonDB.DB.GetUserMaxSeq(in.UserID) - minSeq, err2 := commonDB.DB.GetUserMinSeq(in.UserID) - resp := new(pbMsg.GetMaxAndMinSeqResp) - if err1 == nil { - resp.MaxSeq = maxSeq - } else if err1 == redis.ErrNil { - resp.MaxSeq = 0 - } else { - log.NewError(in.OperationID, "getMaxSeq from redis error", in.String(), err1.Error()) - resp.MaxSeq = -1 - resp.ErrCode = 200 - resp.ErrMsg = "redis get err" - } - if err2 == nil { - resp.MinSeq = minSeq - } else if err2 == redis.ErrNil { - resp.MinSeq = 0 - } else { - log.NewError(in.OperationID, "getMaxSeq from redis error", in.String(), err2.Error()) - resp.MinSeq = -1 - resp.ErrCode = 201 - resp.ErrMsg = "redis get err" - } - return resp, nil -} -func (rpc *rpcChat) PullMessage(_ context.Context, in *pbMsg.PullMessageReq) (*pbMsg.PullMessageResp, error) { - log.InfoByKv("rpc pullMessage is arriving", in.OperationID, "args", in.String()) - resp := new(pbMsg.PullMessageResp) - var respSingleMsgFormat []*pbMsg.GatherFormat - var respGroupMsgFormat []*pbMsg.GatherFormat - SingleMsgFormat, GroupMsgFormat, MaxSeq, MinSeq, err := commonDB.DB.GetMsgBySeqRange(in.UserID, in.SeqBegin, in.SeqEnd) - if err != nil { - log.ErrorByKv("pullMsg data error", in.OperationID, in.String()) - resp.ErrCode = 1 - resp.ErrMsg = err.Error() - return resp, nil - } - respSingleMsgFormat = singleMsgHandleByUser(SingleMsgFormat, in.UserID) - respGroupMsgFormat = groupMsgHandleByUser(GroupMsgFormat) - return &pbMsg.PullMessageResp{ - ErrCode: 0, - ErrMsg: "", - MaxSeq: MaxSeq, - MinSeq: MinSeq, - SingleUserMsg: respSingleMsgFormat, - GroupUserMsg: respGroupMsgFormat, - }, nil -} -func (rpc *rpcChat) PullMessageBySeqList(_ context.Context, in *pbMsg.PullMessageBySeqListReq) (*pbMsg.PullMessageResp, error) { - log.NewInfo(in.OperationID, "rpc PullMessageBySeqList is arriving", in.String()) - resp := new(pbMsg.PullMessageResp) - var respSingleMsgFormat []*pbMsg.GatherFormat - var respGroupMsgFormat []*pbMsg.GatherFormat - SingleMsgFormat, GroupMsgFormat, MaxSeq, MinSeq, err := commonDB.DB.GetMsgBySeqList(in.UserID, in.SeqList) - if err != nil { - log.ErrorByKv("PullMessageBySeqList data error", in.OperationID, in.String()) - resp.ErrCode = 1 - resp.ErrMsg = err.Error() - return resp, nil - } - respSingleMsgFormat = singleMsgHandleByUser(SingleMsgFormat, in.UserID) - respGroupMsgFormat = groupMsgHandleByUser(GroupMsgFormat) - return &pbMsg.PullMessageResp{ - ErrCode: 0, - ErrMsg: "", - MaxSeq: MaxSeq, - MinSeq: MinSeq, - SingleUserMsg: respSingleMsgFormat, - GroupUserMsg: respGroupMsgFormat, - }, nil -} -func singleMsgHandleByUser(allMsg []*pbMsg.MsgFormat, ownerId string) []*pbMsg.GatherFormat { - var userid string - var respMsgFormat []*pbMsg.GatherFormat - m := make(map[string]MsgFormats) - //Gather messages in the dimension of users - for _, v := range allMsg { - if v.RecvID != ownerId { - userid = v.RecvID - } else { - userid = v.SendID - } - if value, ok := m[userid]; !ok { - var t MsgFormats - m[userid] = append(t, v) - } else { - m[userid] = append(value, v) - } - } - //Return in pb format - for user, msg := range m { - tempUserMsg := new(pbMsg.GatherFormat) - tempUserMsg.ID = user - tempUserMsg.List = msg - sort.Sort(msg) - respMsgFormat = append(respMsgFormat, tempUserMsg) - } - return respMsgFormat -} -func groupMsgHandleByUser(allMsg []*pbMsg.MsgFormat) []*pbMsg.GatherFormat { - var respMsgFormat []*pbMsg.GatherFormat - m := make(map[string]MsgFormats) - //Gather messages in the dimension of users - for _, v := range allMsg { - //Get group ID - groupID := strings.Split(v.RecvID, " ")[1] - if value, ok := m[groupID]; !ok { - var t MsgFormats - m[groupID] = append(t, v) - } else { - m[groupID] = append(value, v) - } - - } - //Return in pb format - for groupID, msg := range m { - tempUserMsg := new(pbMsg.GatherFormat) - tempUserMsg.ID = groupID - tempUserMsg.List = msg - sort.Sort(msg) - respMsgFormat = append(respMsgFormat, tempUserMsg) - } - return respMsgFormat -} - -type MsgFormats []*pbMsg.MsgFormat - -// Implement the sort.Interface interface to get the number of elements method -func (s MsgFormats) Len() int { - return len(s) -} - -//Implement the sort.Interface interface comparison element method -func (s MsgFormats) Less(i, j int) bool { - return s[i].SendTime < s[j].SendTime -} - -//Implement the sort.Interface interface exchange element method -func (s MsgFormats) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} diff --git a/internal/rpc/chat/send_msg.go b/internal/rpc/chat/send_msg.go deleted file mode 100644 index 640309c91..000000000 --- a/internal/rpc/chat/send_msg.go +++ /dev/null @@ -1,280 +0,0 @@ -package chat - -import ( - "Open_IM/internal/api/group" - "Open_IM/internal/push/content_struct" - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/db" - "Open_IM/pkg/common/db/mysql_model/im_mysql_model" - http2 "Open_IM/pkg/common/http" - "Open_IM/pkg/common/log" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pbChat "Open_IM/pkg/proto/chat" - pbGroup "Open_IM/pkg/proto/group" - open_im_sdk "Open_IM/pkg/proto/sdk_ws" - "Open_IM/pkg/utils" - "context" - "encoding/json" - "math/rand" - "net/http" - "strconv" - "strings" - "time" -) - -type MsgCallBackReq struct { - SendID string `json:"sendID"` - RecvID string `json:"recvID"` - Content string `json:"content"` - SendTime int64 `json:"sendTime"` - MsgFrom int32 `json:"msgFrom"` - ContentType int32 `json:"contentType"` - SessionType int32 `json:"sessionType"` - PlatformID int32 `json:"senderPlatformID"` - MsgID string `json:"msgID"` - IsOnlineOnly bool `json:"isOnlineOnly"` -} -type MsgCallBackResp struct { - ErrCode int32 `json:"errCode"` - ErrMsg string `json:"errMsg"` - ResponseErrCode int32 `json:"responseErrCode"` - ResponseResult struct { - ModifiedMsg string `json:"modifiedMsg"` - Ext string `json:"ext"` - } -} - -func (rpc *rpcChat) UserSendMsg(_ context.Context, pb *pbChat.UserSendMsgReq) (*pbChat.UserSendMsgResp, error) { - replay := pbChat.UserSendMsgResp{} - log.NewDebug(pb.OperationID, "rpc sendMsg come here", pb.String()) - //if !utils.VerifyToken(pb.Token, pb.SendID) { - // return returnMsg(&replay, pb, http.StatusUnauthorized, "token validate err,not authorized", "", 0) - serverMsgID := GetMsgID(pb.SendID) - pbData := pbChat.WSToMsgSvrChatMsg{} - pbData.MsgFrom = pb.MsgFrom - pbData.SessionType = pb.SessionType - pbData.ContentType = pb.ContentType - pbData.Content = pb.Content - pbData.RecvID = pb.RecvID - pbData.ForceList = pb.ForceList - pbData.OfflineInfo = pb.OffLineInfo - pbData.Options = pb.Options - pbData.PlatformID = pb.PlatformID - pbData.ClientMsgID = pb.ClientMsgID - pbData.SendID = pb.SendID - pbData.SenderNickName = pb.SenderNickName - pbData.SenderFaceURL = pb.SenderFaceURL - pbData.MsgID = serverMsgID - pbData.OperationID = pb.OperationID - pbData.Token = pb.Token - if pb.SendTime == 0 { - pbData.SendTime = utils.GetCurrentTimestampByNano() - } else { - pbData.SendTime = pb.SendTime - } - options := utils.JsonStringToMap(pbData.Options) - isHistory := utils.GetSwitchFromOptions(options, "history") - mReq := MsgCallBackReq{ - SendID: pb.SendID, - RecvID: pb.RecvID, - Content: pb.Content, - SendTime: pbData.SendTime, - MsgFrom: pbData.MsgFrom, - ContentType: pb.ContentType, - SessionType: pb.SessionType, - PlatformID: pb.PlatformID, - MsgID: pb.ClientMsgID, - } - if !isHistory { - mReq.IsOnlineOnly = true - } - mResp := MsgCallBackResp{} - if config.Config.MessageCallBack.CallbackSwitch { - bMsg, err := http2.Post(config.Config.MessageCallBack.CallbackUrl, mReq, config.Config.MessageCallBack.CallBackTimeOut) - if err != nil { - log.ErrorByKv("callback to Business server err", pb.OperationID, "args", pb.String(), "err", err.Error()) - return returnMsg(&replay, pb, http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError), "", 0) - } else if err = json.Unmarshal(bMsg, &mResp); err != nil { - log.ErrorByKv("ws json Unmarshal err", pb.OperationID, "args", pb.String(), "err", err.Error()) - return returnMsg(&replay, pb, 200, err.Error(), "", 0) - } else { - if mResp.ErrCode != 0 { - return returnMsg(&replay, pb, mResp.ResponseErrCode, mResp.ErrMsg, "", 0) - } else { - pbData.Content = mResp.ResponseResult.ModifiedMsg - } - } - } - switch pbData.SessionType { - case constant.SingleChatType: - isSend := modifyMessageByUserMessageReceiveOpt(pbData.RecvID, pbData.SendID, constant.SingleChatType, &pbData) - if isSend { - err1 := rpc.sendMsgToKafka(&pbData, pbData.RecvID) - if err1 != nil { - log.NewError(pbData.OperationID, "kafka send msg err:RecvID", pbData.RecvID, pbData.String()) - return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0) - } - } - err2 := rpc.sendMsgToKafka(&pbData, pbData.SendID) - if err2 != nil { - log.NewError(pbData.OperationID, "kafka send msg err:SendID", pbData.SendID, pbData.String()) - return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0) - } - return returnMsg(&replay, pb, 0, "", serverMsgID, pbData.SendTime) - case constant.GroupChatType: - etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) - client := pbGroup.NewGroupClient(etcdConn) - req := &pbGroup.GetGroupAllMemberReq{ - GroupID: pbData.RecvID, - Token: pbData.Token, - OperationID: pbData.OperationID, - } - reply, err := client.GetGroupAllMember(context.Background(), req) - if err != nil { - log.Error(pbData.Token, pbData.OperationID, "rpc send_msg getGroupInfo failed, err = %s", err.Error()) - return returnMsg(&replay, pb, 201, err.Error(), "", 0) - } - if reply.ErrorCode != 0 { - log.Error(pbData.Token, pbData.OperationID, "rpc send_msg getGroupInfo failed, err = %s", reply.ErrorMsg) - return returnMsg(&replay, pb, reply.ErrorCode, reply.ErrorMsg, "", 0) - } - var addUidList []string - switch pbData.ContentType { - case constant.KickGroupMemberTip: - var notification content_struct.NotificationContent - var kickContent group.KickGroupMemberReq - err := utils.JsonStringToStruct(pbData.Content, ¬ification) - if err != nil { - log.ErrorByKv("json unmarshall err", pbData.OperationID, "err", err.Error()) - return returnMsg(&replay, pb, 200, err.Error(), "", 0) - } else { - err := utils.JsonStringToStruct(notification.Detail, &kickContent) - if err != nil { - log.ErrorByKv("json unmarshall err", pbData.OperationID, "err", err.Error()) - return returnMsg(&replay, pb, 200, err.Error(), "", 0) - } - for _, v := range kickContent.UidListInfo { - addUidList = append(addUidList, v.UserId) - } - } - case constant.QuitGroupTip: - addUidList = append(addUidList, pbData.SendID) - default: - } - groupID := pbData.RecvID - for i, v := range reply.MemberList { - pbData.RecvID = v.UserId + " " + groupID - isSend := modifyMessageByUserMessageReceiveOpt(v.UserId, groupID, constant.GroupChatType, &pbData) - if isSend { - err := rpc.sendMsgToKafka(&pbData, utils.IntToString(i)) - if err != nil { - log.NewError(pbData.OperationID, "kafka send msg err:UserId", v.UserId, pbData.String()) - return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0) - } - } - - } - for i, v := range addUidList { - pbData.RecvID = v + " " + groupID - isSend := modifyMessageByUserMessageReceiveOpt(v, groupID, constant.GroupChatType, &pbData) - if isSend { - err := rpc.sendMsgToKafka(&pbData, utils.IntToString(i+1)) - if err != nil { - log.NewError(pbData.OperationID, "kafka send msg err:UserId", v, pbData.String()) - return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0) - } - } - } - return returnMsg(&replay, pb, 0, "", serverMsgID, pbData.SendTime) - default: - return returnMsg(&replay, pb, 203, "unkonwn sessionType", "", 0) - - } - -} - -type WSToMsgSvrChatMsg struct { - SendID string `protobuf:"bytes,1,opt,name=SendID" json:"SendID,omitempty"` - RecvID string `protobuf:"bytes,2,opt,name=RecvID" json:"RecvID,omitempty"` - Content string `protobuf:"bytes,3,opt,name=Content" json:"Content,omitempty"` - MsgFrom int32 `protobuf:"varint,5,opt,name=MsgFrom" json:"MsgFrom,omitempty"` - ContentType int32 `protobuf:"varint,8,opt,name=ContentType" json:"ContentType,omitempty"` - SessionType int32 `protobuf:"varint,9,opt,name=SessionType" json:"SessionType,omitempty"` - OperationID string `protobuf:"bytes,10,opt,name=OperationID" json:"OperationID,omitempty"` -} - -func CreateGroupNotification(sendID string, creator im_mysql_model.User, group im_mysql_model.Group, memberList []im_mysql_model.GroupMember) { - var msg WSToMsgSvrChatMsg - msg.OperationID = utils.OperationIDGenerator() - msg.SendID = sendID - msg.RecvID = group.GroupId - msg.ContentType = constant.CreateGroupTip - msg.SessionType = constant.GroupChatType - msg.MsgFrom = constant.SysMsgType - - var groupCreated open_im_sdk.GroupCreatedTips - groupCreated.Group = &open_im_sdk.GroupInfo{} - utils.CopyStructFields(groupCreated.Group, group) - groupCreated.Creator = &open_im_sdk.GroupMemberFullInfo{} - utils.CopyStructFields(groupCreated.Creator, creator) - for _, v := range memberList { - var groupMemberInfo open_im_sdk.GroupMemberFullInfo - utils.CopyStructFields(&groupMemberInfo, v) - groupCreated.MemberList = append(groupCreated.MemberList, &groupMemberInfo) - } - var tips open_im_sdk.TipsComm - tips.Detail = utils.StructToJsonString(groupCreated) - tips.DefaultTips = creator.Name + " " + config.Config.DefaultTips.GroupCreatedTips - msg.Content = utils.StructToJsonString(tips) - Notification(&msg, false) -} - -func Notification(m *WSToMsgSvrChatMsg, onlineUserOnly bool) { - -} - -func (rpc *rpcChat) sendMsgToKafka(m *pbChat.WSToMsgSvrChatMsg, key string) error { - pid, offset, err := rpc.producer.SendMessage(m, key) - if err != nil { - log.ErrorByKv("kafka send failed", m.OperationID, "send data", m.String(), "pid", pid, "offset", offset, "err", err.Error(), "key", key) - } - return err -} -func GetMsgID(sendID string) string { - t := time.Now().Format("2006-01-02 15:04:05") - return t + "-" + sendID + "-" + strconv.Itoa(rand.Int()) -} -func returnMsg(replay *pbChat.UserSendMsgResp, pb *pbChat.UserSendMsgReq, errCode int32, errMsg, serverMsgID string, sendTime int64) (*pbChat.UserSendMsgResp, error) { - replay.ErrCode = errCode - replay.ErrMsg = errMsg - replay.ReqIdentifier = pb.ReqIdentifier - replay.ClientMsgID = pb.ClientMsgID - replay.ServerMsgID = serverMsgID - replay.SendTime = sendTime - return replay, nil -} -func modifyMessageByUserMessageReceiveOpt(userID, sourceID string, sessionType int, msg *pbChat.WSToMsgSvrChatMsg) bool { - conversationID := utils.GetConversationIDBySessionType(sourceID, sessionType) - opt, err := db.DB.GetSingleConversationMsgOpt(userID, conversationID) - if err != nil { - log.NewError(msg.OperationID, "GetSingleConversationMsgOpt from redis err", msg.String()) - return true - } - switch opt { - case constant.ReceiveMessage: - return true - case constant.NotReceiveMessage: - return false - case constant.ReceiveNotNotifyMessage: - options := utils.JsonStringToMap(msg.Options) - if options == nil { - options = make(map[string]int32, 2) - } - utils.SetSwitchFromOptions(options, "offlinePush", 0) - msg.Options = utils.MapIntToJsonString(options) - return true - } - - return true -} diff --git a/internal/rpc/friend/add_blacklist.go b/internal/rpc/friend/add_blacklist.go deleted file mode 100644 index 07fa2d032..000000000 --- a/internal/rpc/friend/add_blacklist.go +++ /dev/null @@ -1,47 +0,0 @@ -package friend - -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" - pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/pkg/utils" - "context" -) - -func (s *friendServer) AddBlacklist(ctx context.Context, req *pbFriend.AddBlacklistReq) (*pbFriend.CommonResp, error) { - log.Info(req.Token, req.OperationID, "rpc add blacklist is server,args=%s", req.String()) - //Parse token, to find current user information - claims, err := token_verify.ParseToken(req.Token) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbFriend.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil - } - - isMagagerFlag := 0 - tokenUid := claims.UID - - if utils.IsContain(tokenUid, config.Config.Manager.AppManagerUid) { - isMagagerFlag = 1 - } - - if isMagagerFlag == 0 { - err = im_mysql_model.InsertInToUserBlackList(claims.UID, req.Uid) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,Failed to add blacklist", err.Error()) - return &pbFriend.CommonResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: constant.ErrMysql.ErrMsg}, nil - } - log.Info(req.Token, req.OperationID, "rpc add blacklist success return,uid=%s", req.Uid) - return &pbFriend.CommonResp{}, nil - } - - err = im_mysql_model.InsertInToUserBlackList(req.OwnerUid, req.Uid) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,Failed to add blacklist", err.Error()) - return &pbFriend.CommonResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: constant.ErrMysql.ErrMsg}, nil - } - log.Info(req.Token, req.OperationID, "rpc add blacklist success return,uid=%s", req.Uid) - return &pbFriend.CommonResp{}, nil -} diff --git a/internal/rpc/friend/add_friend.go b/internal/rpc/friend/add_friend.go deleted file mode 100644 index cc10572b5..000000000 --- a/internal/rpc/friend/add_friend.go +++ /dev/null @@ -1,133 +0,0 @@ -package friend - -import ( - "Open_IM/internal/push/content_struct" - "Open_IM/internal/push/logic" - "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" - pbChat "Open_IM/pkg/proto/chat" - pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/pkg/utils" - "context" -) - -func (s *friendServer) AddFriend(ctx context.Context, req *pbFriend.AddFriendReq) (*pbFriend.CommonResp, error) { - log.Info(req.Token, req.OperationID, "rpc add friend is server,userid=%s", req.Uid) - //Parse token, to find current user information - claims, err := token_verify.ParseToken(req.Token) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbFriend.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil - } - //Cannot add non-existent users - if _, err = im_mysql_model.FindUserByUID(req.Uid); err != nil { - log.Error(req.Token, req.OperationID, "this user not exists,cant not add friend") - return &pbFriend.CommonResp{ErrorCode: constant.ErrAddFriend.ErrCode, ErrorMsg: constant.ErrSearchUserInfo.ErrMsg}, nil - } - - //Establish a latest relationship in the friend request table - err = im_mysql_model.ReplaceIntoFriendReq(claims.UID, req.Uid, constant.ApplicationFriendFlag, req.ReqMessage) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,create friend request record failed", err.Error()) - return &pbFriend.CommonResp{ErrorCode: constant.ErrAddFriend.ErrCode, ErrorMsg: constant.ErrAddFriend.ErrMsg}, nil - } - log.Info(req.Token, req.OperationID, "rpc add friend is success return,uid=%s", req.Uid) - //Push message when add friend successfully - senderInfo, errSend := im_mysql_model.FindUserByUID(claims.UID) - receiverInfo, errReceive := im_mysql_model.FindUserByUID(req.Uid) - if errSend == nil && errReceive == nil { - logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{ - SendID: senderInfo.UID, - RecvID: receiverInfo.UID, - Content: content_struct.NewContentStructString(0, "", senderInfo.Name+" asked to add you as a friend"), - SendTime: utils.GetCurrentTimestampBySecond(), - MsgFrom: constant.SysMsgType, - ContentType: constant.AddFriendTip, - SessionType: constant.SingleChatType, - OperationID: req.OperationID, - }) - } - return &pbFriend.CommonResp{}, nil -} - -func (s *friendServer) ImportFriend(ctx context.Context, req *pbFriend.ImportFriendReq) (*pbFriend.ImportFriendResp, error) { - log.Info(req.Token, req.OperationID, "ImportFriend come here,args=%s", req.String()) - var resp pbFriend.ImportFriendResp - var c pbFriend.CommonResp - //Parse token, to find current user information - claims, err := token_verify.ParseToken(req.Token) - if err != nil { - log.NewError(req.OperationID, "parse token failed", err.Error()) - c.ErrorCode = constant.ErrAddFriend.ErrCode - c.ErrorMsg = constant.ErrParseToken.ErrMsg - return &pbFriend.ImportFriendResp{CommonResp: &c, FailedUidList: req.UidList}, nil - } - - if !utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) { - log.NewError(req.OperationID, "not manager uid", claims.UID) - c.ErrorCode = constant.ErrAddFriend.ErrCode - c.ErrorMsg = "not authorized" - return &pbFriend.ImportFriendResp{CommonResp: &c, FailedUidList: req.UidList}, nil - } - if _, err = im_mysql_model.FindUserByUID(req.OwnerUid); err != nil { - log.NewError(req.OperationID, "this user not exists,cant not add friend", req.OwnerUid) - c.ErrorCode = constant.ErrAddFriend.ErrCode - c.ErrorMsg = "this user not exists,cant not add friend" - return &pbFriend.ImportFriendResp{CommonResp: &c, FailedUidList: req.UidList}, nil - } - for _, v := range req.UidList { - if _, fErr := im_mysql_model.FindUserByUID(v); fErr != nil { - c.ErrorMsg = "some uid establish failed" - c.ErrorCode = 408 - resp.FailedUidList = append(resp.FailedUidList, v) - } else { - if _, err = im_mysql_model.FindFriendRelationshipFromFriend(req.OwnerUid, v); err != nil { - //Establish two single friendship - err1 := im_mysql_model.InsertToFriend(req.OwnerUid, v, 1) - if err1 != nil { - resp.FailedUidList = append(resp.FailedUidList, v) - log.NewError(req.OperationID, "err1,create friendship failed", req.OwnerUid, v, err1.Error()) - } - err2 := im_mysql_model.InsertToFriend(v, req.OwnerUid, 1) - if err2 != nil { - log.NewError(req.OperationID, "err2,create friendship failed", v, req.OwnerUid, err2.Error()) - } - if err1 == nil && err2 == nil { - var name, faceUrl string - n := content_struct.NotificationContent{IsDisplay: 1, DefaultTips: constant.FriendAcceptTip} - r, err := im_mysql_model.FindUserByUID(v) - if err != nil { - log.NewError(req.OperationID, "get info failed", err.Error(), v) - } - if r != nil { - name, faceUrl = r.Name, r.Icon - } - - logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{ - SendID: v, - RecvID: req.OwnerUid, - SenderFaceURL: faceUrl, - SenderNickName: name, - Content: n.ContentToString(), - SendTime: utils.GetCurrentTimestampByNano(), - MsgFrom: constant.UserMsgType, //Notification message identification - ContentType: constant.AcceptFriendApplicationTip, //Add friend flag - SessionType: constant.SingleChatType, - OperationID: req.OperationID, - }) - } else { - c.ErrorMsg = "some uid establish failed" - c.ErrorCode = 408 - resp.FailedUidList = append(resp.FailedUidList, v) - } - } - } - } - resp.CommonResp = &c - log.NewDebug(req.OperationID, "rpc come end", resp.CommonResp.ErrorCode, resp.CommonResp.ErrorMsg, resp.FailedUidList) - return &resp, nil - -} diff --git a/internal/rpc/friend/add_friend_response.go b/internal/rpc/friend/add_friend_response.go deleted file mode 100644 index e1e914ffd..000000000 --- a/internal/rpc/friend/add_friend_response.go +++ /dev/null @@ -1,84 +0,0 @@ -package friend - -import ( - "Open_IM/internal/push/content_struct" - "Open_IM/internal/push/logic" - "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" - pbChat "Open_IM/pkg/proto/chat" - pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/pkg/utils" - "context" -) - -func (s *friendServer) AddFriendResponse(ctx context.Context, req *pbFriend.AddFriendResponseReq) (*pbFriend.CommonResp, error) { - log.Info(req.Token, req.OperationID, "rpc add friend response is server,args=%s", req.String()) - //Parse token, to find current user information - claims, err := token_verify.ParseToken(req.Token) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbFriend.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil - } - //Check there application before agreeing or refuse to a friend's application - if _, err = im_mysql_model.FindFriendApplyFromFriendReqByUid(req.Uid, claims.UID); err != nil { - log.Error(req.Token, req.OperationID, "No such application record") - return &pbFriend.CommonResp{ErrorCode: constant.ErrAgreeToAddFriend.ErrCode, ErrorMsg: constant.ErrAgreeToAddFriend.ErrMsg}, nil - } - //Change friend request status flag - err = im_mysql_model.UpdateFriendRelationshipToFriendReq(req.Uid, claims.UID, req.Flag) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,update friend request table failed", err.Error()) - return &pbFriend.CommonResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: constant.ErrAgreeToAddFriend.ErrMsg}, nil - } - log.Info(req.Token, req.OperationID, "rpc add friend response success return,userid=%s,flag=%d", req.Uid, req.Flag) - //Change the status of the friend request form - if req.Flag == constant.FriendFlag { - //Establish friendship after find friend relationship not exists - _, err := im_mysql_model.FindFriendRelationshipFromFriend(claims.UID, req.Uid) - //fixme If there is an error, it means that there is no friend record or database err, if no friend record should be inserted,Continue down execution - if err != nil { - log.Error("", req.OperationID, err.Error()) - } - //Establish two single friendship - err = im_mysql_model.InsertToFriend(claims.UID, req.Uid, req.Flag) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,create friendship failed", err.Error()) - } - err = im_mysql_model.InsertToFriend(req.Uid, claims.UID, req.Flag) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,create friendship failed", err.Error()) - } - //Push message when establish friends successfully - //senderInfo, errSend := im_mysql_model.FindUserByUID(claims.UID) - //if errSend == nil { - // logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{ - // SendID: claims.UID, - // RecvID: req.Uid, - // Content: content_struct.NewContentStructString(1, "", senderInfo.Name+" agreed to add you as a friend."), - // SendTime: utils.GetCurrentTimestampBySecond(), - // MsgFrom: constant.UserMsgType, //Notification message identification - // ContentType: constant.AcceptFriendApplicationTip, //Add friend flag - // SessionType: constant.SingleChatType, - // OperationID: req.OperationID, - // }) - //} - } - if req.Flag == constant.RefuseFriendFlag { - senderInfo, errSend := im_mysql_model.FindUserByUID(claims.UID) - if errSend == nil { - logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{ - SendID: claims.UID, - RecvID: req.Uid, - Content: content_struct.NewContentStructString(0, "", senderInfo.Name+" refuse to add you as a friend."), - SendTime: utils.GetCurrentTimestampBySecond(), - MsgFrom: constant.UserMsgType, //Notification message identification - ContentType: constant.RefuseFriendApplicationTip, //Add friend flag - SessionType: constant.SingleChatType, - OperationID: req.OperationID, - }) - } - } - return &pbFriend.CommonResp{}, nil -} diff --git a/internal/rpc/friend/delete_friend.go b/internal/rpc/friend/delete_friend.go deleted file mode 100644 index b1db00aa7..000000000 --- a/internal/rpc/friend/delete_friend.go +++ /dev/null @@ -1,27 +0,0 @@ -package friend - -import ( - "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" - pbFriend "Open_IM/pkg/proto/friend" - "context" -) - -func (s *friendServer) DeleteFriend(ctx context.Context, req *pbFriend.DeleteFriendReq) (*pbFriend.CommonResp, error) { - log.Info(req.Token, req.OperationID, "rpc delete friend is server,args=%s", req.String()) - //Parse token, to find current user information - claims, err := token_verify.ParseToken(req.Token) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbFriend.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil - } - err = im_mysql_model.DeleteSingleFriendInfo(claims.UID, req.Uid) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,delete friend failed", err.Error()) - return &pbFriend.CommonResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: constant.ErrMysql.ErrMsg}, nil - } - log.Info(req.Token, req.OperationID, "rpc delete friend success return") - return &pbFriend.CommonResp{}, nil -} diff --git a/internal/rpc/friend/firend.go b/internal/rpc/friend/firend.go new file mode 100644 index 000000000..578118dfc --- /dev/null +++ b/internal/rpc/friend/firend.go @@ -0,0 +1,514 @@ +package friend + +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" + cp "Open_IM/pkg/common/utils" + "Open_IM/pkg/grpc-etcdv3/getcdv3" + pbFriend "Open_IM/pkg/proto/friend" + sdkws "Open_IM/pkg/proto/sdk_ws" + "Open_IM/pkg/utils" + "context" + "google.golang.org/grpc" + "net" + "strconv" + "strings" + "time" +) + +type friendServer struct { + rpcPort int + rpcRegisterName string + etcdSchema string + etcdAddr []string +} + +func NewFriendServer(port int) *friendServer { + log.NewPrivateLog("friend") + return &friendServer{ + rpcPort: port, + rpcRegisterName: config.Config.RpcRegisterName.OpenImFriendName, + etcdSchema: config.Config.Etcd.EtcdSchema, + etcdAddr: config.Config.Etcd.EtcdAddr, + } +} + +func (s *friendServer) Run() { + log.NewInfo("0", "friendServer run...") + + ip := utils.ServerIP + registerAddress := ip + ":" + strconv.Itoa(s.rpcPort) + //listener network + listener, err := net.Listen("tcp", registerAddress) + if err != nil { + log.NewError("0", "Listen failed ", err.Error(), registerAddress) + return + } + log.NewInfo("0", "listen ok ", registerAddress) + defer listener.Close() + //grpc server + srv := grpc.NewServer() + defer srv.GracefulStop() + //User friend related services register to etcd + pbFriend.RegisterFriendServer(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(), listener) + return + } +} + +func (s *friendServer) AddBlacklist(ctx context.Context, req *pbFriend.AddBlacklistReq) (*pbFriend.AddBlacklistResp, error) { + log.NewInfo(req.CommID.OperationID, "AddBlacklist args ", req.String()) + ok := token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID) + if !ok { + log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID) + return &pbFriend.AddBlacklistResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil + } + black := db.Black{OwnerUserID: req.CommID.FromUserID, BlockUserID: req.CommID.ToUserID, OperatorUserID: req.CommID.OpUserID} + + err := imdb.InsertInToUserBlackList(black) + if err != nil { + log.NewError(req.CommID.OperationID, "InsertInToUserBlackList failed ", err.Error()) + return &pbFriend.AddBlacklistResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + log.NewInfo(req.CommID.OperationID, "AddBlacklist rpc ok ", req.CommID.FromUserID, req.CommID.ToUserID) + chat.BlackAddedNotification(req) + return &pbFriend.AddBlacklistResp{CommonResp: &pbFriend.CommonResp{}}, nil +} + +func (s *friendServer) AddFriend(ctx context.Context, req *pbFriend.AddFriendReq) (*pbFriend.AddFriendResp, error) { + log.NewInfo(req.CommID.OperationID, "AddFriend args ", req.String()) + ok := token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID) + if !ok { + log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID) + return &pbFriend.AddFriendResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil + } + //Cannot add non-existent users + if _, err := imdb.GetUserByUserID(req.CommID.ToUserID); err != nil { + log.NewError(req.CommID.OperationID, "GetUserByUserID failed ", err.Error(), req.CommID.ToUserID) + return &pbFriend.AddFriendResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + + //Establish a latest relationship in the friend request table + friendRequest := db.FriendRequest{ReqMsg: req.ReqMsg} + utils.CopyStructFields(&friendRequest, req.CommID) + // {openIM001 openIM002 0 test add friend 0001-01-01 00:00:00 +0000 UTC 0001-01-01 00:00:00 +0000 UTC }] + log.NewDebug(req.CommID.OperationID, "UpdateFriendApplication args ", friendRequest) + err := imdb.InsertFriendApplication(&friendRequest) + if err != nil { + log.NewError(req.CommID.OperationID, "UpdateFriendApplication failed ", err.Error(), friendRequest) + return &pbFriend.AddFriendResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + + chat.FriendApplicationNotification(req) + return &pbFriend.AddFriendResp{CommonResp: &pbFriend.CommonResp{}}, nil +} + +func (s *friendServer) ImportFriend(ctx context.Context, req *pbFriend.ImportFriendReq) (*pbFriend.ImportFriendResp, error) { + log.NewInfo(req.OperationID, "ImportFriend args ", req.String()) + resp := pbFriend.ImportFriendResp{CommonResp: &pbFriend.CommonResp{}} + var c pbFriend.CommonResp + + if !utils.IsContain(req.OpUserID, config.Config.Manager.AppManagerUid) { + log.NewError(req.OperationID, "not authorized", req.OpUserID, config.Config.Manager.AppManagerUid) + c.ErrCode = constant.ErrAccess.ErrCode + c.ErrMsg = constant.ErrAccess.ErrMsg + for _, v := range req.FriendUserIDList { + resp.UserIDResultList = append(resp.UserIDResultList, &pbFriend.UserIDResult{UserID: v, Result: -1}) + } + resp.CommonResp = &c + return &resp, nil + } + if _, err := imdb.GetUserByUserID(req.FromUserID); err != nil { + log.NewError(req.OperationID, "GetUserByUserID failed ", err.Error(), req.FromUserID) + c.ErrCode = constant.ErrDB.ErrCode + c.ErrMsg = "this user not exists,cant not add friend" + for _, v := range req.FriendUserIDList { + resp.UserIDResultList = append(resp.UserIDResultList, &pbFriend.UserIDResult{UserID: v, Result: -1}) + } + resp.CommonResp = &c + return &resp, nil + } + + for _, v := range req.FriendUserIDList { + log.NewDebug(req.OperationID, "FriendUserIDList ", v) + if _, fErr := imdb.GetUserByUserID(v); fErr != nil { + log.NewError(req.OperationID, "GetUserByUserID failed ", fErr.Error(), v) + resp.UserIDResultList = append(resp.UserIDResultList, &pbFriend.UserIDResult{UserID: v, Result: -1}) + } else { + if _, err := imdb.GetFriendRelationshipFromFriend(req.FromUserID, v); err != nil { + //Establish two single friendship + toInsertFollow := db.Friend{OwnerUserID: req.FromUserID, FriendUserID: v} + err1 := imdb.InsertToFriend(&toInsertFollow) + if err1 != nil { + log.NewError(req.OperationID, "InsertToFriend failed ", err1.Error(), toInsertFollow) + resp.UserIDResultList = append(resp.UserIDResultList, &pbFriend.UserIDResult{UserID: v, Result: -1}) + continue + } + toInsertFollow = db.Friend{OwnerUserID: v, FriendUserID: req.FromUserID} + err2 := imdb.InsertToFriend(&toInsertFollow) + if err2 != nil { + log.NewError(req.OperationID, "InsertToFriend failed ", err2.Error(), toInsertFollow) + resp.UserIDResultList = append(resp.UserIDResultList, &pbFriend.UserIDResult{UserID: v, Result: -1}) + continue + } + resp.UserIDResultList = append(resp.UserIDResultList, &pbFriend.UserIDResult{UserID: v, Result: 0}) + log.NewDebug(req.OperationID, "UserIDResultList ", resp.UserIDResultList) + chat.FriendAddedNotification(req.OperationID, req.OpUserID, req.FromUserID, v) + } else { + log.NewWarn(req.OperationID, "GetFriendRelationshipFromFriend ok", req.FromUserID, v) + resp.UserIDResultList = append(resp.UserIDResultList, &pbFriend.UserIDResult{UserID: v, Result: 0}) + } + } + } + resp.CommonResp.ErrCode = 0 + log.NewInfo(req.OperationID, "ImportFriend rpc ok ", resp.String()) + return &resp, nil +} + +//process Friend application +func (s *friendServer) AddFriendResponse(ctx context.Context, req *pbFriend.AddFriendResponseReq) (*pbFriend.AddFriendResponseResp, error) { + log.NewInfo(req.CommID.OperationID, "AddFriendResponse args ", req.String()) + + if !token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID) { + log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID) + return &pbFriend.AddFriendResponseResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil + } + + //Check there application before agreeing or refuse to a friend's application + //req.CommID.FromUserID process req.CommID.ToUserID + friendRequest, err := imdb.GetFriendApplicationByBothUserID(req.CommID.ToUserID, req.CommID.FromUserID) + if err != nil { + log.NewError(req.CommID.OperationID, "GetFriendApplicationByBothUserID failed ", err.Error(), req.CommID.ToUserID, req.CommID.FromUserID) + return &pbFriend.AddFriendResponseResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + friendRequest.HandleResult = req.HandleResult + friendRequest.HandleTime = time.Now() + //friendRequest.HandleTime.Unix() + friendRequest.HandleMsg = req.HandleMsg + friendRequest.HandlerUserID = req.CommID.OpUserID + err = imdb.UpdateFriendApplication(friendRequest) + if err != nil { + log.NewError(req.CommID.OperationID, "UpdateFriendApplication failed ", err.Error(), friendRequest) + return &pbFriend.AddFriendResponseResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + + //Change the status of the friend request form + if req.HandleResult == constant.FriendFlag { + //Establish friendship after find friend relationship not exists + _, err := imdb.GetFriendRelationshipFromFriend(req.CommID.FromUserID, req.CommID.ToUserID) + if err == nil { + log.NewWarn(req.CommID.OperationID, "GetFriendRelationshipFromFriend exist", req.CommID.FromUserID, req.CommID.ToUserID) + } else { + //Establish two single friendship + toInsertFollow := db.Friend{OwnerUserID: req.CommID.FromUserID, FriendUserID: req.CommID.ToUserID, OperatorUserID: req.CommID.OpUserID} + err = imdb.InsertToFriend(&toInsertFollow) + if err != nil { + log.NewError(req.CommID.OperationID, "InsertToFriend failed ", err.Error(), toInsertFollow) + return &pbFriend.AddFriendResponseResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + } + + _, err = imdb.GetFriendRelationshipFromFriend(req.CommID.ToUserID, req.CommID.FromUserID) + if err == nil { + log.NewWarn(req.CommID.OperationID, "GetFriendRelationshipFromFriend exist", req.CommID.ToUserID, req.CommID.FromUserID) + } else { + toInsertFollow := db.Friend{OwnerUserID: req.CommID.ToUserID, FriendUserID: req.CommID.FromUserID, OperatorUserID: req.CommID.OpUserID} + err = imdb.InsertToFriend(&toInsertFollow) + if err != nil { + log.NewError(req.CommID.OperationID, "InsertToFriend failed ", err.Error(), toInsertFollow) + return &pbFriend.AddFriendResponseResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + chat.FriendAddedNotification(req.CommID.OperationID, req.CommID.OpUserID, req.CommID.FromUserID, req.CommID.ToUserID) + } + } + if req.HandleResult == constant.FriendResponseAgree { + chat.FriendApplicationApprovedNotification(req) + } else if req.HandleResult == constant.FriendResponseRefuse { + chat.FriendApplicationRejectedNotification(req) + } else { + log.Error(req.CommID.OperationID, "HandleResult failed ", req.HandleResult) + } + log.NewInfo(req.CommID.OperationID, "rpc AddFriendResponse ok") + return &pbFriend.AddFriendResponseResp{CommonResp: &pbFriend.CommonResp{}}, nil +} + +func (s *friendServer) DeleteFriend(ctx context.Context, req *pbFriend.DeleteFriendReq) (*pbFriend.DeleteFriendResp, error) { + log.NewInfo(req.CommID.OperationID, "DeleteFriend args ", req.String()) + //Parse token, to find current user information + if !token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID) { + log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID) + return &pbFriend.DeleteFriendResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil + } + err := imdb.DeleteSingleFriendInfo(req.CommID.FromUserID, req.CommID.ToUserID) + if err != nil { + log.NewError(req.CommID.OperationID, "DeleteSingleFriendInfo failed", err.Error(), req.CommID.FromUserID, req.CommID.ToUserID) + return &pbFriend.DeleteFriendResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil + } + log.NewInfo(req.CommID.OperationID, "DeleteFriend rpc ok") + chat.FriendDeletedNotification(req) + return &pbFriend.DeleteFriendResp{CommonResp: &pbFriend.CommonResp{}}, nil +} + +func (s *friendServer) GetBlacklist(ctx context.Context, req *pbFriend.GetBlacklistReq) (*pbFriend.GetBlacklistResp, error) { + log.NewInfo(req.CommID.OperationID, "GetBlacklist args ", req.String()) + + //Parse token, to find current user information + if !token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID) { + log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID) + return &pbFriend.GetBlacklistResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil + } + + blackListInfo, err := imdb.GetBlackListByUserID(req.CommID.FromUserID) + if err != nil { + log.NewError(req.CommID.OperationID, "GetBlackListByUID failed ", err.Error(), req.CommID.FromUserID) + return &pbFriend.GetBlacklistResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, nil + } + + var ( + userInfoList []*sdkws.PublicUserInfo + ) + for _, blackUser := range blackListInfo { + var blackUserInfo sdkws.PublicUserInfo + //Find black user information + us, err := imdb.GetUserByUserID(blackUser.BlockUserID) + if err != nil { + log.NewError(req.CommID.OperationID, "GetUserByUserID failed ", err.Error(), blackUser.BlockUserID) + continue + } + utils.CopyStructFields(&blackUserInfo, us) + userInfoList = append(userInfoList, &blackUserInfo) + } + log.NewInfo(req.CommID.OperationID, "rpc GetBlacklist ok ", pbFriend.GetBlacklistResp{BlackUserInfoList: userInfoList}) + return &pbFriend.GetBlacklistResp{BlackUserInfoList: userInfoList}, nil +} + +func (s *friendServer) SetFriendRemark(ctx context.Context, req *pbFriend.SetFriendRemarkReq) (*pbFriend.SetFriendRemarkResp, error) { + log.NewInfo(req.CommID.OperationID, "SetFriendComment args ", req.String()) + //Parse token, to find current user information + if !token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID) { + log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID) + return &pbFriend.SetFriendRemarkResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil + } + + err := imdb.UpdateFriendComment(req.CommID.FromUserID, req.CommID.ToUserID, req.Remark) + if err != nil { + log.NewError(req.CommID.OperationID, "UpdateFriendComment failed ", req.CommID.FromUserID, req.CommID.ToUserID, req.Remark) + return &pbFriend.SetFriendRemarkResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + log.NewInfo(req.CommID.OperationID, "rpc SetFriendComment ok") + chat.FriendRemarkSetNotification(req.CommID.OperationID, req.CommID.OpUserID, req.CommID.FromUserID, req.CommID.ToUserID) + return &pbFriend.SetFriendRemarkResp{CommonResp: &pbFriend.CommonResp{}}, nil +} + +func (s *friendServer) RemoveBlacklist(ctx context.Context, req *pbFriend.RemoveBlacklistReq) (*pbFriend.RemoveBlacklistResp, error) { + log.NewInfo(req.CommID.OperationID, "RemoveBlacklist args ", req.String()) + //Parse token, to find current user information + if !token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID) { + log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID) + return &pbFriend.RemoveBlacklistResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil + } + err := imdb.RemoveBlackList(req.CommID.FromUserID, req.CommID.ToUserID) + if err != nil { + log.NewError(req.CommID.OperationID, "RemoveBlackList failed", err.Error(), req.CommID.FromUserID, req.CommID.ToUserID) + return &pbFriend.RemoveBlacklistResp{CommonResp: &pbFriend.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil + + } + log.NewInfo(req.CommID.OperationID, "rpc RemoveBlacklist ok ") + chat.BlackDeletedNotification(req) + return &pbFriend.RemoveBlacklistResp{CommonResp: &pbFriend.CommonResp{}}, nil +} + +func (s *friendServer) IsInBlackList(ctx context.Context, req *pbFriend.IsInBlackListReq) (*pbFriend.IsInBlackListResp, error) { + log.NewInfo("IsInBlackList args ", req.String()) + if !token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID) { + log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID) + return &pbFriend.IsInBlackListResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil + } + + var isInBlacklist = false + err := imdb.CheckBlack(req.CommID.FromUserID, req.CommID.ToUserID) + if err == nil { + isInBlacklist = true + } + log.NewInfo(req.CommID.OperationID, "IsInBlackList rpc ok ", pbFriend.IsInBlackListResp{Response: isInBlacklist}) + return &pbFriend.IsInBlackListResp{Response: isInBlacklist}, nil +} + +func (s *friendServer) IsFriend(ctx context.Context, req *pbFriend.IsFriendReq) (*pbFriend.IsFriendResp, error) { + log.NewInfo("IsFriend args ", req.String()) + var isFriend bool + if !token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID) { + log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID) + return &pbFriend.IsFriendResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil + } + _, err := imdb.GetFriendRelationshipFromFriend(req.CommID.FromUserID, req.CommID.ToUserID) + if err == nil { + isFriend = true + } else { + isFriend = false + } + log.NewInfo("IsFriend rpc ok ", pbFriend.IsFriendResp{Response: isFriend}) + return &pbFriend.IsFriendResp{Response: isFriend}, nil +} + +func (s *friendServer) GetFriendList(ctx context.Context, req *pbFriend.GetFriendListReq) (*pbFriend.GetFriendListResp, error) { + log.NewInfo("GetFriendList args ", req.String()) + if !token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID) { + log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID) + return &pbFriend.GetFriendListResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil + } + + friends, err := imdb.GetFriendListByUserID(req.CommID.FromUserID) + if err != nil { + log.NewError(req.CommID.OperationID, "FindUserInfoFromFriend failed ", err.Error(), req.CommID.FromUserID) + return &pbFriend.GetFriendListResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, nil + } + var userInfoList []*sdkws.FriendInfo + for _, friendUser := range friends { + friendUserInfo := sdkws.FriendInfo{FriendUser: &sdkws.UserInfo{}} + cp.FriendDBCopyOpenIM(&friendUserInfo, &friendUser) + log.NewDebug(req.CommID.OperationID, "friends : ", friendUser, "openim friends: ", friendUserInfo) + userInfoList = append(userInfoList, &friendUserInfo) + } + log.NewInfo(req.CommID.OperationID, "rpc GetFriendList ok", pbFriend.GetFriendListResp{FriendInfoList: userInfoList}) + return &pbFriend.GetFriendListResp{FriendInfoList: userInfoList}, nil +} + +//received +func (s *friendServer) GetFriendApplyList(ctx context.Context, req *pbFriend.GetFriendApplyListReq) (*pbFriend.GetFriendApplyListResp, error) { + log.NewInfo(req.CommID.OperationID, "GetFriendApplyList args ", req.String()) + //Parse token, to find current user information + if !token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID) { + log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID) + return &pbFriend.GetFriendApplyListResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil + } + // Find the current user friend applications received + ApplyUsersInfo, err := imdb.GetReceivedFriendsApplicationListByUserID(req.CommID.FromUserID) + if err != nil { + log.NewError(req.CommID.OperationID, "GetReceivedFriendsApplicationListByUserID ", err.Error(), req.CommID.FromUserID) + return &pbFriend.GetFriendApplyListResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, nil + } + + var appleUserList []*sdkws.FriendRequest + for _, applyUserInfo := range ApplyUsersInfo { + var userInfo sdkws.FriendRequest + utils.CopyStructFields(&userInfo, applyUserInfo) + u, err := imdb.GetUserByUserID(userInfo.FromUserID) + if err != nil { + log.Error(req.CommID.OperationID, "GetUserByUserID", userInfo.FromUserID) + continue + } + userInfo.FromNickname = u.Nickname + userInfo.FromFaceURL = u.FaceURL + userInfo.FromGender = u.Gender + + u, err = imdb.GetUserByUserID(userInfo.ToUserID) + if err != nil { + log.Error(req.CommID.OperationID, "GetUserByUserID", userInfo.ToUserID) + continue + } + userInfo.ToNickname = u.Nickname + userInfo.ToFaceURL = u.FaceURL + userInfo.ToGender = u.Gender + appleUserList = append(appleUserList, &userInfo) + } + + log.NewInfo(req.CommID.OperationID, "rpc GetFriendApplyList ok", pbFriend.GetFriendApplyListResp{FriendRequestList: appleUserList}) + return &pbFriend.GetFriendApplyListResp{FriendRequestList: appleUserList}, nil +} + +func (s *friendServer) GetSelfApplyList(ctx context.Context, req *pbFriend.GetSelfApplyListReq) (*pbFriend.GetSelfApplyListResp, error) { + log.NewInfo(req.CommID.OperationID, "GetSelfApplyList args ", req.String()) + + //Parse token, to find current user information + if !token_verify.CheckAccess(req.CommID.OpUserID, req.CommID.FromUserID) { + log.NewError(req.CommID.OperationID, "CheckAccess false ", req.CommID.OpUserID, req.CommID.FromUserID) + return &pbFriend.GetSelfApplyListResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil + } + // Find the self add other userinfo + usersInfo, err := imdb.GetSendFriendApplicationListByUserID(req.CommID.FromUserID) + if err != nil { + log.NewError(req.CommID.OperationID, "GetSendFriendApplicationListByUserID failed ", err.Error(), req.CommID.FromUserID) + return &pbFriend.GetSelfApplyListResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, nil + } + var selfApplyOtherUserList []*sdkws.FriendRequest + for _, selfApplyOtherUserInfo := range usersInfo { + var userInfo sdkws.FriendRequest // pbFriend.ApplyUserInfo + cp.FriendRequestDBCopyOpenIM(&userInfo, &selfApplyOtherUserInfo) + u, err := imdb.GetUserByUserID(userInfo.FromUserID) + if err != nil { + log.Error(req.CommID.OperationID, "GetUserByUserID", userInfo.FromUserID) + continue + } + userInfo.FromNickname = u.Nickname + userInfo.FromFaceURL = u.FaceURL + userInfo.FromGender = u.Gender + + u, err = imdb.GetUserByUserID(userInfo.ToUserID) + if err != nil { + log.Error(req.CommID.OperationID, "GetUserByUserID", userInfo.ToUserID) + continue + } + userInfo.ToNickname = u.Nickname + userInfo.ToFaceURL = u.FaceURL + userInfo.ToGender = u.Gender + + selfApplyOtherUserList = append(selfApplyOtherUserList, &userInfo) + } + log.NewInfo(req.CommID.OperationID, "rpc GetSelfApplyList ok", pbFriend.GetSelfApplyListResp{FriendRequestList: selfApplyOtherUserList}) + return &pbFriend.GetSelfApplyListResp{FriendRequestList: selfApplyOtherUserList}, nil +} + +//// +//func (s *friendServer) GetFriendsInfo(ctx context.Context, req *pbFriend.GetFriendsInfoReq) (*pbFriend.GetFriendInfoResp, error) { +// return nil, nil +//// log.NewInfo(req.CommID.OperationID, "GetFriendsInfo args ", req.String()) +//// var ( +//// isInBlackList int32 +//// // isFriend int32 +//// comment string +//// ) +//// +//// friendShip, err := imdb.FindFriendRelationshipFromFriend(req.CommID.FromUserID, req.CommID.ToUserID) +//// if err != nil { +//// log.NewError(req.CommID.OperationID, "FindFriendRelationshipFromFriend failed ", err.Error()) +//// return &pbFriend.GetFriendInfoResp{ErrCode: constant.ErrSearchUserInfo.ErrCode, ErrMsg: constant.ErrSearchUserInfo.ErrMsg}, nil +//// // isFriend = constant.FriendFlag +//// } +//// comment = friendShip.Remark +//// +//// friendUserInfo, err := imdb.FindUserByUID(req.CommID.ToUserID) +//// if err != nil { +//// log.NewError(req.CommID.OperationID, "FindUserByUID failed ", err.Error()) +//// return &pbFriend.GetFriendInfoResp{ErrCode: constant.ErrSearchUserInfo.ErrCode, ErrMsg: constant.ErrSearchUserInfo.ErrMsg}, nil +//// } +//// +//// err = imdb.FindRelationshipFromBlackList(req.CommID.FromUserID, req.CommID.ToUserID) +//// if err == nil { +//// isInBlackList = constant.BlackListFlag +//// } +//// +//// resp := pbFriend.GetFriendInfoResp{ErrCode: 0, ErrMsg: "",} +//// +//// utils.CopyStructFields(resp.FriendInfoList, friendUserInfo) +//// resp.Data.IsBlack = isInBlackList +//// resp.Data.OwnerUserID = req.CommID.FromUserID +//// resp.Data.Remark = comment +//// resp.Data.CreateTime = friendUserInfo.CreateTime +//// +//// log.NewInfo(req.CommID.OperationID, "GetFriendsInfo ok ", resp) +//// return &resp, nil +//// +//} diff --git a/internal/rpc/friend/get_blacklist.go b/internal/rpc/friend/get_blacklist.go deleted file mode 100644 index 503e80da6..000000000 --- a/internal/rpc/friend/get_blacklist.go +++ /dev/null @@ -1,55 +0,0 @@ -package friend - -import ( - "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" - pbFriend "Open_IM/pkg/proto/friend" - "context" -) - -func (s *friendServer) GetBlacklist(ctx context.Context, req *pbFriend.GetBlacklistReq) (*pbFriend.GetBlacklistResp, error) { - log.Info(req.Token, req.OperationID, "rpc get blacklist is server,args=%s", req.String()) - var ( - userInfoList []*pbFriend.UserInfo - comment string - ) - //Parse token, to find current user information - claims, err := token_verify.ParseToken(req.Token) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbFriend.GetBlacklistResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil - } - blackListInfo, err := im_mysql_model.GetBlackListByUID(claims.UID) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s get blacklist failed", err.Error()) - return &pbFriend.GetBlacklistResp{ErrorCode: constant.ErrGetBlackList.ErrCode, ErrorMsg: constant.ErrGetBlackList.ErrMsg}, nil - } - for _, blackUser := range blackListInfo { - var blackUserInfo pbFriend.UserInfo - //Find black user information - us, err := im_mysql_model.FindUserByUID(blackUser.BlockId) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s search black list userInfo failed", err.Error()) - continue - } - friendShip, err := im_mysql_model.FindFriendRelationshipFromFriend(claims.UID, blackUser.BlockId) - if err == nil { - comment = friendShip.Comment - } - blackUserInfo.Uid = us.UID - blackUserInfo.Icon = us.Icon - blackUserInfo.Name = us.Name - blackUserInfo.Gender = us.Gender - blackUserInfo.Mobile = us.Mobile - blackUserInfo.Birth = us.Birth - blackUserInfo.Email = us.Email - blackUserInfo.Ex = us.Ex - blackUserInfo.Comment = comment - - userInfoList = append(userInfoList, &blackUserInfo) - } - log.Info(req.Token, req.OperationID, "rpc get blacklist success return") - return &pbFriend.GetBlacklistResp{Data: userInfoList}, nil -} diff --git a/internal/rpc/friend/get_firends_info.go b/internal/rpc/friend/get_firends_info.go deleted file mode 100644 index d103889bc..000000000 --- a/internal/rpc/friend/get_firends_info.go +++ /dev/null @@ -1,113 +0,0 @@ -package friend - -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" - "Open_IM/pkg/grpc-etcdv3/getcdv3" - pbFriend "Open_IM/pkg/proto/friend" - "Open_IM/pkg/utils" - "context" - "fmt" - "google.golang.org/grpc" - "net" - "strconv" - "strings" -) - -type friendServer struct { - rpcPort int - rpcRegisterName string - etcdSchema string - etcdAddr []string -} - -func NewFriendServer(port int) *friendServer { - log.NewPrivateLog("friend") - return &friendServer{ - rpcPort: port, - rpcRegisterName: config.Config.RpcRegisterName.OpenImFriendName, - etcdSchema: config.Config.Etcd.EtcdSchema, - etcdAddr: config.Config.Etcd.EtcdAddr, - } -} - -func (s *friendServer) Run() { - log.Info("", "", fmt.Sprintf("rpc friend init....")) - - ip := utils.ServerIP - registerAddress := ip + ":" + strconv.Itoa(s.rpcPort) - //listener network - listener, err := net.Listen("tcp", registerAddress) - if err != nil { - log.InfoByArgs(fmt.Sprintf("Failed to listen rpc friend network,err=%s", err.Error())) - return - } - log.Info("", "", "listen network success, address = %s", registerAddress) - defer listener.Close() - //grpc server - srv := grpc.NewServer() - defer srv.GracefulStop() - //User friend related services register to etcd - pbFriend.RegisterFriendServer(srv, s) - err = getcdv3.RegisterEtcd(s.etcdSchema, strings.Join(s.etcdAddr, ","), ip, s.rpcPort, s.rpcRegisterName, 10) - if err != nil { - log.ErrorByArgs("register rpc fiend service to etcd failed,err=%s", err.Error()) - return - } - err = srv.Serve(listener) - if err != nil { - log.ErrorByArgs("listen rpc friend error,err=%s", err.Error()) - return - } -} - -func (s *friendServer) GetFriendsInfo(ctx context.Context, req *pbFriend.GetFriendsInfoReq) (*pbFriend.GetFriendInfoResp, error) { - log.Info(req.Token, req.OperationID, "rpc search user is server,args=%s", req.String()) - var ( - isInBlackList int32 - isFriend int32 - comment string - ) - //Parse token, to find current user information - claims, err := token_verify.ParseToken(req.Token) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbFriend.GetFriendInfoResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil - } - friendShip, err := im_mysql_model.FindFriendRelationshipFromFriend(claims.UID, req.Uid) - if err == nil { - isFriend = constant.FriendFlag - comment = friendShip.Comment - } - friendUserInfo, err := im_mysql_model.FindUserByUID(req.Uid) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,no this user", err.Error()) - return &pbFriend.GetFriendInfoResp{ErrorCode: constant.ErrSearchUserInfo.ErrCode, ErrorMsg: constant.ErrSearchUserInfo.ErrMsg}, nil - } - err = im_mysql_model.FindRelationshipFromBlackList(claims.UID, req.Uid) - if err == nil { - isInBlackList = constant.BlackListFlag - } - log.Info(req.Token, req.OperationID, "rpc search friend success return") - return &pbFriend.GetFriendInfoResp{ - ErrorCode: 0, - ErrorMsg: "", - Data: &pbFriend.GetFriendData{ - Uid: friendUserInfo.UID, - Icon: friendUserInfo.Icon, - Name: friendUserInfo.Name, - Gender: friendUserInfo.Gender, - Mobile: friendUserInfo.Mobile, - Birth: friendUserInfo.Birth, - Email: friendUserInfo.Email, - Ex: friendUserInfo.Ex, - Comment: comment, - IsFriend: isFriend, - IsInBlackList: isInBlackList, - }, - }, nil - -} diff --git a/internal/rpc/friend/get_friend_apply_list.go b/internal/rpc/friend/get_friend_apply_list.go deleted file mode 100644 index 6542d9097..000000000 --- a/internal/rpc/friend/get_friend_apply_list.go +++ /dev/null @@ -1,95 +0,0 @@ -package friend - -import ( - "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" - pbFriend "Open_IM/pkg/proto/friend" - "context" - "fmt" - "strconv" -) - -func (s *friendServer) GetFriendApplyList(ctx context.Context, req *pbFriend.GetFriendApplyReq) (*pbFriend.GetFriendApplyResp, error) { - log.Info(req.Token, req.OperationID, "rpc get friend apply list is server,args=%s", req.String()) - var appleUserList []*pbFriend.ApplyUserInfo - //Parse token, to find current user information - claims, err := token_verify.ParseToken(req.Token) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbFriend.GetFriendApplyResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil - } - // Find the current user friend applications received - ApplyUsersInfo, err := im_mysql_model.FindFriendsApplyFromFriendReq(claims.UID) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,search applyInfo failed", err.Error()) - return &pbFriend.GetFriendApplyResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: constant.ErrMysql.ErrMsg}, nil - } - for _, applyUserInfo := range ApplyUsersInfo { - var userInfo pbFriend.ApplyUserInfo - //Find friend application status - userInfo.Flag = applyUserInfo.Flag - userInfo.ReqMessage = applyUserInfo.ReqMessage - userInfo.ApplyTime = strconv.FormatInt(applyUserInfo.CreateTime.Unix(), 10) - //Find user information - us, err := im_mysql_model.FindUserByUID(applyUserInfo.ReqId) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,search userInfo failed", err.Error()) - continue - } - userInfo.Uid = us.UID - userInfo.Icon = us.Icon - userInfo.Name = us.Name - userInfo.Gender = us.Gender - userInfo.Mobile = us.Mobile - userInfo.Birth = us.Birth - userInfo.Email = us.Email - userInfo.Ex = us.Ex - appleUserList = append(appleUserList, &userInfo) - - } - log.Info(req.Token, req.OperationID, fmt.Sprintf("rpc get friendapplylist success return")) - return &pbFriend.GetFriendApplyResp{Data: appleUserList}, nil -} - -func (s *friendServer) GetSelfApplyList(ctx context.Context, req *pbFriend.GetFriendApplyReq) (*pbFriend.GetFriendApplyResp, error) { - log.Info(req.Token, req.OperationID, "rpc get self apply list is server,args=%s", req.String()) - var selfApplyOtherUserList []*pbFriend.ApplyUserInfo - //Parse token, to find current user information - claims, err := token_verify.ParseToken(req.Token) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbFriend.GetFriendApplyResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil - } - // Find the self add other userinfo - usersInfo, err := im_mysql_model.FindSelfApplyFromFriendReq(claims.UID) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,search self to other user Info failed", err.Error()) - return &pbFriend.GetFriendApplyResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: constant.ErrMysql.ErrMsg}, nil - } - for _, selfApplyOtherUserInfo := range usersInfo { - var userInfo pbFriend.ApplyUserInfo - //Find friend application status - userInfo.Flag = selfApplyOtherUserInfo.Flag - userInfo.ReqMessage = selfApplyOtherUserInfo.ReqMessage - userInfo.ApplyTime = strconv.FormatInt(selfApplyOtherUserInfo.CreateTime.Unix(), 10) - //Find user information - us, err := im_mysql_model.FindUserByUID(selfApplyOtherUserInfo.Uid) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,search userInfo failed", err.Error()) - continue - } - userInfo.Uid = us.UID - userInfo.Icon = us.Icon - userInfo.Name = us.Name - userInfo.Gender = us.Gender - userInfo.Mobile = us.Mobile - userInfo.Birth = us.Birth - userInfo.Email = us.Email - userInfo.Ex = us.Ex - selfApplyOtherUserList = append(selfApplyOtherUserList, &userInfo) - } - log.Info(req.Token, req.OperationID, fmt.Sprintf("rpc get self apply list success return")) - return &pbFriend.GetFriendApplyResp{Data: selfApplyOtherUserList}, nil -} diff --git a/internal/rpc/friend/get_friend_list.go b/internal/rpc/friend/get_friend_list.go deleted file mode 100644 index ff3e521ee..000000000 --- a/internal/rpc/friend/get_friend_list.go +++ /dev/null @@ -1,57 +0,0 @@ -package friend - -import ( - "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" - pbFriend "Open_IM/pkg/proto/friend" - "context" -) - -func (s *friendServer) GetFriendList(ctx context.Context, req *pbFriend.GetFriendListReq) (*pbFriend.GetFriendListResp, error) { - log.Info(req.Token, req.OperationID, "rpc get friend list is server,args=%s", req.String()) - var userInfoList []*pbFriend.UserInfo - //Parse token, to find current user information - claims, err := token_verify.ParseToken(req.Token) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbFriend.GetFriendListResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil - } - friends, err := im_mysql_model.FindUserInfoFromFriend(claims.UID) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s search friendInfo failed", err.Error()) - return &pbFriend.GetFriendListResp{ErrorCode: constant.ErrSearchUserInfo.ErrCode, ErrorMsg: constant.ErrSearchUserInfo.ErrMsg}, nil - } - for _, friendUser := range friends { - var friendUserInfo pbFriend.UserInfo - - //find user is in blackList - err = im_mysql_model.FindRelationshipFromBlackList(claims.UID, friendUser.FriendId) - if err == nil { - friendUserInfo.IsInBlackList = constant.BlackListFlag - } else { - friendUserInfo.IsInBlackList = 0 - } - //Find user information - us, err := im_mysql_model.FindUserByUID(friendUser.FriendId) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s search userInfo failed", err.Error()) - continue - } - friendUserInfo.Uid = friendUser.FriendId - friendUserInfo.Comment = friendUser.Comment - friendUserInfo.Icon = us.Icon - friendUserInfo.Name = us.Name - friendUserInfo.Gender = us.Gender - friendUserInfo.Mobile = us.Mobile - friendUserInfo.Birth = us.Birth - friendUserInfo.Email = us.Email - friendUserInfo.Ex = us.Ex - - userInfoList = append(userInfoList, &friendUserInfo) - - } - log.Info(req.Token, req.OperationID, "rpc get friend list success return") - return &pbFriend.GetFriendListResp{Data: userInfoList}, nil -} diff --git a/internal/rpc/friend/is_friend.go b/internal/rpc/friend/is_friend.go deleted file mode 100644 index d8739b81f..000000000 --- a/internal/rpc/friend/is_friend.go +++ /dev/null @@ -1,29 +0,0 @@ -package friend - -import ( - "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" - pbFriend "Open_IM/pkg/proto/friend" - "context" - "fmt" -) - -func (s *friendServer) IsFriend(ctx context.Context, req *pbFriend.IsFriendReq) (*pbFriend.IsFriendResp, error) { - log.InfoByArgs("rpc is friend is server,args=%s", req.String()) - var isFriend int32 - claims, err := token_verify.ParseToken(req.Token) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbFriend.IsFriendResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil - } - _, err = im_mysql_model.FindFriendRelationshipFromFriend(claims.UID, req.ReceiveUid) - if err == nil { - isFriend = constant.FriendFlag - } else { - isFriend = constant.ApplicationFriendFlag - } - log.InfoByArgs(fmt.Sprintf("rpc is friend success return")) - return &pbFriend.IsFriendResp{ShipType: isFriend}, nil -} diff --git a/internal/rpc/friend/is_in_blacklist.go b/internal/rpc/friend/is_in_blacklist.go deleted file mode 100644 index 6275f5300..000000000 --- a/internal/rpc/friend/is_in_blacklist.go +++ /dev/null @@ -1,20 +0,0 @@ -package friend - -import ( - "Open_IM/pkg/common/db/mysql_model/im_mysql_model" - "Open_IM/pkg/common/log" - pbFriend "Open_IM/pkg/proto/friend" - "context" - "fmt" -) - -func (s *friendServer) IsInBlackList(ctx context.Context, req *pbFriend.IsInBlackListReq) (*pbFriend.IsInBlackListResp, error) { - log.InfoByArgs("rpc is in blacklist is server,args=%s", req.String()) - var isInBlacklist = false - err := im_mysql_model.FindRelationshipFromBlackList(req.ReceiveUid, req.SendUid) - if err == nil { - isInBlacklist = true - } - log.InfoByArgs(fmt.Sprintf("rpc is in blackList success return")) - return &pbFriend.IsInBlackListResp{Response: isInBlacklist}, nil -} diff --git a/internal/rpc/friend/remove_blacklist.go b/internal/rpc/friend/remove_blacklist.go deleted file mode 100644 index f96cbf9b4..000000000 --- a/internal/rpc/friend/remove_blacklist.go +++ /dev/null @@ -1,27 +0,0 @@ -package friend - -import ( - "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" - pbFriend "Open_IM/pkg/proto/friend" - "context" -) - -func (s *friendServer) RemoveBlacklist(ctx context.Context, req *pbFriend.RemoveBlacklistReq) (*pbFriend.CommonResp, error) { - log.Info(req.Token, req.OperationID, "rpc remove blacklist is server,userid=%s", req.Uid) - //Parse token, to find current user information - claims, err := token_verify.ParseToken(req.Token) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbFriend.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil - } - err = im_mysql_model.RemoveBlackList(claims.UID, req.Uid) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,remove blacklist failed", err.Error()) - return &pbFriend.CommonResp{ErrorCode: constant.ErrMysql.ErrCode, ErrorMsg: constant.ErrMysql.ErrMsg}, nil - } - log.Info(req.Token, req.OperationID, "rpc remove blacklist success return,userid=%s", req.Uid) - return &pbFriend.CommonResp{}, nil -} diff --git a/internal/rpc/friend/set_friend_comment.go b/internal/rpc/friend/set_friend_comment.go deleted file mode 100644 index 8ddfe1fb9..000000000 --- a/internal/rpc/friend/set_friend_comment.go +++ /dev/null @@ -1,27 +0,0 @@ -package friend - -import ( - "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" - pbFriend "Open_IM/pkg/proto/friend" - "context" -) - -func (s *friendServer) SetFriendComment(ctx context.Context, req *pbFriend.SetFriendCommentReq) (*pbFriend.CommonResp, error) { - log.Info(req.Token, req.OperationID, "rpc set friend comment is server,params=%s", req.String()) - //Parse token, to find current user information - claims, err := token_verify.ParseToken(req.Token) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbFriend.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil - } - err = im_mysql_model.UpdateFriendComment(claims.UID, req.Uid, req.Comment) - if err != nil { - log.Error(req.Token, req.OperationID, "set friend comment failed,err=%s", err.Error()) - return &pbFriend.CommonResp{ErrorCode: constant.ErrSetFriendComment.ErrCode, ErrorMsg: constant.ErrSetFriendComment.ErrMsg}, nil - } - log.Info(req.Token, req.OperationID, "rpc set friend comment is success return") - return &pbFriend.CommonResp{}, nil -} diff --git a/internal/rpc/group/create_group.go b/internal/rpc/group/create_group.go deleted file mode 100644 index 826a08615..000000000 --- a/internal/rpc/group/create_group.go +++ /dev/null @@ -1,152 +0,0 @@ -package group - -import ( - "Open_IM/internal/rpc/chat" - "Open_IM/pkg/common/config" - "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/db" - "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" - pbGroup "Open_IM/pkg/proto/group" - "Open_IM/pkg/utils" - "context" - "google.golang.org/grpc" - "net" - "strconv" - "strings" - "time" -) - -type groupServer struct { - rpcPort int - rpcRegisterName string - etcdSchema string - etcdAddr []string -} - -func NewGroupServer(port int) *groupServer { - log.NewPrivateLog("group") - return &groupServer{ - rpcPort: port, - rpcRegisterName: config.Config.RpcRegisterName.OpenImGroupName, - etcdSchema: config.Config.Etcd.EtcdSchema, - etcdAddr: config.Config.Etcd.EtcdAddr, - } -} -func (s *groupServer) Run() { - log.Info("", "", "rpc group 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 - pbGroup.RegisterGroupServer(srv, s) - err = getcdv3.RegisterEtcd(s.etcdSchema, strings.Join(s.etcdAddr, ","), ip, s.rpcPort, s.rpcRegisterName, 10) - if err != nil { - log.ErrorByArgs("get etcd failed,err=%s", err.Error()) - return - } - err = srv.Serve(listener) - if err != nil { - log.ErrorByArgs("listen rpc_group error,err=%s", err.Error()) - return - } - log.Info("", "", "rpc create group init success") -} - -func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupReq) (*pbGroup.CreateGroupResp, error) { - log.NewInfo(req.OperationID, "rpc create group is server,args=%s", req.String()) - var ( - groupId string - ) - //Parse token, to find current user information - claims, err := token_verify.ParseToken(req.Token) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbGroup.CreateGroupResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil - } - //Time stamp + MD5 to generate group chat id - groupId = utils.Md5(strconv.FormatInt(time.Now().UnixNano(), 10)) - err = im_mysql_model.InsertIntoGroup(groupId, req.GroupName, req.Introduction, req.Notification, req.FaceUrl, req.Ex) - if err != nil { - log.ErrorByKv("create group chat failed", req.OperationID, "err=%s", err.Error()) - return &pbGroup.CreateGroupResp{ErrorCode: constant.ErrCreateGroup.ErrCode, ErrorMsg: constant.ErrCreateGroup.ErrMsg}, nil - } - - isMagagerFlag := 0 - tokenUid := claims.UID - - if utils.IsContain(tokenUid, config.Config.Manager.AppManagerUid) { - isMagagerFlag = 1 - } - - if isMagagerFlag == 0 { - //Add the group owner to the group first, otherwise the group creation will fail - us, err := im_mysql_model.FindUserByUID(claims.UID) - if err != nil { - log.Error("", req.OperationID, "find userInfo failed", err.Error()) - return &pbGroup.CreateGroupResp{ErrorCode: constant.ErrCreateGroup.ErrCode, ErrorMsg: constant.ErrCreateGroup.ErrMsg}, nil - } - err = im_mysql_model.InsertIntoGroupMember(groupId, claims.UID, us.Name, us.Icon, constant.GroupOwner) - if err != nil { - log.Error("", req.OperationID, "create group chat failed,err=%s", err.Error()) - return &pbGroup.CreateGroupResp{ErrorCode: constant.ErrCreateGroup.ErrCode, ErrorMsg: constant.ErrCreateGroup.ErrMsg}, nil - } - - err = db.DB.AddGroupMember(groupId, claims.UID) - if err != nil { - log.Error("", "", "create mongo group member failed, db.DB.AddGroupMember fail [err: %s]", err.Error()) - return &pbGroup.CreateGroupResp{ErrorCode: constant.ErrCreateGroup.ErrCode, ErrorMsg: constant.ErrCreateGroup.ErrMsg}, nil - } - } - - //Binding group id and member id - for _, user := range req.MemberList { - us, err := im_mysql_model.FindUserByUID(user.Uid) - if err != nil { - log.Error("", req.OperationID, "find userInfo failed,uid=%s", user.Uid, err.Error()) - continue - } - err = im_mysql_model.InsertIntoGroupMember(groupId, user.Uid, us.Name, us.Icon, user.SetRole) - if err != nil { - log.ErrorByArgs("pull %s to group %s failed,err=%s", user.Uid, groupId, err.Error()) - } - err = db.DB.AddGroupMember(groupId, user.Uid) - if err != nil { - log.Error("", "", "add mongo group member failed, db.DB.AddGroupMember fail [err: %s]", err.Error()) - } - } - - groupInfo, err := im_mysql_model.FindGroupInfoByGroupId(groupId) - if err != nil { - log.NewError(req.OperationID, "FindGroupInfoByGroupId failed ", groupId) - return &pbGroup.CreateGroupResp{ErrorCode: constant.ErrCreateGroup.ErrCode, ErrorMsg: constant.ErrCreateGroup.ErrMsg}, nil - } - - creatorInfo, err := im_mysql_model.FindUserByUID(claims.UID) - if err != nil { - log.NewError(req.OperationID, "FindUserByUID failed ", claims.UID) - return &pbGroup.CreateGroupResp{ErrorCode: constant.ErrCreateGroup.ErrCode, ErrorMsg: constant.ErrCreateGroup.ErrMsg}, nil - } - - memberList, err := im_mysql_model.FindGroupMemberListByGroupId(groupId) - if err != nil { - log.NewError(req.OperationID, "FindGroupMemberListByGroupId failed ", groupId) - } - - log.NewInfo(req.OperationID, "creator, group, member list: ", *creatorInfo, *groupInfo, memberList) - chat.CreateGroupNotification(claims.UID, *creatorInfo, *groupInfo, memberList) - return &pbGroup.CreateGroupResp{GroupID: groupId}, nil -} diff --git a/internal/rpc/group/get_group_applicationList.go b/internal/rpc/group/get_group_applicationList.go deleted file mode 100644 index a08b32f8e..000000000 --- a/internal/rpc/group/get_group_applicationList.go +++ /dev/null @@ -1,21 +0,0 @@ -package group - -import ( - "Open_IM/pkg/common/db/mysql_model/im_mysql_model" - "Open_IM/pkg/common/log" - "Open_IM/pkg/proto/group" - "context" -) - -func (s *groupServer) GetGroupApplicationList(_ context.Context, pb *group.GetGroupApplicationListReq) (*group.GetGroupApplicationListResp, error) { - log.Info("", "", "rpc GetGroupApplicationList call start..., [pb: %s]", pb.String()) - - reply, err := im_mysql_model.GetGroupApplicationList(pb.UID) - if err != nil { - log.Error("", "", "rpc GetGroupApplicationList call..., im_mysql_model.GetGroupApplicationList fail [uid: %s] [err: %s]", pb.UID, err.Error()) - return &group.GetGroupApplicationListResp{ErrCode: 701, ErrMsg: "GetGroupApplicationList failed"}, nil - } - log.Info("", "", "rpc GetGroupApplicationList call..., im_mysql_model.GetGroupApplicationList") - - return reply, nil -} diff --git a/internal/rpc/group/get_groups_info.go b/internal/rpc/group/get_groups_info.go deleted file mode 100644 index f0d952e94..000000000 --- a/internal/rpc/group/get_groups_info.go +++ /dev/null @@ -1,42 +0,0 @@ -package group - -import ( - "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" - pbGroup "Open_IM/pkg/proto/group" - "context" -) - -func (s *groupServer) GetGroupsInfo(ctx context.Context, req *pbGroup.GetGroupsInfoReq) (*pbGroup.GetGroupsInfoResp, error) { - log.Info(req.Token, req.OperationID, "rpc get group info is server,args=%s", req.String()) - //Parse token, to find current user information - claims, err := token_verify.ParseToken(req.Token) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbGroup.GetGroupsInfoResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil - } - log.Info("", req.OperationID, "args:", req.GroupIDList, claims.UID) - groupsInfoList := make([]*pbGroup.GroupInfo, 0) - for _, groupID := range req.GroupIDList { - groupInfoFromMysql, err := im_mysql_model.FindGroupInfoByGroupId(groupID) - if err != nil { - log.Error(req.Token, req.OperationID, "find group info failed,err=%s", err.Error()) - continue - } - var groupInfo pbGroup.GroupInfo - groupInfo.GroupId = groupID - groupInfo.GroupName = groupInfoFromMysql.Name - groupInfo.Introduction = groupInfoFromMysql.Introduction - groupInfo.Notification = groupInfoFromMysql.Notification - groupInfo.FaceUrl = groupInfoFromMysql.FaceUrl - groupInfo.OwnerId = im_mysql_model.GetGroupOwnerByGroupId(groupID) - groupInfo.MemberCount = uint32(im_mysql_model.GetGroupMemberNumByGroupId(groupID)) - groupInfo.CreateTime = uint64(groupInfoFromMysql.CreateTime.Unix()) - - groupsInfoList = append(groupsInfoList, &groupInfo) - } - log.Info(req.Token, req.OperationID, "rpc get groupsInfo success return") - return &pbGroup.GetGroupsInfoResp{Data: groupsInfoList}, nil -} diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index 15740800f..9df6064f6 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -1,226 +1,293 @@ package group import ( - "Open_IM/internal/push/content_struct" - "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" - "Open_IM/pkg/common/token_verify" - pbChat "Open_IM/pkg/proto/chat" - "encoding/json" - imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model" "Open_IM/pkg/common/log" + "Open_IM/pkg/common/token_verify" + cp "Open_IM/pkg/common/utils" + "Open_IM/pkg/grpc-etcdv3/getcdv3" pbGroup "Open_IM/pkg/proto/group" + open_im_sdk "Open_IM/pkg/proto/sdk_ws" "Open_IM/pkg/utils" "context" - - "fmt" + "google.golang.org/grpc" + "net" + "strconv" + "strings" + "time" ) -func (s *groupServer) GetJoinedGroupList(ctx context.Context, req *pbGroup.GetJoinedGroupListReq) (*pbGroup.GetJoinedGroupListResp, error) { - claims, err := token_verify.ParseToken(req.Token) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbGroup.GetJoinedGroupListResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil - } - log.Info(claims.UID, req.OperationID, "recv req: ", req.String()) +type groupServer struct { + rpcPort int + rpcRegisterName string + etcdSchema string + etcdAddr []string +} - joinedGroupList, err := imdb.GetJoinedGroupIdListByMemberId(claims.UID) +func NewGroupServer(port int) *groupServer { + log.NewPrivateLog("group") + return &groupServer{ + rpcPort: port, + rpcRegisterName: config.Config.RpcRegisterName.OpenImGroupName, + etcdSchema: config.Config.Etcd.EtcdSchema, + etcdAddr: config.Config.Etcd.EtcdAddr, + } +} + +func (s *groupServer) Run() { + log.NewInfo("0", "group rpc start ") + ip := utils.ServerIP + registerAddress := ip + ":" + strconv.Itoa(s.rpcPort) + //listener network + listener, err := net.Listen("tcp", registerAddress) if err != nil { - log.Error(claims.UID, req.OperationID, "GetJoinedGroupIdListByMemberId failed, err: ", err.Error()) - return &pbGroup.GetJoinedGroupListResp{ErrorCode: constant.ErrParam.ErrCode, ErrorMsg: constant.ErrParam.ErrMsg}, nil + log.NewError("0", "Listen failed ", err.Error(), registerAddress) + return + } + log.NewInfo("0", "listen network success, ", registerAddress, listener) + defer listener.Close() + //grpc server + srv := grpc.NewServer() + defer srv.GracefulStop() + //Service registers with etcd + pbGroup.RegisterGroupServer(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()) + return + } + err = srv.Serve(listener) + if err != nil { + log.NewError("0", "Serve failed ", err.Error()) + return + } + log.NewInfo("0", "group rpc success") +} + +func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupReq) (*pbGroup.CreateGroupResp, error) { + log.NewInfo(req.OperationID, "CreateGroup, args ", req.String()) + if !token_verify.CheckAccess(req.OpUserID, req.OwnerUserID) { + log.NewError(req.OperationID, "CheckAccess false ", req.OpUserID, req.OwnerUserID) + return &pbGroup.CreateGroupResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil + } + + //Time stamp + MD5 to generate group chat id + groupId := utils.Md5(strconv.FormatInt(time.Now().UnixNano(), 10)) + //to group + groupInfo := db.Group{} + utils.CopyStructFields(&groupInfo, req.GroupInfo) + groupInfo.CreatorUserID = req.OpUserID + groupInfo.GroupID = groupId + err := imdb.InsertIntoGroup(groupInfo) + if err != nil { + log.NewError(req.OperationID, "InsertIntoGroup failed, ", err.Error(), groupInfo) + return &pbGroup.CreateGroupResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, nil + } + + us, err := imdb.GetUserByUserID(req.OwnerUserID) + if err != nil { + log.NewError(req.OperationID, "GetUserByUserID failed ", err.Error(), req.OwnerUserID) + return &pbGroup.CreateGroupResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, nil + } + + //to group member + groupMember := db.GroupMember{GroupID: groupId, RoleLevel: constant.GroupOwner, OperatorUserID: req.OpUserID} + utils.CopyStructFields(&groupMember, us) + err = imdb.InsertIntoGroupMember(groupMember) + if err != nil { + log.NewError(req.OperationID, "InsertIntoGroupMember failed ", err.Error(), groupMember) + return &pbGroup.CreateGroupResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, nil + } + + err = db.DB.AddGroupMember(groupId, req.OwnerUserID) + if err != nil { + log.NewError(req.OperationID, "AddGroupMember failed ", err.Error(), groupId, req.OwnerUserID) + } + var okUserIDList []string + //to group member + for _, user := range req.InitMemberList { + us, err := imdb.GetUserByUserID(user.UserID) + if err != nil { + log.NewError(req.OperationID, "GetUserByUserID failed ", err.Error(), user.UserID) + continue + } + if user.RoleLevel == constant.GroupOwner { + log.NewError(req.OperationID, "only one owner, failed ", user) + continue + } + groupMember.RoleLevel = user.RoleLevel + utils.CopyStructFields(&groupMember, us) + err = imdb.InsertIntoGroupMember(groupMember) + if err != nil { + log.NewError(req.OperationID, "InsertIntoGroupMember failed ", err.Error(), groupMember) + continue + } + + okUserIDList = append(okUserIDList, user.UserID) + err = db.DB.AddGroupMember(groupId, user.UserID) + if err != nil { + log.NewError(req.OperationID, "add mongo group member failed, db.DB.AddGroupMember failed ", err.Error()) + } + } + + resp := &pbGroup.CreateGroupResp{GroupInfo: &open_im_sdk.GroupInfo{}} + group, err := imdb.GetGroupInfoByGroupID(groupId) + if err != nil { + log.NewError(req.OperationID, "GetGroupInfoByGroupID failed ", err.Error(), groupId) + resp.ErrCode = constant.ErrDB.ErrCode + resp.ErrMsg = constant.ErrDB.ErrMsg + return resp, nil + } + utils.CopyStructFields(resp.GroupInfo, group) + resp.GroupInfo.MemberCount, err = imdb.GetGroupMemberNumByGroupID(groupId) + if err != nil { + log.NewError(req.OperationID, "GetGroupMemberNumByGroupID failed ", err.Error(), groupId) + resp.ErrCode = constant.ErrDB.ErrCode + resp.ErrMsg = constant.ErrDB.ErrMsg + return resp, nil + } + resp.GroupInfo.OwnerUserID = req.OwnerUserID + + log.NewInfo(req.OperationID, "rpc CreateGroup return ", resp.String()) + chat.GroupCreatedNotification(req.OperationID, req.OpUserID, groupId, okUserIDList) + return resp, nil +} + +func (s *groupServer) GetJoinedGroupList(ctx context.Context, req *pbGroup.GetJoinedGroupListReq) (*pbGroup.GetJoinedGroupListResp, error) { + log.NewInfo(req.OperationID, "GetJoinedGroupList, args ", req.String()) + if !token_verify.CheckAccess(req.OpUserID, req.FromUserID) { + log.NewError(req.OperationID, "CheckAccess false ", req.OpUserID, req.FromUserID) + return &pbGroup.GetJoinedGroupListResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil + } + //group list + joinedGroupList, err := imdb.GetJoinedGroupIDListByUserID(req.FromUserID) + if err != nil { + log.NewError(req.OperationID, "GetJoinedGroupIDListByUserID failed ", err.Error(), req.FromUserID) + return &pbGroup.GetJoinedGroupListResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, nil } var resp pbGroup.GetJoinedGroupListResp - for _, v := range joinedGroupList { - var groupNode pbGroup.GroupInfo - num := imdb.GetGroupMemberNumByGroupId(v.GroupId) - owner := imdb.GetGroupOwnerByGroupId(v.GroupId) - group, err := imdb.FindGroupInfoByGroupId(v.GroupId) - if num > 0 && owner != "" && err == nil { - groupNode.GroupId = v.GroupId - groupNode.FaceUrl = group.FaceUrl - groupNode.CreateTime = uint64(group.CreateTime.Unix()) - groupNode.GroupName = group.Name - groupNode.Introduction = group.Introduction - groupNode.Notification = group.Notification - groupNode.OwnerId = owner - groupNode.MemberCount = uint32(int32(num)) + var groupNode open_im_sdk.GroupInfo + num, err := imdb.GetGroupMemberNumByGroupID(v) + owner, err2 := imdb.GetGroupOwnerInfoByGroupID(v) + group, err := imdb.GetGroupInfoByGroupID(v) + if num > 0 && owner != nil && err2 == nil && group != nil && err == nil { + utils.CopyStructFields(&groupNode, group) + groupNode.CreateTime = uint32(group.CreateTime.Unix()) + groupNode.MemberCount = uint32(num) + groupNode.OwnerUserID = owner.UserID resp.GroupList = append(resp.GroupList, &groupNode) + } else { + log.NewError(req.OperationID, "check nil ", num, owner, err, group) + continue } - log.Info(claims.UID, req.OperationID, "member num: ", num, "owner: ", owner) + log.NewDebug(req.OperationID, "joinedGroup ", groupNode) } - resp.ErrorCode = 0 + log.NewInfo(req.OperationID, "GetJoinedGroupList rpc return ", resp.String()) return &resp, nil } func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.InviteUserToGroupReq) (*pbGroup.InviteUserToGroupResp, error) { - claims, err := token_verify.ParseToken(req.Token) + log.NewInfo(req.OperationID, "InviteUserToGroup args ", req.String()) + + if !imdb.IsExistGroupMember(req.GroupID, req.OpUserID) && !token_verify.IsMangerUserID(req.OpUserID) { + log.NewError(req.OperationID, "no permission InviteUserToGroup ", req.GroupID, req.OpUserID) + return &pbGroup.InviteUserToGroupResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil + } + + _, err := imdb.GetGroupInfoByGroupID(req.GroupID) if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbGroup.InviteUserToGroupResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil + log.NewError(req.OperationID, "GetGroupInfoByGroupID failed ", req.GroupID, err) + return &pbGroup.InviteUserToGroupResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil } - log.Info(claims.UID, req.OperationID, "recv req: ", req.String()) - // if !imdb.IsExistGroupMember(req.GroupID, claims.UID) && claims.UID != config.Config.AppManagerUid - - if !imdb.IsExistGroupMember(req.GroupID, claims.UID) && !utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) { - log.Error(req.Token, req.OperationID, "err= invite user not in group") - return &pbGroup.InviteUserToGroupResp{ErrorCode: constant.ErrAccess.ErrCode, ErrorMsg: constant.ErrAccess.ErrMsg}, nil - } - - groupInfoFromMysql, err := imdb.FindGroupInfoByGroupId(req.GroupID) - if err != nil || groupInfoFromMysql == nil { - log.NewError(req.OperationID, "get group info error", req.GroupID, req.UidList) - return &pbGroup.InviteUserToGroupResp{ErrorCode: constant.ErrAccess.ErrCode, ErrorMsg: constant.ErrAccess.ErrMsg}, nil - } - // //from User: invite: applicant //to user: invite: invited - //to application var resp pbGroup.InviteUserToGroupResp - /* - fromUserInfo, err := imdb.FindUserByUID(claims.UID) - if err != nil { - log.Error(claims.UID, req.OperationID, "FindUserByUID failed, err: ", err.Error()) - return &pbGroup.InviteUserToGroupResp{ErrorCode: config.ErrParam.ErrCode, ErrorMsg: config.ErrParam.ErrMsg}, nil - }*/ - var nicknameList string - for _, v := range req.UidList { + var okUserIDList []string + for _, v := range req.InvitedUserIDList { var resultNode pbGroup.Id2Result - resultNode.UId = v + resultNode.UserID = v resultNode.Result = 0 - toUserInfo, err := imdb.FindUserByUID(v) + toUserInfo, err := imdb.GetUserByUserID(v) if err != nil { - log.Error(v, req.OperationID, "FindUserByUID failed, err: ", err.Error()) + log.NewError(req.OperationID, "GetUserByUserID failed ", err.Error(), v) resultNode.Result = -1 - resp.Id2Result = append(resp.Id2Result, &resultNode) + resp.Id2ResultList = append(resp.Id2ResultList, &resultNode) continue } if imdb.IsExistGroupMember(req.GroupID, v) { - log.Error(v, req.OperationID, "user has already in group") + log.NewError(req.OperationID, "IsExistGroupMember ", req.GroupID, v) resultNode.Result = -1 - resp.Id2Result = append(resp.Id2Result, &resultNode) + resp.Id2ResultList = append(resp.Id2ResultList, &resultNode) continue } - - err = imdb.InsertGroupMember(req.GroupID, toUserInfo.UID, toUserInfo.Name, toUserInfo.Icon, 0) + var toInsertInfo db.GroupMember + utils.CopyStructFields(&toInsertInfo, toUserInfo) + toInsertInfo.GroupID = req.GroupID + toInsertInfo.RoleLevel = constant.GroupOrdinaryUsers + toInsertInfo.OperatorUserID = req.OpUserID + err = imdb.InsertIntoGroupMember(toInsertInfo) if err != nil { - log.Error(v, req.OperationID, "InsertGroupMember failed, ", err.Error(), "params: ", - req.GroupID, toUserInfo.UID, toUserInfo.Name, toUserInfo.Icon) + log.NewError(req.OperationID, "InsertIntoGroupMember failed ", req.GroupID, toUserInfo.UserID, toUserInfo.Nickname, toUserInfo.FaceURL) resultNode.Result = -1 - resp.Id2Result = append(resp.Id2Result, &resultNode) + resp.Id2ResultList = append(resp.Id2ResultList, &resultNode) continue } - err = db.DB.AddGroupMember(req.GroupID, toUserInfo.UID) + okUserIDList = append(okUserIDList, v) + err = db.DB.AddGroupMember(req.GroupID, toUserInfo.UserID) if err != nil { - log.Error("", "", "add mongo group member failed, db.DB.AddGroupMember fail [err: %s]", err.Error()) + log.NewError(req.OperationID, "AddGroupMember failed ", err.Error(), req.GroupID, toUserInfo.UserID) } - nicknameList = nicknameList + toUserInfo.Name + " " - resp.Id2Result = append(resp.Id2Result, &resultNode) - } - resp.ErrorCode = 0 - resp.ErrorMsg = "ok" - - //if claims.UID == config.Config.AppManagerUid - if utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) { - m, _ := imdb.FindUserByUID(claims.UID) - var iu inviteUserToGroupReq - iu.GroupID = req.GroupID - iu.OperationID = req.OperationID - iu.Reason = req.Reason - iu.UidList = req.UidList - n := content_struct.NotificationContent{1, nicknameList + " invited into the group chat by " + m.Name, iu.ContentToString()} - logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{ - SendID: claims.UID, - RecvID: req.GroupID, - Content: n.ContentToString(), - SendTime: utils.GetCurrentTimestampByNano(), - MsgFrom: constant.UserMsgType, - ContentType: constant.InviteUserToGroupTip, - SessionType: constant.GroupChatType, - OperationID: req.OperationID, - }) + resp.Id2ResultList = append(resp.Id2ResultList, &resultNode) } + chat.MemberInvitedNotification(req.OperationID, req.GroupID, req.OpUserID, req.Reason, okUserIDList) + resp.ErrCode = 0 + log.NewInfo(req.OperationID, "InviteUserToGroup rpc return ", resp.String()) return &resp, nil } -type inviteUserToGroupReq struct { - GroupID string `json:"groupID"` - UidList []string `json:"uidList"` - Reason string `json:"reason"` - OperationID string `json:"operationID"` -} - -func (c *inviteUserToGroupReq) ContentToString() string { - data, _ := json.Marshal(c) - dataString := string(data) - return dataString -} - func (s *groupServer) GetGroupAllMember(ctx context.Context, req *pbGroup.GetGroupAllMemberReq) (*pbGroup.GetGroupAllMemberResp, error) { - //claims, err := utils.ParseToken(req.Token) - //if err != nil { - // log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - // if req.Token != config.Config.Secret { - // return &pbGroup.GetGroupAllMemberResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil - // } - //} - + log.NewInfo(req.OperationID, "GetGroupAllMember, args ", req.String()) var resp pbGroup.GetGroupAllMemberResp - resp.ErrorCode = 0 - memberList, err := imdb.FindGroupMemberListByGroupId(req.GroupID) + memberList, err := imdb.GetGroupMemberListByGroupID(req.GroupID) if err != nil { - resp.ErrorCode = constant.ErrDb.ErrCode - resp.ErrorMsg = err.Error() - log.NewError(req.OperationID, "FindGroupMemberListByGroupId failed,", err.Error(), req.GroupID) + resp.ErrCode = constant.ErrDB.ErrCode + resp.ErrMsg = constant.ErrDB.ErrMsg + log.NewError(req.OperationID, "GetGroupMemberListByGroupID failed,", err.Error(), req.GroupID) return &resp, nil } for _, v := range memberList { - var node pbGroup.GroupMemberFullInfo - node.Role = v.AdministratorLevel - node.NickName = v.NickName - node.UserId = v.Uid - node.FaceUrl = v.UserGroupFaceUrl - node.JoinTime = uint64(v.JoinTime.Unix()) + var node open_im_sdk.GroupMemberFullInfo + utils.CopyStructFields(&node, &v) resp.MemberList = append(resp.MemberList, &node) } - - resp.ErrorCode = 0 + log.NewInfo(req.OperationID, "GetGroupAllMember rpc return ", resp.String()) return &resp, nil } func (s *groupServer) GetGroupMemberList(ctx context.Context, req *pbGroup.GetGroupMemberListReq) (*pbGroup.GetGroupMemberListResp, error) { - claims, err := token_verify.ParseToken(req.Token) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbGroup.GetGroupMemberListResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil - } - // log.Info(claims.UID, req.OperationID, "recv req: ", req.String()) - fmt.Println("req: ", req.GroupID) + log.NewInfo(req.OperationID, "GetGroupMemberList args ", req.String()) var resp pbGroup.GetGroupMemberListResp - resp.ErrorCode = 0 - memberList, err := imdb.GetGroupMemberByGroupId(req.GroupID, req.Filter, req.NextSeq, 30) + memberList, err := imdb.GetGroupMemberByGroupID(req.GroupID, req.Filter, req.NextSeq, 30) if err != nil { - resp.ErrorCode = constant.ErrDb.ErrCode - resp.ErrorMsg = err.Error() - log.Error(claims.UID, req.OperationID, "GetGroupMemberByGroupId failed, ", err.Error(), "params: ", req.GroupID, req.Filter, req.NextSeq) + resp.ErrCode = constant.ErrDB.ErrCode + resp.ErrMsg = constant.ErrDB.ErrMsg + log.NewError(req.OperationID, "GetGroupMemberByGroupId failed,", req.GroupID, req.Filter, req.NextSeq, 30) return &resp, nil } for _, v := range memberList { - var node pbGroup.GroupMemberFullInfo - node.Role = v.AdministratorLevel - node.NickName = v.NickName - node.UserId = v.Uid - // node.FaceUrl = - node.JoinTime = uint64(v.JoinTime.Unix()) + var node open_im_sdk.GroupMemberFullInfo + utils.CopyStructFields(&node, &v) resp.MemberList = append(resp.MemberList, &node) } //db operate get db sorted by join time @@ -230,168 +297,344 @@ func (s *groupServer) GetGroupMemberList(ctx context.Context, req *pbGroup.GetGr resp.NextSeq = req.NextSeq + int32(len(memberList)) } - resp.ErrorCode = 0 + resp.ErrCode = 0 + log.NewInfo(req.OperationID, "GetGroupMemberList rpc return ", resp.String()) return &resp, nil } -type groupMemberFullInfo struct { - GroupId string `json:"groupID"` - UserId string `json:"userId"` - Role int `json:"role"` - JoinTime uint64 `json:"joinTime"` - NickName string `json:"nickName"` - FaceUrl string `json:"faceUrl"` -} - -type kickGroupMemberApiReq struct { - GroupID string `json:"groupID"` - UidListInfo []groupMemberFullInfo `json:"uidListInfo"` - Reason string `json:"reason"` - OperationID string `json:"operationID"` -} - -func (c *kickGroupMemberApiReq) ContentToString() string { - data, _ := json.Marshal(c) - dataString := string(data) - return dataString -} - func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGroupMemberReq) (*pbGroup.KickGroupMemberResp, error) { - claims, err := token_verify.ParseToken(req.Token) + log.NewInfo(req.OperationID, "KickGroupMember args ", req.String()) + ownerList, err := imdb.GetOwnerManagerByGroupID(req.GroupID) if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbGroup.KickGroupMemberResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil - } - log.Info(claims.UID, req.OperationID, "recv req: ", req.String()) - - ownerList, err := imdb.GetOwnerManagerByGroupId(req.GroupID) - if err != nil { - log.Error(claims.UID, req.OperationID, req.GroupID, "GetOwnerManagerByGroupId, ", err.Error()) - return &pbGroup.KickGroupMemberResp{ErrorCode: constant.ErrParam.ErrCode, ErrorMsg: constant.ErrParam.ErrMsg}, nil + log.NewError(req.OperationID, "GetOwnerManagerByGroupId failed ", err.Error(), req.GroupID) + return &pbGroup.KickGroupMemberResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}, nil } //op is group owner? var flag = 0 for _, v := range ownerList { - if v.Uid == claims.UID { + if v.UserID == req.OpUserID { flag = 1 + log.NewDebug(req.OperationID, "is group owner ", req.OpUserID, req.GroupID) break } } + + //op is app manager if flag != 1 { - // if claims.UID == config.Config.AppManagerUid { - if utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) { + if token_verify.IsMangerUserID(req.OpUserID) { flag = 1 + log.NewDebug(req.OperationID, "is app manager ", req.OpUserID) } } if flag != 1 { - log.Error(claims.UID, req.OperationID, "no access kick") - return &pbGroup.KickGroupMemberResp{ErrorCode: constant.ErrAccess.ErrCode, ErrorMsg: constant.ErrAccess.ErrMsg}, nil + log.NewError(req.OperationID, "failed, no access kick ", req.OpUserID) + return &pbGroup.KickGroupMemberResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, nil } - if len(req.UidListInfo) == 0 { - log.Error(claims.UID, req.OperationID, "kick list 0") - return &pbGroup.KickGroupMemberResp{ErrorCode: constant.ErrParam.ErrCode, ErrorMsg: constant.ErrParam.ErrMsg}, nil + if len(req.KickedUserIDList) == 0 { + log.NewError(req.OperationID, "failed, kick list 0") + return &pbGroup.KickGroupMemberResp{ErrCode: constant.ErrArgs.ErrCode, ErrMsg: constant.ErrArgs.ErrMsg}, nil } + + groupOwnerUserID := "" + for _, v := range ownerList { + if v.RoleLevel == constant.GroupOwner { + groupOwnerUserID = v.UserID + } + } + + var okUserIDList []string //remove var resp pbGroup.KickGroupMemberResp - for _, v := range req.UidListInfo { + for _, v := range req.KickedUserIDList { //owner cant kicked - if v.UserId == claims.UID { - log.Error(claims.UID, req.OperationID, v.UserId, "cant kick owner") - resp.Id2Result = append(resp.Id2Result, &pbGroup.Id2Result{UId: v.UserId, Result: -1}) + if v == groupOwnerUserID { + log.NewError(req.OperationID, "failed, can't kick owner ", v) + resp.Id2ResultList = append(resp.Id2ResultList, &pbGroup.Id2Result{UserID: v, Result: -1}) continue } - err := imdb.RemoveGroupMember(req.GroupID, v.UserId) + err := imdb.RemoveGroupMember(req.GroupID, v) if err != nil { - log.Error(claims.UID, req.OperationID, v.UserId, req.GroupID, "RemoveGroupMember failed ", err.Error()) - resp.Id2Result = append(resp.Id2Result, &pbGroup.Id2Result{UId: v.UserId, Result: -1}) + log.NewError(req.OperationID, "RemoveGroupMember failed ", err.Error(), req.GroupID, v) + resp.Id2ResultList = append(resp.Id2ResultList, &pbGroup.Id2Result{UserID: v, Result: -1}) } else { - resp.Id2Result = append(resp.Id2Result, &pbGroup.Id2Result{UId: v.UserId, Result: 0}) + log.NewDebug(req.OperationID, "kicked ", v) + resp.Id2ResultList = append(resp.Id2ResultList, &pbGroup.Id2Result{UserID: v, Result: 0}) + okUserIDList = append(okUserIDList, v) } - err = db.DB.DelGroupMember(req.GroupID, v.UserId) + err = db.DB.DelGroupMember(req.GroupID, v) if err != nil { - log.Error("", "", "delete mongo group member failed, db.DB.DelGroupMember fail [err: %s]", err.Error()) - } - - } - var kq kickGroupMemberApiReq - - kq.GroupID = req.GroupID - kq.OperationID = req.OperationID - kq.Reason = req.Reason - - var gf groupMemberFullInfo - for _, v := range req.UidListInfo { - gf.UserId = v.UserId - gf.GroupId = req.GroupID - kq.UidListInfo = append(kq.UidListInfo, gf) - } - - n := content_struct.NotificationContent{1, req.GroupID, kq.ContentToString()} - - if utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) { - log.Info("", req.OperationID, claims.UID, req.GroupID) - logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{ - SendID: claims.UID, - RecvID: req.GroupID, - Content: n.ContentToString(), - SendTime: utils.GetCurrentTimestampByNano(), - MsgFrom: constant.UserMsgType, - ContentType: constant.KickGroupMemberTip, - SessionType: constant.GroupChatType, - OperationID: req.OperationID, - }) - - for _, v := range req.UidListInfo { - log.Info("", req.OperationID, claims.UID, v.UserId) - logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{ - SendID: claims.UID, - RecvID: v.UserId, - Content: n.ContentToString(), - SendTime: utils.GetCurrentTimestampBySecond(), - MsgFrom: constant.UserMsgType, - ContentType: constant.KickGroupMemberTip, - SessionType: constant.SingleChatType, - OperationID: req.OperationID, - }) + log.NewError(req.OperationID, "DelGroupMember failed ", err.Error(), req.GroupID, v) } } - resp.ErrorCode = 0 + chat.MemberKickedNotification(req, okUserIDList) + log.NewInfo(req.OperationID, "GetGroupMemberList rpc return ", resp.String()) return &resp, nil } func (s *groupServer) GetGroupMembersInfo(ctx context.Context, req *pbGroup.GetGroupMembersInfoReq) (*pbGroup.GetGroupMembersInfoResp, error) { - claims, err := token_verify.ParseToken(req.Token) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbGroup.GetGroupMembersInfoResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil - } - log.InfoByKv(claims.UID, req.OperationID, "param: ", req.MemberList) + log.NewInfo(req.OperationID, "GetGroupMembersInfo args ", req.String()) + var resp pbGroup.GetGroupMembersInfoResp for _, v := range req.MemberList { - var memberNode pbGroup.GroupMemberFullInfo - memberInfo, err := imdb.GetMemberInfoById(req.GroupID, v) - memberNode.UserId = v - fmt.Println("id : ", memberNode.UserId) + var memberNode open_im_sdk.GroupMemberFullInfo + memberInfo, err := imdb.GetMemberInfoByID(req.GroupID, v) + memberNode.UserID = v if err != nil { - log.Error(claims.UID, req.OperationID, req.GroupID, v, "GetMemberInfoById failed, ", err.Error()) - //error occurs, only id is valid - resp.MemberList = append(resp.MemberList, &memberNode) + log.NewError(req.OperationID, "GetMemberInfoById failed ", err.Error(), req.GroupID, v) continue + } else { + utils.CopyStructFields(&memberNode, memberInfo) + memberNode.JoinTime = memberInfo.JoinTime.Unix() + resp.MemberList = append(resp.MemberList, &memberNode) } - user, err := imdb.FindUserByUID(v) - if err == nil && user != nil { - memberNode.FaceUrl = user.Icon - memberNode.JoinTime = uint64(memberInfo.JoinTime.Unix()) - memberNode.UserId = user.UID - memberNode.NickName = memberInfo.NickName - memberNode.Role = memberInfo.AdministratorLevel - } - resp.MemberList = append(resp.MemberList, &memberNode) } - resp.ErrorCode = 0 + resp.ErrCode = 0 + log.NewInfo(req.OperationID, "GetGroupMembersInfo rpc return ", resp.String()) return &resp, nil } + +func (s *groupServer) GetGroupApplicationList(_ context.Context, req *pbGroup.GetGroupApplicationListReq) (*pbGroup.GetGroupApplicationListResp, error) { + log.NewInfo(req.OperationID, "GetGroupMembersInfo args ", req.String()) + reply, err := imdb.GetGroupApplicationList(req.FromUserID) + if err != nil { + log.NewError(req.OperationID, "GetGroupApplicationList failed ", err.Error(), req.FromUserID) + return &pbGroup.GetGroupApplicationListResp{ErrCode: 701, ErrMsg: "GetGroupApplicationList failed"}, nil + } + + log.NewDebug(req.OperationID, "GetGroupApplicationList reply ", reply) + resp := pbGroup.GetGroupApplicationListResp{} + for _, v := range reply { + node := open_im_sdk.GroupRequest{UserInfo: &open_im_sdk.PublicUserInfo{}, GroupInfo: &open_im_sdk.GroupInfo{}} + group, err := imdb.GetGroupInfoByGroupID(v.GroupID) + if err != nil { + log.Error(req.OperationID, "GetGroupInfoByGroupID failed ", err.Error(), v.GroupID) + continue + } + user, err := imdb.GetUserByUserID(v.UserID) + if err != nil { + log.Error(req.OperationID, "GetUserByUserID failed ", err.Error(), v.UserID) + continue + } + + cp.GroupRequestDBCopyOpenIM(&node, &v) + cp.UserDBCopyOpenIMPublicUser(node.UserInfo, user) + cp.GroupDBCopyOpenIM(node.GroupInfo, group) + log.NewDebug(req.OperationID, "node ", node, "v ", v) + resp.GroupRequestList = append(resp.GroupRequestList, &node) + } + log.NewInfo(req.OperationID, "GetGroupMembersInfo rpc return ", resp) + return &resp, nil +} + +func (s *groupServer) GetGroupsInfo(ctx context.Context, req *pbGroup.GetGroupsInfoReq) (*pbGroup.GetGroupsInfoResp, error) { + log.NewInfo(req.OperationID, "GetGroupsInfo args ", req.String()) + groupsInfoList := make([]*open_im_sdk.GroupInfo, 0) + for _, groupID := range req.GroupIDList { + groupInfoFromMysql, err := imdb.GetGroupInfoByGroupID(groupID) + if err != nil { + log.NewError(req.OperationID, "GetGroupInfoByGroupID failed ", err.Error(), groupID) + continue + } + var groupInfo open_im_sdk.GroupInfo + cp.GroupDBCopyOpenIM(&groupInfo, groupInfoFromMysql) + groupsInfoList = append(groupsInfoList, &groupInfo) + } + + resp := pbGroup.GetGroupsInfoResp{GroupInfoList: groupsInfoList} + log.NewInfo(req.OperationID, "GetGroupsInfo rpc return ", resp) + return &resp, nil +} + +func (s *groupServer) GroupApplicationResponse(_ context.Context, req *pbGroup.GroupApplicationResponseReq) (*pbGroup.GroupApplicationResponseResp, error) { + log.NewInfo(req.OperationID, "GroupApplicationResponse args ", req.String()) + + groupRequest := db.GroupRequest{} + utils.CopyStructFields(&groupRequest, req) + groupRequest.UserID = req.FromUserID + groupRequest.HandleUserID = req.OpUserID + groupRequest.HandledTime = time.Now() + if !token_verify.IsMangerUserID(req.OpUserID) && !imdb.IsGroupOwnerAdmin(req.GroupID, req.OpUserID) { + log.NewError(req.OperationID, "IsMangerUserID IsGroupOwnerAdmin false ", req.GroupID, req.OpUserID) + return &pbGroup.GroupApplicationResponseResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil + } + err := imdb.UpdateGroupRequest(groupRequest) + if err != nil { + //{openIM002 7836e478bc43ce1d3b8889cac983f59b 1 ok 0001-01-01 00:00:00 +0000 UTC openIM001 0001-01-01 00:00:00 +0000 UTC } + log.NewError(req.OperationID, "GroupApplicationResponse failed ", err.Error(), groupRequest) + return &pbGroup.GroupApplicationResponseResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + + if req.HandleResult == constant.GroupResponseAgree { + user, err := imdb.GetUserByUserID(req.FromUserID) + if err != nil { + log.NewError(req.OperationID, "GroupApplicationResponse failed ", err.Error(), req.FromUserID) + return &pbGroup.GroupApplicationResponseResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + member := db.GroupMember{} + member.GroupID = req.GroupID + member.UserID = req.FromUserID + member.RoleLevel = constant.GroupOrdinaryUsers + member.OperatorUserID = req.OpUserID + member.FaceUrl = user.FaceURL + member.Nickname = user.Nickname + + err = imdb.InsertIntoGroupMember(member) + if err != nil { + log.NewError(req.OperationID, "GroupApplicationResponse failed ", err.Error(), member) + return &pbGroup.GroupApplicationResponseResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + chat.GroupApplicationAcceptedNotification(req) + chat.MemberEnterNotification(req) + } else if req.HandleResult == constant.GroupResponseRefuse { + chat.GroupApplicationRejectedNotification(req) + } else { + log.Error(req.OperationID, "HandleResult failed ", req.HandleResult) + return &pbGroup.GroupApplicationResponseResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrArgs.ErrCode, ErrMsg: constant.ErrArgs.ErrMsg}}, nil + } + + log.NewInfo(req.OperationID, "rpc GroupApplicationResponse return ", pbGroup.GroupApplicationResponseResp{CommonResp: &pbGroup.CommonResp{}}) + return &pbGroup.GroupApplicationResponseResp{CommonResp: &pbGroup.CommonResp{}}, nil +} + +func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) (*pbGroup.JoinGroupResp, error) { + log.NewInfo(req.OperationID, "JoinGroup args ", req.String()) + _, err := imdb.GetUserByUserID(req.OpUserID) + if err != nil { + log.NewError(req.OperationID, "GetUserByUserID failed ", err.Error(), req.OpUserID) + return &pbGroup.JoinGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + + var groupRequest db.GroupRequest + groupRequest.UserID = req.OpUserID + groupRequest.ReqMsg = req.ReqMessage + groupRequest.GroupID = req.GroupID + + err = imdb.InsertIntoGroupRequest(groupRequest) + if err != nil { + log.NewError(req.OperationID, "UpdateGroupRequest ", err.Error(), groupRequest) + return &pbGroup.JoinGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + + _, err = imdb.GetGroupMemberListByGroupIDAndRoleLevel(req.GroupID, constant.GroupOwner) + if err != nil { + log.NewError(req.OperationID, "GetGroupMemberListByGroupIDAndRoleLevel failed ", err.Error(), req.GroupID, constant.GroupOwner) + return &pbGroup.JoinGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}}, nil + } + + chat.JoinGroupApplicationNotification(req) + + log.NewInfo(req.OperationID, "ReceiveJoinApplicationNotification rpc return ") + return &pbGroup.JoinGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}}, nil +} + +func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq) (*pbGroup.QuitGroupResp, error) { + log.NewError(req.OperationID, "QuitGroup args ", req.String()) + _, err := imdb.GetGroupMemberInfoByGroupIDAndUserID(req.GroupID, req.OpUserID) + if err != nil { + log.NewError(req.OperationID, "GetGroupMemberInfoByGroupIDAndUserID failed ", err.Error(), req.GroupID, req.OpUserID) + return &pbGroup.QuitGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + + err = imdb.DeleteGroupMemberByGroupIDAndUserID(req.GroupID, req.OpUserID) + if err != nil { + log.NewError(req.OperationID, "DeleteGroupMemberByGroupIdAndUserId failed ", err.Error(), req.GroupID, req.OpUserID) + return &pbGroup.QuitGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + + err = db.DB.DelGroupMember(req.GroupID, req.OpUserID) + if err != nil { + log.NewError(req.OperationID, "DelGroupMember failed ", req.GroupID, req.OpUserID) + // return &pbGroup.CommonResp{ErrorCode: constant.ErrQuitGroup.ErrCode, ErrorMsg: constant.ErrQuitGroup.ErrMsg}, nil + } + + chat.MemberQuitNotification(req) + log.NewInfo(req.OperationID, "rpc QuitGroup return ", pbGroup.QuitGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}}) + return &pbGroup.QuitGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}}, nil +} + +func hasAccess(req *pbGroup.SetGroupInfoReq) bool { + if utils.IsContain(req.OpUserID, config.Config.Manager.AppManagerUid) { + return true + } + groupUserInfo, err := imdb.GetGroupMemberInfoByGroupIDAndUserID(req.GroupInfo.GroupID, req.OpUserID) + if err != nil { + log.NewError(req.OperationID, "GetGroupMemberInfoByGroupIDAndUserID failed, ", err.Error(), req.GroupInfo.GroupID, req.OpUserID) + return false + + } + if groupUserInfo.RoleLevel == constant.GroupOwner || groupUserInfo.RoleLevel == constant.GroupAdmin { + return true + } + return false +} + +func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInfoReq) (*pbGroup.SetGroupInfoResp, error) { + log.NewInfo(req.OperationID, "SetGroupInfo args ", req.String()) + if !hasAccess(req) { + log.NewError(req.OperationID, "no access ", req) + return &pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil + } + + group, err := imdb.GetGroupInfoByGroupID(req.GroupInfo.GroupID) + if err != nil { + log.NewError(req.OperationID, "GetGroupInfoByGroupID failed ", err.Error(), req.GroupInfo.GroupID) + return &pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil + } + + ////bitwise operators: 0001:groupName; 0010:Notification 0100:Introduction; 1000:FaceUrl; 10000:owner + var changedType int32 + if group.GroupName != req.GroupInfo.GroupName && req.GroupInfo.GroupName != "" { + changedType = 1 + } + if group.Notification != req.GroupInfo.Notification && req.GroupInfo.Notification != "" { + changedType = changedType | (1 << 1) + } + if group.Introduction != req.GroupInfo.Introduction && req.GroupInfo.Introduction != "" { + changedType = changedType | (1 << 2) + } + if group.FaceUrl != req.GroupInfo.FaceURL && req.GroupInfo.FaceURL != "" { + changedType = changedType | (1 << 3) + } + //only administrators can set group information + var groupInfo db.Group + utils.CopyStructFields(&groupInfo, req.GroupInfo) + err = imdb.SetGroupInfo(groupInfo) + if err != nil { + log.NewError(req.OperationID, "SetGroupInfo failed ", err.Error(), groupInfo) + return &pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + log.NewInfo(req.OperationID, "SetGroupInfo rpc return ", pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{}}) + if changedType != 0 { + chat.GroupInfoSetNotification(req.OperationID, req.OpUserID, req.GroupInfo.GroupID) + } + return &pbGroup.SetGroupInfoResp{CommonResp: &pbGroup.CommonResp{}}, nil +} + +func (s *groupServer) TransferGroupOwner(_ context.Context, req *pbGroup.TransferGroupOwnerReq) (*pbGroup.TransferGroupOwnerResp, error) { + log.NewInfo(req.OperationID, "TransferGroupOwner ", req.String()) + + if req.OldOwnerUserID == req.NewOwnerUserID { + log.NewError(req.OperationID, "same owner ", req.OldOwnerUserID, req.NewOwnerUserID) + return &pbGroup.TransferGroupOwnerResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrArgs.ErrCode, ErrMsg: constant.ErrArgs.ErrMsg}}, nil + } + groupMemberInfo := db.GroupMember{GroupID: req.GroupID, UserID: req.OldOwnerUserID, RoleLevel: constant.GroupOrdinaryUsers} + err := imdb.UpdateGroupMemberInfo(groupMemberInfo) + if err != nil { + log.NewError(req.OperationID, "UpdateGroupMemberInfo failed ", groupMemberInfo) + return &pbGroup.TransferGroupOwnerResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + groupMemberInfo = db.GroupMember{GroupID: req.GroupID, UserID: req.NewOwnerUserID, RoleLevel: constant.GroupOwner} + err = imdb.UpdateGroupMemberInfo(groupMemberInfo) + if err != nil { + log.NewError(req.OperationID, "UpdateGroupMemberInfo failed ", groupMemberInfo) + return &pbGroup.TransferGroupOwnerResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil + } + chat.GroupOwnerTransferredNotification(req) + + return &pbGroup.TransferGroupOwnerResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}}, nil + +} diff --git a/internal/rpc/group/group_application_response.go b/internal/rpc/group/group_application_response.go deleted file mode 100644 index 4282de51b..000000000 --- a/internal/rpc/group/group_application_response.go +++ /dev/null @@ -1,39 +0,0 @@ -package group - -import ( - "Open_IM/pkg/common/db" - "Open_IM/pkg/common/db/mysql_model/im_mysql_model" - "Open_IM/pkg/common/log" - "Open_IM/pkg/proto/group" - "context" -) - -func (s *groupServer) GroupApplicationResponse(_ context.Context, pb *group.GroupApplicationResponseReq) (*group.GroupApplicationResponseResp, error) { - log.Info("", "", "rpc GroupApplicationResponse call start..., [pb: %s]", pb.String()) - - reply, err := im_mysql_model.GroupApplicationResponse(pb) - if err != nil { - log.Error("", "", "rpc GroupApplicationResponse call..., im_mysql_model.GroupApplicationResponse fail [pb: %s] [err: %s]", pb.String(), err.Error()) - return &group.GroupApplicationResponseResp{ErrCode: 702, ErrMsg: "rpc GroupApplicationResponse failed"}, nil - } - - if pb.HandleResult == 1 { - if pb.ToUserID == "0" { - err = db.DB.AddGroupMember(pb.GroupID, pb.FromUserID) - if err != nil { - log.Error("", "", "rpc GroupApplicationResponse call..., db.DB.AddGroupMember fail [pb: %s] [err: %s]", pb.String(), err.Error()) - return nil, err - } - } else { - err = db.DB.AddGroupMember(pb.GroupID, pb.ToUserID) - if err != nil { - log.Error("", "", "rpc GroupApplicationResponse call..., db.DB.AddGroupMember fail [pb: %s] [err: %s]", pb.String(), err.Error()) - return nil, err - } - } - } - - log.Info("", "", "rpc GroupApplicationResponse call..., im_mysql_model.GroupApplicationResponse") - - return reply, nil -} diff --git a/internal/rpc/group/join_group.go b/internal/rpc/group/join_group.go deleted file mode 100644 index 0aed0d4e4..000000000 --- a/internal/rpc/group/join_group.go +++ /dev/null @@ -1,57 +0,0 @@ -package group - -import ( - "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" - pbGroup "Open_IM/pkg/proto/group" - "context" -) - -func (s *groupServer) JoinGroup(ctx context.Context, req *pbGroup.JoinGroupReq) (*pbGroup.CommonResp, error) { - log.Info(req.Token, req.OperationID, "rpc join group is server,args=%s", req.String()) - //Parse token, to find current user information - claims, err := token_verify.ParseToken(req.Token) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbGroup.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil - } - applicationUserInfo, err := im_mysql_model.FindUserByUID(claims.UID) - if err != nil { - log.Error(req.Token, req.OperationID, "No this user,err=%s", err.Error()) - return &pbGroup.CommonResp{ErrorCode: constant.ErrSearchUserInfo.ErrCode, ErrorMsg: constant.ErrSearchUserInfo.ErrMsg}, nil - } - - _, err = im_mysql_model.FindGroupRequestUserInfoByGroupIDAndUid(req.GroupID, claims.UID) - if err == nil { - err = im_mysql_model.DelGroupRequest(req.GroupID, claims.UID, "0") - } - - log.Info(req.Token, req.OperationID, "args: ", req.GroupID, claims.UID, "0", req.Message, applicationUserInfo.Name, applicationUserInfo.Icon) - - if err = im_mysql_model.InsertIntoGroupRequest(req.GroupID, claims.UID, "0", req.Message, applicationUserInfo.Name, applicationUserInfo.Icon); err != nil { - log.Error(req.Token, req.OperationID, "Insert into group request failed,er=%s", err.Error()) - return &pbGroup.CommonResp{ErrorCode: constant.ErrJoinGroupApplication.ErrCode, ErrorMsg: constant.ErrJoinGroupApplication.ErrMsg}, nil - } - ////Find the the group owner - //groupCreatorInfo, err := im_mysql_model.FindGroupMemberListByGroupIdAndFilterInfo(req.GroupID, constant.GroupCreator) - //if err != nil { - // log.Error(req.Token, req.OperationID, "find group creator failed", err.Error()) - //} else { - // //Push message when join group chat - // logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{ - // SendID: claims.UID, - // RecvID: groupCreatorInfo[0].Uid, - // Content: content_struct.NewContentStructString(0, "", req.String()), - // SendTime: utils.GetCurrentTimestampBySecond(), - // MsgFrom: constant.SysMsgType, - // ContentType: constant.JoinGroupTip, - // SessionType: constant.SingleChatType, - // OperationID: req.OperationID, - // }) - //} - - log.Info(req.Token, req.OperationID, "rpc join group success return") - return &pbGroup.CommonResp{}, nil -} diff --git a/internal/rpc/group/quit_group.go b/internal/rpc/group/quit_group.go deleted file mode 100644 index e77a34009..000000000 --- a/internal/rpc/group/quit_group.go +++ /dev/null @@ -1,55 +0,0 @@ -package group - -import ( - "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/db" - "Open_IM/pkg/common/db/mysql_model/im_mysql_model" - "Open_IM/pkg/common/log" - "Open_IM/pkg/common/token_verify" - pbGroup "Open_IM/pkg/proto/group" - "context" -) - -func (s *groupServer) QuitGroup(ctx context.Context, req *pbGroup.QuitGroupReq) (*pbGroup.CommonResp, error) { - log.InfoByArgs("rpc quit group is server,args:", req.String()) - //Parse token, to find current user information - claims, err := token_verify.ParseToken(req.Token) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbGroup.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil - } - log.InfoByKv("args:", req.OperationID, req.GetGroupID(), claims.UID) - //Check to see whether there is a user in the group. - _, err = im_mysql_model.FindGroupMemberInfoByGroupIdAndUserId(req.GroupID, claims.UID) - if err != nil { - log.Error(req.Token, req.OperationID, "no such group or you are not in the group,err=%s", err.Error(), req.OperationID, req.GroupID, claims.UID) - return &pbGroup.CommonResp{ErrorCode: constant.ErrQuitGroup.ErrCode, ErrorMsg: constant.ErrQuitGroup.ErrMsg}, nil - } - //After the user's verification is successful, user will quit the group chat. - err = im_mysql_model.DeleteGroupMemberByGroupIdAndUserId(req.GroupID, claims.UID) - if err != nil { - log.ErrorByArgs("this user exit the group failed,err=%s", err.Error(), req.OperationID, req.GroupID, claims.UID) - return &pbGroup.CommonResp{ErrorCode: constant.ErrQuitGroup.ErrCode, ErrorMsg: constant.ErrQuitGroup.ErrMsg}, nil - } - - err = db.DB.DelGroupMember(req.GroupID, claims.UID) - if err != nil { - log.Error("", "", "delete mongo group member failed, db.DB.DelGroupMember fail [err: %s]", err.Error()) - return &pbGroup.CommonResp{ErrorCode: constant.ErrQuitGroup.ErrCode, ErrorMsg: constant.ErrQuitGroup.ErrMsg}, nil - } - ////Push message when quit group chat - //jsonInfo, _ := json.Marshal(req) - //logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{ - // SendID: claims.UID, - // RecvID: req.GroupID, - // Content: string(jsonInfo), - // SendTime: utils.GetCurrentTimestampBySecond(), - // MsgFrom: constant.SysMsgType, - // ContentType: constant.QuitGroupTip, - // SessionType: constant.GroupChatType, - // OperationID: req.OperationID, - //}) - log.Info(req.Token, req.OperationID, "rpc quit group is success return") - - return &pbGroup.CommonResp{}, nil -} diff --git a/internal/rpc/group/set_group_info.go b/internal/rpc/group/set_group_info.go deleted file mode 100644 index 3e1f25854..000000000 --- a/internal/rpc/group/set_group_info.go +++ /dev/null @@ -1,46 +0,0 @@ -package group - -import ( - "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" - pbGroup "Open_IM/pkg/proto/group" - "context" -) - -func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInfoReq) (*pbGroup.CommonResp, error) { - log.Info(req.Token, req.OperationID, "rpc set group info is server,args=%s", req.String()) - - //Parse token, to find current user information - claims, err := token_verify.ParseToken(req.Token) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbGroup.CommonResp{ErrorCode: constant.ErrParseToken.ErrCode, ErrorMsg: constant.ErrParseToken.ErrMsg}, nil - } - groupUserInfo, err := im_mysql_model.FindGroupMemberInfoByGroupIdAndUserId(req.GroupID, claims.UID) - if err != nil { - log.Error("", req.OperationID, "your are not in the group,can not change this group info,err=%s", err.Error()) - return &pbGroup.CommonResp{ErrorCode: constant.ErrSetGroupInfo.ErrCode, ErrorMsg: constant.ErrSetGroupInfo.ErrMsg}, nil - } - if groupUserInfo.AdministratorLevel == constant.OrdinaryMember { - return &pbGroup.CommonResp{ErrorCode: constant.ErrSetGroupInfo.ErrCode, ErrorMsg: constant.ErrAccess.ErrMsg}, nil - } - //only administrators can set group information - if err = im_mysql_model.SetGroupInfo(req.GroupID, req.GroupName, req.Introduction, req.Notification, req.FaceUrl, ""); err != nil { - return &pbGroup.CommonResp{ErrorCode: constant.ErrSetGroupInfo.ErrCode, ErrorMsg: constant.ErrSetGroupInfo.ErrMsg}, nil - } - ////Push message when set group info - //jsonInfo, _ := json.Marshal(req) - //logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{ - // SendID: claims.UID, - // RecvID: req.GroupID, - // Content: string(jsonInfo), - // SendTime: utils.GetCurrentTimestampBySecond(), - // MsgFrom: constant.SysMsgType, - // ContentType: constant.SetGroupInfoTip, - // SessionType: constant.GroupChatType, - // OperationID: req.OperationID, - //}) - return &pbGroup.CommonResp{}, nil -} diff --git a/internal/rpc/group/transfer_group_owner.go b/internal/rpc/group/transfer_group_owner.go deleted file mode 100644 index 4595fa1f1..000000000 --- a/internal/rpc/group/transfer_group_owner.go +++ /dev/null @@ -1,21 +0,0 @@ -package group - -import ( - "Open_IM/pkg/common/db/mysql_model/im_mysql_model" - "Open_IM/pkg/common/log" - "Open_IM/pkg/proto/group" - "context" -) - -func (s *groupServer) TransferGroupOwner(_ context.Context, pb *group.TransferGroupOwnerReq) (*group.TransferGroupOwnerResp, error) { - log.Info("", "", "rpc TransferGroupOwner call start..., [pb: %s]", pb.String()) - - reply, err := im_mysql_model.TransferGroupOwner(pb) - if err != nil { - log.Error("", "", "rpc TransferGroupOwner call..., im_mysql_model.TransferGroupOwner fail [pb: %s] [err: %s]", pb.String(), err.Error()) - return nil, err - } - log.Info("", "", "rpc TransferGroupOwner call..., im_mysql_model.TransferGroupOwner") - - return reply, nil -} diff --git a/internal/rpc/msg/friend_notification.go b/internal/rpc/msg/friend_notification.go new file mode 100644 index 000000000..b0377c854 --- /dev/null +++ b/internal/rpc/msg/friend_notification.go @@ -0,0 +1,155 @@ +package msg + +import ( + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/log" + utils2 "Open_IM/pkg/common/utils" + pbFriend "Open_IM/pkg/proto/friend" + open_im_sdk "Open_IM/pkg/proto/sdk_ws" + "Open_IM/pkg/utils" + "github.com/golang/protobuf/proto" +) + +func getFromToUserNickname(fromUserID, toUserID string) (string, string, error) { + from, err := imdb.GetUserByUserID(fromUserID) + if err != nil { + return "", "", utils.Wrap(err, "") + } + to, err := imdb.GetUserByUserID(toUserID) + if err != nil { + return "", "", utils.Wrap(err, "") + } + return from.Nickname, to.Nickname, nil +} + +func friendNotification(commID *pbFriend.CommID, contentType int32, m proto.Message) { + log.Info(commID.OperationID, utils.GetSelfFuncName(), "args: ", commID, contentType) + var err error + var tips open_im_sdk.TipsComm + tips.Detail, err = proto.Marshal(m) + if err != nil { + log.Error(commID.OperationID, "Marshal failed ", err.Error(), m.String()) + return + } + + fromUserNickname, toUserNickname, err := getFromToUserNickname(commID.FromUserID, commID.ToUserID) + if err != nil { + log.Error(commID.OperationID, "getFromToUserNickname failed ", err.Error(), commID.FromUserID, commID.ToUserID) + return + } + cn := config.Config.Notification + switch contentType { + case constant.FriendApplicationNotification: + tips.DefaultTips = fromUserNickname + cn.FriendApplication.DefaultTips.Tips + case constant.FriendApplicationApprovedNotification: + tips.DefaultTips = fromUserNickname + cn.FriendApplicationApproved.DefaultTips.Tips + case constant.FriendApplicationRejectedNotification: + tips.DefaultTips = fromUserNickname + cn.FriendApplicationRejected.DefaultTips.Tips + case constant.FriendAddedNotification: + tips.DefaultTips = cn.FriendAdded.DefaultTips.Tips + case constant.FriendDeletedNotification: + tips.DefaultTips = cn.FriendDeleted.DefaultTips.Tips + toUserNickname + case constant.FriendRemarkSetNotification: + tips.DefaultTips = fromUserNickname + cn.FriendRemarkSet.DefaultTips.Tips + case constant.BlackAddedNotification: + tips.DefaultTips = cn.BlackAdded.DefaultTips.Tips + toUserNickname + case constant.BlackDeletedNotification: + tips.DefaultTips = cn.BlackDeleted.DefaultTips.Tips + toUserNickname + default: + log.Error(commID.OperationID, "contentType failed ", contentType) + return + } + + var n NotificationMsg + n.SendID = commID.FromUserID + n.RecvID = commID.ToUserID + n.ContentType = contentType + n.SessionType = constant.SingleChatType + n.MsgFrom = constant.SysMsgType + n.OperationID = commID.OperationID + n.Content, err = proto.Marshal(&tips) + if err != nil { + log.Error(commID.OperationID, "Marshal failed ", err.Error(), tips.String()) + return + } + Notification(&n) +} + +func FriendApplicationNotification(req *pbFriend.AddFriendReq) { + FriendApplicationTips := open_im_sdk.FriendApplicationTips{FromToUserID: &open_im_sdk.FromToUserID{}} + FriendApplicationTips.FromToUserID.FromUserID = req.CommID.FromUserID + FriendApplicationTips.FromToUserID.ToUserID = req.CommID.ToUserID + friendNotification(req.CommID, constant.FriendApplicationNotification, &FriendApplicationTips) +} + +func FriendApplicationApprovedNotification(req *pbFriend.AddFriendResponseReq) { + FriendApplicationApprovedTips := open_im_sdk.FriendApplicationApprovedTips{FromToUserID: &open_im_sdk.FromToUserID{}} + FriendApplicationApprovedTips.FromToUserID.FromUserID = req.CommID.FromUserID + FriendApplicationApprovedTips.FromToUserID.ToUserID = req.CommID.ToUserID + FriendApplicationApprovedTips.HandleMsg = req.HandleMsg + friendNotification(req.CommID, constant.FriendApplicationApprovedNotification, &FriendApplicationApprovedTips) +} + +func FriendApplicationRejectedNotification(req *pbFriend.AddFriendResponseReq) { + FriendApplicationApprovedTips := open_im_sdk.FriendApplicationApprovedTips{FromToUserID: &open_im_sdk.FromToUserID{}} + FriendApplicationApprovedTips.FromToUserID.FromUserID = req.CommID.FromUserID + FriendApplicationApprovedTips.FromToUserID.ToUserID = req.CommID.ToUserID + FriendApplicationApprovedTips.HandleMsg = req.HandleMsg + friendNotification(req.CommID, constant.FriendApplicationRejectedNotification, &FriendApplicationApprovedTips) +} + +func FriendAddedNotification(operationID, opUserID, fromUserID, toUserID string) { + return + friendAddedTips := open_im_sdk.FriendAddedTips{Friend: &open_im_sdk.FriendInfo{}, OpUser: &open_im_sdk.PublicUserInfo{}} + user, err := imdb.GetUserByUserID(opUserID) + if err != nil { + log.NewError(operationID, "GetUserByUserID failed ", err.Error(), opUserID) + return + } + utils2.UserDBCopyOpenIMPublicUser(friendAddedTips.OpUser, user) + friend, err := imdb.GetFriendRelationshipFromFriend(fromUserID, toUserID) + if err != nil { + log.NewError(operationID, "GetFriendRelationshipFromFriend failed ", err.Error(), fromUserID, toUserID) + return + } + utils2.FriendDBCopyOpenIM(friendAddedTips.Friend, friend) + commID := pbFriend.CommID{FromUserID: fromUserID, ToUserID: toUserID, OpUserID: opUserID, OperationID: operationID} + friendNotification(&commID, constant.FriendAddedNotification, &friendAddedTips) +} + +func FriendDeletedNotification(req *pbFriend.DeleteFriendReq) { + friendDeletedTips := open_im_sdk.FriendDeletedTips{FromToUserID: &open_im_sdk.FromToUserID{}} + friendDeletedTips.FromToUserID.FromUserID = req.CommID.FromUserID + friendDeletedTips.FromToUserID.ToUserID = req.CommID.ToUserID + friendNotification(req.CommID, constant.FriendDeletedNotification, &friendDeletedTips) +} + +func FriendRemarkSetNotification(operationID, opUserID, fromUserID, toUserID string) { + friendInfoChangedTips := open_im_sdk.FriendInfoChangedTips{FromToUserID: &open_im_sdk.FromToUserID{}} + friendInfoChangedTips.FromToUserID.FromUserID = fromUserID + friendInfoChangedTips.FromToUserID.ToUserID = toUserID + commID := pbFriend.CommID{FromUserID: fromUserID, ToUserID: toUserID, OpUserID: opUserID, OperationID: operationID} + friendNotification(&commID, constant.FriendRemarkSetNotification, &friendInfoChangedTips) +} + +func BlackAddedNotification(req *pbFriend.AddBlacklistReq) { + blackAddedTips := open_im_sdk.BlackAddedTips{FromToUserID: &open_im_sdk.FromToUserID{}} + blackAddedTips.FromToUserID.FromUserID = req.CommID.FromUserID + blackAddedTips.FromToUserID.ToUserID = req.CommID.ToUserID + friendNotification(req.CommID, constant.BlackAddedNotification, &blackAddedTips) +} + +func BlackDeletedNotification(req *pbFriend.RemoveBlacklistReq) { + blackDeletedTips := open_im_sdk.BlackDeletedTips{FromToUserID: &open_im_sdk.FromToUserID{}} + blackDeletedTips.FromToUserID.FromUserID = req.CommID.FromUserID + blackDeletedTips.FromToUserID.ToUserID = req.CommID.ToUserID + friendNotification(req.CommID, constant.BlackDeletedNotification, &blackDeletedTips) +} + +func UserInfoUpdatedNotification(operationID, userID string, needNotifiedUserID string) { + selfInfoUpdatedTips := open_im_sdk.UserInfoUpdatedTips{UserID: userID} + commID := pbFriend.CommID{FromUserID: userID, ToUserID: userID, OpUserID: needNotifiedUserID, OperationID: operationID} + friendNotification(&commID, constant.UserInfoUpdatedNotification, &selfInfoUpdatedTips) +} diff --git a/internal/rpc/msg/group_notification.go b/internal/rpc/msg/group_notification.go new file mode 100644 index 000000000..5893a9781 --- /dev/null +++ b/internal/rpc/msg/group_notification.go @@ -0,0 +1,368 @@ +package msg + +import ( + "Open_IM/pkg/common/config" + "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" + utils2 "Open_IM/pkg/common/utils" + pbGroup "Open_IM/pkg/proto/group" + open_im_sdk "Open_IM/pkg/proto/sdk_ws" + "Open_IM/pkg/utils" + "github.com/golang/protobuf/proto" +) + +//message GroupCreatedTips{ +// GroupInfo Group = 1; +// GroupMemberFullInfo Creator = 2; +// repeated GroupMemberFullInfo MemberList = 3; +// uint64 OperationTime = 4; +//} creator->group + +func setOpUserInfo(opUserID, groupID string, groupMemberInfo *open_im_sdk.GroupMemberFullInfo) error { + if token_verify.IsMangerUserID(opUserID) { + u, err := imdb.GetUserByUserID(opUserID) + if err != nil { + return utils.Wrap(err, "GetUserByUserID failed") + } + utils.CopyStructFields(groupMemberInfo, u) + groupMemberInfo.GroupID = groupID + } else { + u, err := imdb.GetGroupMemberInfoByGroupIDAndUserID(groupID, opUserID) + if err != nil { + return utils.Wrap(err, "GetGroupMemberInfoByGroupIDAndUserID failed") + } + if err = utils2.GroupMemberDBCopyOpenIM(groupMemberInfo, u); err != nil { + return utils.Wrap(err, "") + } + } + return nil +} + +func setGroupInfo(groupID string, groupInfo *open_im_sdk.GroupInfo) error { + group, err := imdb.GetGroupInfoByGroupID(groupID) + if err != nil { + return utils.Wrap(err, "GetGroupInfoByGroupID failed") + } + err = utils2.GroupDBCopyOpenIM(groupInfo, group) + if err != nil { + return utils.Wrap(err, "GetGroupMemberNumByGroupID failed") + } + return nil +} + +func setGroupMemberInfo(groupID, userID string, groupMemberInfo *open_im_sdk.GroupMemberFullInfo) error { + groupMember, err := imdb.GetGroupMemberInfoByGroupIDAndUserID(groupID, userID) + if err != nil { + return utils.Wrap(err, "") + } + if err = utils2.GroupMemberDBCopyOpenIM(groupMemberInfo, groupMember); err != nil { + return utils.Wrap(err, "") + } + return nil +} + +func setGroupOwnerInfo(groupID string, groupMemberInfo *open_im_sdk.GroupMemberFullInfo) error { + groupMember, err := imdb.GetGroupOwnerInfoByGroupID(groupID) + if err != nil { + return utils.Wrap(err, "") + } + if err = utils2.GroupMemberDBCopyOpenIM(groupMemberInfo, groupMember); err != nil { + return utils.Wrap(err, "") + } + return nil +} + +func setPublicUserInfo(userID string, publicUserInfo *open_im_sdk.PublicUserInfo) error { + user, err := imdb.GetUserByUserID(userID) + if err != nil { + return utils.Wrap(err, "") + } + utils2.UserDBCopyOpenIMPublicUser(publicUserInfo, user) + return nil +} + +func groupNotification(contentType int32, m proto.Message, sendID, groupID, recvUserID, operationID string) { + log.Info(operationID, utils.GetSelfFuncName(), "args: ", contentType) + + var err error + var tips open_im_sdk.TipsComm + tips.Detail, err = proto.Marshal(m) + if err != nil { + log.Error(operationID, "Marshal failed ", err.Error(), m.String()) + return + } + + cn := config.Config.Notification + switch contentType { + case constant.GroupCreatedNotification: + tips.DefaultTips = cn.GroupCreated.DefaultTips.Tips + case constant.GroupInfoSetNotification: + case constant.JoinGroupApplicationNotification: + case constant.MemberQuitNotification: + case constant.GroupApplicationAcceptedNotification: + case constant.GroupApplicationRejectedNotification: + case constant.GroupOwnerTransferredNotification: + case constant.MemberKickedNotification: + case constant.MemberInvitedNotification: + default: + log.Error(operationID, "contentType failed ", contentType) + return + } + + var n NotificationMsg + n.SendID = sendID + if groupID != "" { + n.RecvID = groupID + n.SessionType = constant.GroupChatType + } else { + n.RecvID = recvUserID + n.SessionType = constant.SingleChatType + } + n.ContentType = contentType + n.OperationID = operationID + n.Content, err = proto.Marshal(&tips) + if err != nil { + log.Error(operationID, "Marshal failed ", err.Error(), tips.String()) + return + } + Notification(&n) +} + +//创建群后调用 +func GroupCreatedNotification(operationID, opUserID, groupID string, initMemberList []string) { + GroupCreatedTips := open_im_sdk.GroupCreatedTips{Group: &open_im_sdk.GroupInfo{}, + OpUser: &open_im_sdk.GroupMemberFullInfo{}, GroupOwnerUser: &open_im_sdk.GroupMemberFullInfo{}} + if err := setOpUserInfo(opUserID, groupID, GroupCreatedTips.OpUser); err != nil { + log.NewError(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID, GroupCreatedTips.OpUser) + return + } + err := setGroupInfo(groupID, GroupCreatedTips.Group) + if err != nil { + log.Error(operationID, "setGroupInfo failed ", groupID, GroupCreatedTips.Group) + return + } + imdb.GetGroupOwnerInfoByGroupID(groupID) + if err := setGroupOwnerInfo(groupID, GroupCreatedTips.GroupOwnerUser); err != nil { + log.Error(operationID, "setGroupOwnerInfo failed", err.Error(), groupID) + return + } + for _, v := range initMemberList { + var groupMemberInfo open_im_sdk.GroupMemberFullInfo + if err := setGroupMemberInfo(groupID, v, &groupMemberInfo); err != nil { + log.Error(operationID, "setGroupMemberInfo failed ", err.Error(), groupID, v) + continue + } + GroupCreatedTips.MemberList = append(GroupCreatedTips.MemberList, &groupMemberInfo) + } + groupNotification(constant.GroupCreatedNotification, &GroupCreatedTips, opUserID, groupID, "", operationID) +} + +//群信息改变后掉用 +func GroupInfoSetNotification(operationID, opUserID, groupID string) { + GroupInfoChangedTips := open_im_sdk.GroupInfoSetTips{Group: &open_im_sdk.GroupInfo{}, OpUser: &open_im_sdk.GroupMemberFullInfo{}} + if err := setGroupInfo(groupID, GroupInfoChangedTips.Group); err != nil { + log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID) + return + } + if err := setOpUserInfo(opUserID, groupID, GroupInfoChangedTips.OpUser); err != nil { + log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID) + return + } + groupNotification(constant.GroupInfoSetNotification, &GroupInfoChangedTips, opUserID, groupID, "", operationID) +} + +//message ReceiveJoinApplicationTips{ +// GroupInfo Group = 1; +// PublicUserInfo Applicant = 2; +// string Reason = 3; +//} apply->all managers GroupID string `protobuf:"bytes,1,opt,name=GroupID" json:"GroupID,omitempty"` +// ReqMessage string `protobuf:"bytes,2,opt,name=ReqMessage" json:"ReqMessage,omitempty"` +// OpUserID string `protobuf:"bytes,3,opt,name=OpUserID" json:"OpUserID,omitempty"` +// OperationID string `protobuf:"bytes,4,opt,name=OperationID" json:"OperationID,omitempty"` +//申请进群后调用 +func JoinGroupApplicationNotification(req *pbGroup.JoinGroupReq) { + JoinGroupApplicationTips := open_im_sdk.JoinGroupApplicationTips{Group: &open_im_sdk.GroupInfo{}, Applicant: &open_im_sdk.PublicUserInfo{}} + err := setGroupInfo(req.GroupID, JoinGroupApplicationTips.Group) + if err != nil { + log.Error(req.OperationID, "setGroupInfo failed ", err.Error(), req.GroupID) + return + } + if err = setPublicUserInfo(req.OpUserID, JoinGroupApplicationTips.Applicant); err != nil { + log.Error(req.OperationID, "setPublicUserInfo failed ", err.Error(), req.OpUserID) + return + } + JoinGroupApplicationTips.ReqMsg = req.ReqMessage + + managerList, err := imdb.GetOwnerManagerByGroupID(req.GroupID) + if err != nil { + log.NewError(req.OperationID, "GetOwnerManagerByGroupId failed ", err.Error(), req.GroupID) + return + } + for _, v := range managerList { + groupNotification(constant.JoinGroupApplicationNotification, &JoinGroupApplicationTips, req.OpUserID, "", v.UserID, req.OperationID) + log.NewInfo(req.OperationID, "Notification ", v) + } +} + +func MemberQuitNotification(req *pbGroup.QuitGroupReq) { + MemberQuitTips := open_im_sdk.MemberQuitTips{Group: &open_im_sdk.GroupInfo{}, QuitUser: &open_im_sdk.GroupMemberFullInfo{}} + if err := setGroupInfo(req.GroupID, MemberQuitTips.Group); err != nil { + log.Error(req.OperationID, "setGroupInfo failed ", err.Error(), req.GroupID) + return + } + if err := setOpUserInfo(req.OpUserID, req.GroupID, MemberQuitTips.QuitUser); err != nil { + log.Error(req.OperationID, "setOpUserInfo failed ", err.Error(), req.OpUserID, req.GroupID) + return + } + + groupNotification(constant.MemberQuitNotification, &MemberQuitTips, req.OpUserID, req.GroupID, "", req.OperationID) + groupNotification(constant.MemberQuitNotification, &MemberQuitTips, req.OpUserID, "", req.OpUserID, req.OperationID) + +} + +//message ApplicationProcessedTips{ +// GroupInfo Group = 1; +// GroupMemberFullInfo OpUser = 2; +// int32 Result = 3; +// string Reason = 4; +//} +//处理进群请求后调用 +func GroupApplicationAcceptedNotification(req *pbGroup.GroupApplicationResponseReq) { + GroupApplicationAcceptedTips := open_im_sdk.GroupApplicationAcceptedTips{Group: &open_im_sdk.GroupInfo{}, OpUser: &open_im_sdk.GroupMemberFullInfo{}, HandleMsg: req.HandledMsg} + if err := setGroupInfo(req.GroupID, GroupApplicationAcceptedTips.Group); err != nil { + log.NewError(req.OperationID, "setGroupInfo failed ", err.Error(), req.GroupID, GroupApplicationAcceptedTips.Group) + return + } + if err := setOpUserInfo(req.OpUserID, req.GroupID, GroupApplicationAcceptedTips.OpUser); err != nil { + log.Error(req.OperationID, "setOpUserInfo failed", req.OpUserID, req.GroupID, GroupApplicationAcceptedTips.OpUser) + return + } + groupNotification(constant.GroupApplicationAcceptedNotification, &GroupApplicationAcceptedTips, req.OpUserID, "", req.FromUserID, req.OperationID) +} + +func GroupApplicationRejectedNotification(req *pbGroup.GroupApplicationResponseReq) { + GroupApplicationRejectedTips := open_im_sdk.GroupApplicationRejectedTips{Group: &open_im_sdk.GroupInfo{}, OpUser: &open_im_sdk.GroupMemberFullInfo{}, HandleMsg: req.HandledMsg} + if err := setGroupInfo(req.GroupID, GroupApplicationRejectedTips.Group); err != nil { + log.NewError(req.OperationID, "setGroupInfo failed ", err.Error(), req.GroupID, GroupApplicationRejectedTips.Group) + return + } + if err := setOpUserInfo(req.OpUserID, req.GroupID, GroupApplicationRejectedTips.OpUser); err != nil { + log.Error(req.OperationID, "setOpUserInfo failed", req.OpUserID, req.GroupID, GroupApplicationRejectedTips.OpUser) + return + } + groupNotification(constant.GroupApplicationRejectedNotification, &GroupApplicationRejectedTips, req.OpUserID, "", req.FromUserID, req.OperationID) +} + +func GroupOwnerTransferredNotification(req *pbGroup.TransferGroupOwnerReq) { + GroupOwnerTransferredTips := open_im_sdk.GroupOwnerTransferredTips{Group: &open_im_sdk.GroupInfo{}, OpUser: &open_im_sdk.GroupMemberFullInfo{}, NewGroupOwner: &open_im_sdk.GroupMemberFullInfo{}} + if err := setGroupInfo(req.GroupID, GroupOwnerTransferredTips.Group); err != nil { + log.NewError(req.OperationID, "setGroupInfo failed ", err.Error(), req.GroupID) + return + } + if err := setOpUserInfo(req.OpUserID, req.GroupID, GroupOwnerTransferredTips.OpUser); err != nil { + log.Error(req.OperationID, "setOpUserInfo failed", req.OpUserID, req.GroupID) + return + } + if err := setGroupMemberInfo(req.GroupID, req.NewOwnerUserID, GroupOwnerTransferredTips.NewGroupOwner); err != nil { + log.Error(req.OperationID, "setGroupMemberInfo failed", req.GroupID, req.NewOwnerUserID) + return + } + groupNotification(constant.GroupOwnerTransferredNotification, &GroupOwnerTransferredTips, req.OpUserID, "", req.NewOwnerUserID, req.OperationID) +} + +//message MemberKickedTips{ +// GroupInfo Group = 1; +// GroupMemberFullInfo OpUser = 2; +// GroupMemberFullInfo KickedUser = 3; +// uint64 OperationTime = 4; +//} +//被踢后调用 +func MemberKickedNotification(req *pbGroup.KickGroupMemberReq, kickedUserIDList []string) { + MemberKickedTips := open_im_sdk.MemberKickedTips{Group: &open_im_sdk.GroupInfo{}, OpUser: &open_im_sdk.GroupMemberFullInfo{}} + if err := setGroupInfo(req.GroupID, MemberKickedTips.Group); err != nil { + log.Error(req.OperationID, "setGroupInfo failed ", err.Error(), req.GroupID) + return + } + if err := setOpUserInfo(req.OpUserID, req.GroupID, MemberKickedTips.OpUser); err != nil { + log.Error(req.OperationID, "setOpUserInfo failed ", err.Error(), req.OpUserID) + return + } + for _, v := range kickedUserIDList { + var groupMemberInfo open_im_sdk.GroupMemberFullInfo + if err := setGroupMemberInfo(req.GroupID, v, &groupMemberInfo); err != nil { + log.Error(req.OperationID, "setGroupMemberInfo failed ", err.Error(), req.GroupID, v) + continue + } + MemberKickedTips.KickedUserList = append(MemberKickedTips.KickedUserList, &groupMemberInfo) + } + groupNotification(constant.MemberKickedNotification, &MemberKickedTips, req.OpUserID, req.GroupID, "", req.OperationID) + + for _, v := range kickedUserIDList { + groupNotification(constant.MemberKickedNotification, &MemberKickedTips, req.OpUserID, "", v, req.OperationID) + } +} + +//message MemberInvitedTips{ +// GroupInfo Group = 1; +// GroupMemberFullInfo OpUser = 2; +// GroupMemberFullInfo InvitedUser = 3; +// uint64 OperationTime = 4; +//} +//被邀请进群后调用 +func MemberInvitedNotification(operationID, groupID, opUserID, reason string, invitedUserIDList []string) { + MemberInvitedTips := open_im_sdk.MemberInvitedTips{Group: &open_im_sdk.GroupInfo{}, OpUser: &open_im_sdk.GroupMemberFullInfo{}} + if err := setGroupInfo(groupID, MemberInvitedTips.Group); err != nil { + log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID) + return + } + if err := setOpUserInfo(opUserID, groupID, MemberInvitedTips.OpUser); err != nil { + log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID) + return + } + for _, v := range invitedUserIDList { + var groupMemberInfo open_im_sdk.GroupMemberFullInfo + if err := setGroupMemberInfo(groupID, v, &groupMemberInfo); err != nil { + log.Error(operationID, "setGroupMemberInfo failed ", err.Error(), groupID) + continue + } + MemberInvitedTips.InvitedUserList = append(MemberInvitedTips.InvitedUserList, &groupMemberInfo) + } + + groupNotification(constant.MemberInvitedNotification, &MemberInvitedTips, opUserID, groupID, "", operationID) +} + +//message GroupInfoChangedTips{ +// int32 ChangedType = 1; //bitwise operators: 1:groupName; 10:Notification 100:Introduction; 1000:FaceUrl +// GroupInfo Group = 2; +// GroupMemberFullInfo OpUser = 3; +//} + +//message MemberLeaveTips{ +// GroupInfo Group = 1; +// GroupMemberFullInfo LeaverUser = 2; +// uint64 OperationTime = 3; +//} + +//群成员退群后调用 + +//message MemberEnterTips{ +// GroupInfo Group = 1; +// GroupMemberFullInfo EntrantUser = 2; +// uint64 OperationTime = 3; +//} +//群成员主动申请进群,管理员同意后调用, +func MemberEnterNotification(req *pbGroup.GroupApplicationResponseReq) { + MemberEnterTips := open_im_sdk.MemberEnterTips{Group: &open_im_sdk.GroupInfo{}, EntrantUser: &open_im_sdk.GroupMemberFullInfo{}} + if err := setGroupInfo(req.GroupID, MemberEnterTips.Group); err != nil { + log.Error(req.OperationID, "setGroupInfo failed ", err.Error(), req.GroupID, MemberEnterTips.Group) + return + } + if err := setOpUserInfo(req.OpUserID, req.GroupID, MemberEnterTips.EntrantUser); err != nil { + log.Error(req.OperationID, "setOpUserInfo failed ", err.Error(), req.OpUserID, req.GroupID, MemberEnterTips.EntrantUser) + return + } + groupNotification(constant.MemberEnterNotification, &MemberEnterTips, req.OpUserID, req.GroupID, "", req.OperationID) + +} diff --git a/internal/rpc/msg/pull_message.go b/internal/rpc/msg/pull_message.go new file mode 100644 index 000000000..05f1dad39 --- /dev/null +++ b/internal/rpc/msg/pull_message.go @@ -0,0 +1,73 @@ +package msg + +import ( + "context" + "github.com/garyburd/redigo/redis" + + commonDB "Open_IM/pkg/common/db" + "Open_IM/pkg/common/log" + pbMsg "Open_IM/pkg/proto/chat" + open_im_sdk "Open_IM/pkg/proto/sdk_ws" +) + +func (rpc *rpcChat) GetMaxAndMinSeq(_ context.Context, in *pbMsg.GetMaxAndMinSeqReq) (*pbMsg.GetMaxAndMinSeqResp, error) { + log.InfoByKv("rpc getMaxAndMinSeq is arriving", in.OperationID, in.String()) + //seq, err := model.GetBiggestSeqFromReceive(in.UserID) + maxSeq, err1 := commonDB.DB.GetUserMaxSeq(in.UserID) + minSeq, err2 := commonDB.DB.GetUserMinSeq(in.UserID) + resp := new(pbMsg.GetMaxAndMinSeqResp) + if err1 == nil { + resp.MaxSeq = uint32(maxSeq) + } else if err1 == redis.ErrNil { + resp.MaxSeq = 0 + } else { + log.NewError(in.OperationID, "getMaxSeq from redis error", in.String(), err1.Error()) + resp.ErrCode = 200 + resp.ErrMsg = "redis get err" + } + if err2 == nil { + resp.MinSeq = uint32(minSeq) + } else if err2 == redis.ErrNil { + resp.MinSeq = 0 + } else { + log.NewError(in.OperationID, "getMaxSeq from redis error", in.String(), err2.Error()) + resp.ErrCode = 201 + resp.ErrMsg = "redis get err" + } + return resp, nil +} +func (rpc *rpcChat) PullMessageBySeqList(_ context.Context, in *open_im_sdk.PullMessageBySeqListReq) (*open_im_sdk.PullMessageBySeqListResp, error) { + log.NewInfo(in.OperationID, "rpc PullMessageBySeqList is arriving", in.String()) + resp := new(open_im_sdk.PullMessageBySeqListResp) + msgList, err := commonDB.DB.GetMsgBySeqList(in.UserID, in.SeqList, in.OperationID) + if err != nil { + log.ErrorByKv("PullMessageBySeqList data error", in.OperationID, in.String()) + resp.ErrCode = 201 + resp.ErrMsg = err.Error() + return resp, nil + } + //respSingleMsgFormat = singleMsgHandleByUser(SingleMsgFormat, in.UserID) + //respGroupMsgFormat = groupMsgHandleByUser(GroupMsgFormat) + resp.ErrCode = 0 + resp.ErrMsg = "" + resp.List = msgList + return resp, nil + +} + +type MsgFormats []*open_im_sdk.MsgData + +// Implement the sort.Interface interface to get the number of elements method +func (s MsgFormats) Len() int { + return len(s) +} + +//Implement the sort.Interface interface comparison element method +func (s MsgFormats) Less(i, j int) bool { + return s[i].SendTime < s[j].SendTime +} + +//Implement the sort.Interface interface exchange element method +func (s MsgFormats) Swap(i, j int) { + s[i], s[j] = s[j], s[i] +} diff --git a/internal/rpc/chat/rpcChat.go b/internal/rpc/msg/rpcChat.go similarity index 99% rename from internal/rpc/chat/rpcChat.go rename to internal/rpc/msg/rpcChat.go index e3d2460dd..43113ae51 100644 --- a/internal/rpc/chat/rpcChat.go +++ b/internal/rpc/msg/rpcChat.go @@ -1,4 +1,4 @@ -package chat +package msg import ( "Open_IM/pkg/common/config" diff --git a/internal/rpc/msg/send_msg.go b/internal/rpc/msg/send_msg.go new file mode 100644 index 000000000..8b91a3c39 --- /dev/null +++ b/internal/rpc/msg/send_msg.go @@ -0,0 +1,302 @@ +package msg + +import ( + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/db" + http2 "Open_IM/pkg/common/http" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" + pbChat "Open_IM/pkg/proto/chat" + pbGroup "Open_IM/pkg/proto/group" + sdk_ws "Open_IM/pkg/proto/sdk_ws" + "Open_IM/pkg/utils" + "context" + "encoding/json" + "github.com/garyburd/redigo/redis" + "math/rand" + "net/http" + "strconv" + "strings" + "time" +) + +type MsgCallBackReq struct { + SendID string `json:"sendID"` + RecvID string `json:"recvID"` + Content string `json:"content"` + SendTime int64 `json:"sendTime"` + MsgFrom int32 `json:"msgFrom"` + ContentType int32 `json:"contentType"` + SessionType int32 `json:"sessionType"` + PlatformID int32 `json:"senderPlatformID"` + MsgID string `json:"msgID"` + IsOnlineOnly bool `json:"isOnlineOnly"` +} +type MsgCallBackResp struct { + ErrCode int32 `json:"errCode"` + ErrMsg string `json:"errMsg"` + ResponseErrCode int32 `json:"responseErrCode"` + ResponseResult struct { + ModifiedMsg string `json:"modifiedMsg"` + Ext string `json:"ext"` + } +} + +func (rpc *rpcChat) encapsulateMsgData(msg *sdk_ws.MsgData) { + msg.ServerMsgID = GetMsgID(msg.SendID) + if msg.SendTime == 0 { + msg.SendTime = utils.GetCurrentTimestampByMill() + } + switch msg.ContentType { + case constant.Text: + fallthrough + case constant.Picture: + fallthrough + case constant.Voice: + fallthrough + case constant.Video: + fallthrough + case constant.File: + fallthrough + case constant.AtText: + fallthrough + case constant.Merger: + fallthrough + case constant.Card: + fallthrough + case constant.Location: + fallthrough + case constant.Custom: + fallthrough + case constant.Quote: + utils.SetSwitchFromOptions(msg.Options, constant.IsConversationUpdate, true) + utils.SetSwitchFromOptions(msg.Options, constant.IsUnreadCount, true) + utils.SetSwitchFromOptions(msg.Options, constant.IsSenderSync, true) + case constant.Revoke: + utils.SetSwitchFromOptions(msg.Options, constant.IsUnreadCount, false) + utils.SetSwitchFromOptions(msg.Options, constant.IsOfflinePush, false) + case constant.HasReadReceipt: + utils.SetSwitchFromOptions(msg.Options, constant.IsConversationUpdate, false) + utils.SetSwitchFromOptions(msg.Options, constant.IsUnreadCount, false) + utils.SetSwitchFromOptions(msg.Options, constant.IsOfflinePush, false) + case constant.Typing: + utils.SetSwitchFromOptions(msg.Options, constant.IsHistory, false) + utils.SetSwitchFromOptions(msg.Options, constant.IsPersistent, false) + utils.SetSwitchFromOptions(msg.Options, constant.IsSenderSync, false) + utils.SetSwitchFromOptions(msg.Options, constant.IsConversationUpdate, false) + utils.SetSwitchFromOptions(msg.Options, constant.IsUnreadCount, false) + utils.SetSwitchFromOptions(msg.Options, constant.IsOfflinePush, false) + + } +} +func (rpc *rpcChat) SendMsg(_ context.Context, pb *pbChat.SendMsgReq) (*pbChat.SendMsgResp, error) { + replay := pbChat.SendMsgResp{} + log.NewDebug(pb.OperationID, "rpc sendMsg come here", pb.String()) + //if !utils.VerifyToken(pb.Token, pb.SendID) { + // return returnMsg(&replay, pb, http.StatusUnauthorized, "token validate err,not authorized", "", 0) + rpc.encapsulateMsgData(pb.MsgData) + msgToMQ := pbChat.MsgDataToMQ{Token: pb.Token, OperationID: pb.OperationID} + //options := utils.JsonStringToMap(pbData.Options) + isHistory := utils.GetSwitchFromOptions(pb.MsgData.Options, constant.IsHistory) + mReq := MsgCallBackReq{ + SendID: pb.MsgData.SendID, + RecvID: pb.MsgData.RecvID, + Content: string(pb.MsgData.Content), + SendTime: pb.MsgData.SendTime, + MsgFrom: pb.MsgData.MsgFrom, + ContentType: pb.MsgData.ContentType, + SessionType: pb.MsgData.SessionType, + PlatformID: pb.MsgData.SenderPlatformID, + MsgID: pb.MsgData.ClientMsgID, + } + if !isHistory { + mReq.IsOnlineOnly = true + } + mResp := MsgCallBackResp{} + if config.Config.MessageCallBack.CallbackSwitch { + bMsg, err := http2.Post(config.Config.MessageCallBack.CallbackUrl, mReq, config.Config.MessageCallBack.CallBackTimeOut) + if err != nil { + log.ErrorByKv("callback to Business server err", pb.OperationID, "args", pb.String(), "err", err.Error()) + return returnMsg(&replay, pb, http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError), "", 0) + } else if err = json.Unmarshal(bMsg, &mResp); err != nil { + log.ErrorByKv("ws json Unmarshal err", pb.OperationID, "args", pb.String(), "err", err.Error()) + return returnMsg(&replay, pb, 200, err.Error(), "", 0) + } else { + if mResp.ErrCode != 0 { + return returnMsg(&replay, pb, mResp.ResponseErrCode, mResp.ErrMsg, "", 0) + } else { + pb.MsgData.Content = []byte(mResp.ResponseResult.ModifiedMsg) + } + } + } + switch pb.MsgData.SessionType { + case constant.SingleChatType: + isSend := modifyMessageByUserMessageReceiveOpt(pb.MsgData.RecvID, pb.MsgData.SendID, constant.SingleChatType, pb) + if isSend { + msgToMQ.MsgData = pb.MsgData + err1 := rpc.sendMsgToKafka(&msgToMQ, msgToMQ.MsgData.RecvID) + if err1 != nil { + log.NewError(msgToMQ.OperationID, "kafka send msg err:RecvID", msgToMQ.MsgData.RecvID, msgToMQ.String()) + return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0) + } + } + if msgToMQ.MsgData.SendID != msgToMQ.MsgData.RecvID { //Filter messages sent to yourself + err2 := rpc.sendMsgToKafka(&msgToMQ, msgToMQ.MsgData.SendID) + if err2 != nil { + log.NewError(msgToMQ.OperationID, "kafka send msg err:SendID", msgToMQ.MsgData.SendID, msgToMQ.String()) + return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0) + } + } + return returnMsg(&replay, pb, 0, "", msgToMQ.MsgData.ServerMsgID, msgToMQ.MsgData.SendTime) + case constant.GroupChatType: + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImGroupName) + client := pbGroup.NewGroupClient(etcdConn) + req := &pbGroup.GetGroupAllMemberReq{ + GroupID: pb.MsgData.GroupID, + OperationID: pb.OperationID, + } + reply, err := client.GetGroupAllMember(context.Background(), req) + if err != nil { + log.Error(pb.Token, pb.OperationID, "rpc send_msg getGroupInfo failed, err = %s", err.Error()) + return returnMsg(&replay, pb, 201, err.Error(), "", 0) + } + if reply.ErrCode != 0 { + log.Error(pb.Token, pb.OperationID, "rpc send_msg getGroupInfo failed, err = %s", reply.ErrMsg) + return returnMsg(&replay, pb, reply.ErrCode, reply.ErrMsg, "", 0) + } + groupID := pb.MsgData.GroupID + for _, v := range reply.MemberList { + pb.MsgData.RecvID = v.UserID + isSend := modifyMessageByUserMessageReceiveOpt(v.UserID, groupID, constant.GroupChatType, pb) + if isSend { + msgToMQ.MsgData = pb.MsgData + err := rpc.sendMsgToKafka(&msgToMQ, v.UserID) + if err != nil { + log.NewError(msgToMQ.OperationID, "kafka send msg err:UserId", v.UserID, msgToMQ.String()) + return returnMsg(&replay, pb, 201, "kafka send msg err", "", 0) + } + } + + } + return returnMsg(&replay, pb, 0, "", msgToMQ.MsgData.ServerMsgID, msgToMQ.MsgData.SendTime) + default: + return returnMsg(&replay, pb, 203, "unkonwn sessionType", "", 0) + } +} + +func (rpc *rpcChat) sendMsgToKafka(m *pbChat.MsgDataToMQ, key string) error { + pid, offset, err := rpc.producer.SendMessage(m, key) + if err != nil { + log.ErrorByKv("kafka send failed", m.OperationID, "send data", m.String(), "pid", pid, "offset", offset, "err", err.Error(), "key", key) + } + return err +} +func GetMsgID(sendID string) string { + t := time.Now().Format("2006-01-02 15:04:05") + return t + "-" + sendID + "-" + strconv.Itoa(rand.Int()) +} + +func returnMsg(replay *pbChat.SendMsgResp, pb *pbChat.SendMsgReq, errCode int32, errMsg, serverMsgID string, sendTime int64) (*pbChat.SendMsgResp, error) { + replay.ErrCode = errCode + replay.ErrMsg = errMsg + replay.ServerMsgID = serverMsgID + replay.ClientMsgID = pb.MsgData.ClientMsgID + replay.SendTime = sendTime + return replay, nil +} + +func modifyMessageByUserMessageReceiveOpt(userID, sourceID string, sessionType int, pb *pbChat.SendMsgReq) bool { + conversationID := utils.GetConversationIDBySessionType(sourceID, sessionType) + opt, err := db.DB.GetSingleConversationMsgOpt(userID, conversationID) + if err != nil || err != redis.ErrNil { + log.NewError(pb.OperationID, "GetSingleConversationMsgOpt from redis err", conversationID, pb.String(), err.Error()) + return true + } + switch opt { + case constant.ReceiveMessage: + return true + case constant.NotReceiveMessage: + return false + case constant.ReceiveNotNotifyMessage: + if pb.MsgData.Options == nil { + pb.MsgData.Options = make(map[string]bool, 10) + } + utils.SetSwitchFromOptions(pb.MsgData.Options, constant.IsOfflinePush, false) + return true + } + + return true +} + +type NotificationMsg struct { + SendID string + RecvID string + Content []byte // open_im_sdk.TipsComm + MsgFrom int32 + ContentType int32 + SessionType int32 + OperationID string +} + +func Notification(n *NotificationMsg) { + return + var req pbChat.SendMsgReq + var msg sdk_ws.MsgData + var offlineInfo sdk_ws.OfflinePushInfo + var title, desc, ex string + var pushSwitch bool + req.OperationID = n.OperationID + msg.SendID = n.SendID + msg.RecvID = n.RecvID + msg.Content = n.Content + msg.MsgFrom = n.MsgFrom + msg.ContentType = n.ContentType + msg.SessionType = n.SessionType + msg.CreateTime = utils.GetCurrentTimestampByMill() + msg.ClientMsgID = utils.GetMsgID(n.SendID) + switch n.SessionType { + case constant.GroupChatType: + msg.RecvID = "" + msg.GroupID = n.RecvID + } + if true { + msg.Options = make(map[string]bool, 10) + //utils.SetSwitchFromOptions(msg.Options, constant.IsOfflinePush, false) + utils.SetSwitchFromOptions(msg.Options, constant.IsHistory, false) + utils.SetSwitchFromOptions(msg.Options, constant.IsPersistent, false) + } + offlineInfo.IOSBadgeCount = config.Config.IOSPush.BadgeCount + offlineInfo.IOSPushSound = config.Config.IOSPush.PushSound + //switch msg.ContentType { + //case constant.GroupCreatedNotification: + // pushSwitch = config.Config.Notification.GroupCreated.OfflinePush.PushSwitch + // title = config.Config.Notification.GroupCreated.OfflinePush.Title + // desc = config.Config.Notification.GroupCreated.OfflinePush.Desc + // ex = config.Config.Notification.GroupCreated.OfflinePush.Ext + //case constant.GroupInfoChangedNotification: + // pushSwitch = config.Config.Notification.GroupInfoChanged.OfflinePush.PushSwitch + // title = config.Config.Notification.GroupInfoChanged.OfflinePush.Title + // desc = config.Config.Notification.GroupInfoChanged.OfflinePush.Desc + // ex = config.Config.Notification.GroupInfoChanged.OfflinePush.Ext + //case constant.JoinApplicationNotification: + // pushSwitch = config.Config.Notification.ApplyJoinGroup.OfflinePush.PushSwitch + // title = config.Config.Notification.ApplyJoinGroup.OfflinePush.Title + // desc = config.Config.Notification.ApplyJoinGroup.OfflinePush.Desc + // ex = config.Config.Notification.ApplyJoinGroup.OfflinePush.Ext + //} + utils.SetSwitchFromOptions(msg.Options, constant.IsOfflinePush, pushSwitch) + offlineInfo.Title = title + offlineInfo.Desc = desc + offlineInfo.Ex = ex + msg.OfflinePushInfo = &offlineInfo + req.MsgData = &msg + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) + client := pbChat.NewChatClient(etcdConn) + reply, err := client.SendMsg(context.Background(), &req) + if err != nil { + log.NewError(req.OperationID, "SendMsg rpc failed, ", req.String(), err.Error()) + } else if reply.ErrCode != 0 { + log.NewError(req.OperationID, "SendMsg rpc failed, ", req.String()) + } +} 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 3f9cec00f..000000000 --- a/internal/rpc/user/get_user_info.go +++ /dev/null @@ -1,97 +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 - } - userInfo.Uid = user.UID - userInfo.Icon = user.Icon - userInfo.Name = user.Name - userInfo.Gender = user.Gender - userInfo.Mobile = user.Mobile - userInfo.Birth = user.Birth - userInfo.Email = user.Email - userInfo.Ex = user.Ex - 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 079cb1b44..000000000 --- a/internal/rpc/user/update_user_info.go +++ /dev/null @@ -1,82 +0,0 @@ -package user - -import ( - "Open_IM/internal/push/logic" - "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.ErrorCode != 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 - } - 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..147bf2d86 --- /dev/null +++ b/internal/rpc/user/user.go @@ -0,0 +1,243 @@ +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" + sdkws "Open_IM/pkg/proto/sdk_ws" + 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.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) + userInfo.Birth = uint32(user.Birth.Unix()) + 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.ConversationOptResultList = append(resp.ConversationOptResultList, &pbUser.OptResult{ConversationID: v, Result: req.Opt}) + } + 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.ConversationIDList) + if err != nil { + log.NewError(req.OperationID, "GetMultiConversationMsgOpt failed ", err.Error(), req.FromUserID, req.ConversationIDList) + 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 { + i := imdb.DeleteUser(userID) + if i == 0 { + log.NewError(req.OperationID, "delete user error", userID) + 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) + log.NewDebug(req.OperationID, "from db uid list is:", uidList) + 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 db.User + utils.CopyStructFields(&user, req.UserInfo) + if req.UserInfo.Birth != 0 { + user.Birth = utils.UnixSecondToTime(int64(req.UserInfo.Birth)) + } + 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.UserInfoUpdatedNotification(req.OperationID, req.UserInfo.UserID, v.FriendUser.UserID) + } + chat.UserInfoUpdatedNotification(req.OperationID, req.UserInfo.UserID, req.OpUserID) + return &pbUser.UpdateUserInfoResp{CommonResp: &pbUser.CommonResp{}}, nil +} diff --git a/internal/utils/jwt_token_test.go b/internal/utils/jwt_token_test.go index 2c6550d87..571836d39 100644 --- a/internal/utils/jwt_token_test.go +++ b/internal/utils/jwt_token_test.go @@ -68,7 +68,7 @@ func Test_ParseRedisInterfaceToken(t *testing.T) { config.Config.TokenPolicy.AccessExpire = -80 tokenString, _, _ = token_verify.CreateToken(uid, platform) claims, err = token_verify.ParseRedisInterfaceToken([]uint8(tokenString)) - assert.Equal(t, err, constant.TokenExpired) + assert.Equal(t, err, constant.ExpiredToken) assert.Nil(t, claims) } diff --git a/internal/utils/utils.go b/internal/utils/utils.go new file mode 100644 index 000000000..73ebbf127 --- /dev/null +++ b/internal/utils/utils.go @@ -0,0 +1,49 @@ +package utils + +import ( + "encoding/json" + "github.com/golang/protobuf/jsonpb" + "github.com/golang/protobuf/proto" + "reflect" +) + +func JsonDataList(resp interface{}) []map[string]interface{} { + var list []proto.Message + if reflect.TypeOf(resp).Kind() == reflect.Slice { + s := reflect.ValueOf(resp) + for i := 0; i < s.Len(); i++ { + ele := s.Index(i) + list = append(list, ele.Interface().(proto.Message)) + } + } + + result := make([]map[string]interface{}, 0) + for _, v := range list { + m := ProtoToMap(v, false) + result = append(result, m) + } + return result +} + +func JsonDataOne(pb proto.Message) map[string]interface{} { + return ProtoToMap(pb, false) +} + +func ProtoToMap(pb proto.Message, idFix bool) map[string]interface{} { + marshaler := jsonpb.Marshaler{ + OrigName: true, + EnumsAsInts: false, + EmitDefaults: false, + } + + s, _ := marshaler.MarshalToString(pb) + out := make(map[string]interface{}) + json.Unmarshal([]byte(s), &out) + if idFix { + if _, ok := out["id"]; ok { + out["_id"] = out["id"] + delete(out, "id") + } + } + return out +} diff --git a/pkg/base_info/auth_api_struct.go b/pkg/base_info/auth_api_struct.go new file mode 100644 index 000000000..13d6e140b --- /dev/null +++ b/pkg/base_info/auth_api_struct.go @@ -0,0 +1,39 @@ +package base_info + +//UserID string `protobuf:"bytes,1,opt,name=UserID" json:"UserID,omitempty"` +// Nickname string `protobuf:"bytes,2,opt,name=Nickname" json:"Nickname,omitempty"` +// FaceUrl string `protobuf:"bytes,3,opt,name=FaceUrl" json:"FaceUrl,omitempty"` +// Gender int32 `protobuf:"varint,4,opt,name=Gender" json:"Gender,omitempty"` +// PhoneNumber string `protobuf:"bytes,5,opt,name=PhoneNumber" json:"PhoneNumber,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 UserRegisterReq struct { + Secret string `json:"secret" binding:"required,max=32"` + Platform int32 `json:"platform" binding:"required,min=1,max=7"` + ApiUserInfo + OperationID string `json:"operationID" binding:"required"` +} + +type UserTokenInfo struct { + UserID string `json:"userID"` + Token string `json:"token"` + ExpiredTime int64 `json:"expiredTime"` +} +type UserRegisterResp struct { + CommResp + UserToken UserTokenInfo `json:"data"` +} + +type UserTokenReq struct { + Secret string `json:"secret" binding:"required,max=32"` + Platform int32 `json:"platform" binding:"required,min=1,max=8"` + UserID string `json:"userID" binding:"required,min=1,max=64"` + OperationID string `json:"operationID" binding:"required"` +} + +type UserTokenResp struct { + CommResp + UserToken UserTokenInfo `json:"data"` +} diff --git a/pkg/base_info/conversation_api_struct.go b/pkg/base_info/conversation_api_struct.go new file mode 100644 index 000000000..bd54bafbf --- /dev/null +++ b/pkg/base_info/conversation_api_struct.go @@ -0,0 +1,33 @@ +package base_info + +type OptResult struct { + ConversationID string `json:"conversationID"` + Result *int32 `json:"result"` +} +type GetAllConversationMessageOptReq struct { + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type GetAllConversationMessageOptResp struct { + CommResp + ConversationOptResultList []*OptResult `json:"data"` +} +type GetReceiveMessageOptReq struct { + ConversationIDList []string `json:"conversationIDList" binding:"required"` + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type GetReceiveMessageOptResp struct { + CommResp + ConversationOptResultList []*OptResult `json:"data"` +} +type SetReceiveMessageOptReq struct { + FromUserID string `json:"fromUserID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` + Opt *int32 `json:"opt" binding:"required"` + ConversationIDList []string `json:"conversationIDList" binding:"required"` +} +type SetReceiveMessageOptResp struct { + CommResp + ConversationOptResultList []*OptResult `json:"data"` +} diff --git a/pkg/base_info/cos_api_struct.go b/pkg/base_info/cos_api_struct.go new file mode 100644 index 000000000..41568e480 --- /dev/null +++ b/pkg/base_info/cos_api_struct.go @@ -0,0 +1,18 @@ +package base_info + +import sts "github.com/tencentyun/qcloud-cos-sts-sdk/go" + +type TencentCloudStorageCredentialReq struct { + OperationID string `json:"operationID"` +} + +type TencentCloudStorageCredentialRespData struct { + *sts.CredentialResult + Region string `json:"region"` + Bucket string `json:"bucket"` +} + +type TencentCloudStorageCredentialResp struct { + CommResp + Data TencentCloudStorageCredentialRespData `json:"data"` +} diff --git a/pkg/base_info/friend_api_struct.go b/pkg/base_info/friend_api_struct.go new file mode 100644 index 000000000..64b71b284 --- /dev/null +++ b/pkg/base_info/friend_api_struct.go @@ -0,0 +1,136 @@ +package base_info + +import 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 +} +type AddBlacklistResp struct { + CommResp +} + +type ImportFriendReq struct { + FriendUserIDList []string `json:"friendUserIDList" binding:"required"` + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type UserIDResult struct { + UserID string `json:"userID""` + Result int32 `json:"result"` +} +type ImportFriendResp struct { + CommResp + UserIDResultList []UserIDResult `json:"data"` +} + +type AddFriendReq struct { + ParamsCommFriend + ReqMsg string `json:"reqMsg"` +} +type AddFriendResp struct { + CommResp +} + +type AddFriendResponseReq struct { + ParamsCommFriend + Flag int32 `json:"flag" binding:"required,oneof=-1 0 1"` + HandleMsg string `json:"handleMsg"` +} +type AddFriendResponseResp struct { + CommResp +} + +type DeleteFriendReq struct { + ParamsCommFriend +} +type DeleteFriendResp struct { + CommResp +} + +type GetBlackListReq struct { + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type GetBlackListResp struct { + CommResp + BlackUserInfoList []*open_im_sdk.PublicUserInfo `json:"-"` + Data []map[string]interface{} `json:"data"` +} + +//type PublicUserInfo struct { +// UserID string `json:"userID"` +// Nickname string `json:"nickname"` +// FaceUrl string `json:"faceUrl"` +// Gender int32 `json:"gender"` +//} + +type SetFriendRemarkReq struct { + ParamsCommFriend + Remark string `json:"remark" binding:"required"` +} +type SetFriendRemarkResp struct { + CommResp +} + +type RemoveBlackListReq struct { + ParamsCommFriend +} +type RemoveBlackListResp struct { + CommResp +} + +type IsFriendReq struct { + ParamsCommFriend +} +type Response struct { + Friend bool `json:"isFriend"` +} +type IsFriendResp struct { + CommResp + Response Response `json:"data"` +} + +type GetFriendsInfoReq struct { + ParamsCommFriend +} +type GetFriendsInfoResp struct { + CommResp + FriendInfoList []*open_im_sdk.FriendInfo `json:"-"` + Data []map[string]interface{} `json:"data"` +} + +type GetFriendListReq struct { + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type GetFriendListResp struct { + CommResp + FriendInfoList []*open_im_sdk.FriendInfo `json:"-"` + Data []map[string]interface{} `json:"data"` +} + +type GetFriendApplyListReq struct { + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type GetFriendApplyListResp struct { + CommResp + FriendRequestList []*open_im_sdk.FriendRequest `json:"-"` + Data []map[string]interface{} `json:"data"` +} + +type GetSelfApplyListReq struct { + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type GetSelfApplyListResp struct { + CommResp + FriendRequestList []*open_im_sdk.FriendRequest `json:"-"` + Data []map[string]interface{} `json:"data"` +} diff --git a/pkg/base_info/group_api_struct.go b/pkg/base_info/group_api_struct.go new file mode 100644 index 000000000..dec18fc0b --- /dev/null +++ b/pkg/base_info/group_api_struct.go @@ -0,0 +1,165 @@ +package base_info + +import ( + open_im_sdk "Open_IM/pkg/proto/sdk_ws" +) + +type CommResp struct { + ErrCode int32 `json:"errCode"` + ErrMsg string `json:"errMsg"` +} + +type CommDataResp struct { + CommResp + Data []map[string]interface{} `json:"data"` +} + +type KickGroupMemberReq struct { + GroupID string `json:"groupID" binding:"required"` + KickedUserIDList []string `json:"kickedUserIDList" binding:"required"` + Reason string `json:"reason"` + OperationID string `json:"operationID" binding:"required"` +} +type KickGroupMemberResp struct { + CommResp + UserIDResultList []*UserIDResult `json:"data"` +} + +type GetGroupMembersInfoReq struct { + GroupID string `json:"groupID" binding:"required"` + MemberList []string `json:"memberList" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type GetGroupMembersInfoResp struct { + CommResp + MemberList []*open_im_sdk.GroupMemberFullInfo `json:"-"` + Data []map[string]interface{} `json:"data"` +} + +type InviteUserToGroupReq struct { + GroupID string `json:"groupID" binding:"required"` + InvitedUserIDList []string `json:"invitedUserIDList" binding:"required"` + Reason string `json:"reason"` + OperationID string `json:"operationID" binding:"required"` +} +type InviteUserToGroupResp struct { + CommResp + UserIDResultList []*UserIDResult `json:"data"` +} + +type GetJoinedGroupListReq struct { + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` +} +type GetJoinedGroupListResp struct { + CommResp + GroupInfoList []*open_im_sdk.GroupInfo `json:"-"` + Data []map[string]interface{} `json:"data"` +} + +type GetGroupMemberListReq struct { + GroupID string `json:"groupID"` + Filter int32 `json:"filter"` + NextSeq int32 `json:"nextSeq"` + OperationID string `json:"operationID"` +} +type GetGroupMemberListResp struct { + CommResp + NextSeq int32 `json:"nextSeq"` + MemberList []*open_im_sdk.GroupMemberFullInfo `json:"-"` + Data []map[string]interface{} `json:"data"` +} + +type GetGroupAllMemberReq struct { + GroupID string `json:"groupID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type GetGroupAllMemberResp struct { + CommResp + MemberList []*open_im_sdk.GroupMemberFullInfo `json:"-"` + Data []map[string]interface{} `json:"data"` +} + +type CreateGroupReq struct { + MemberList []*GroupAddMemberInfo `json:"memberList" binding:"required"` + OwnerUserID string `json:"ownerUserID" binding:"required"` + GroupName string `json:"groupName"` + GroupType int32 `json:"groupType"` + OperationID string `json:"operationID" binding:"required"` +} +type CreateGroupResp struct { + CommResp + GroupInfo open_im_sdk.GroupInfo `json:"-"` + Data map[string]interface{} `json:"data"` +} + +type GetGroupApplicationListReq struct { + OperationID string `json:"operationID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` //作为管理员或群主收到的 进群申请 +} +type GetGroupApplicationListResp struct { + CommResp + GroupRequestList []*open_im_sdk.GroupRequest `json:"-"` + Data []map[string]interface{} `json:"data"` +} + +type GetGroupInfoReq struct { + GroupIDList []string `json:"groupIDList" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type GetGroupInfoResp struct { + CommResp + GroupInfoList []*open_im_sdk.GroupInfo `json:"-"` + Data []map[string]interface{} `json:"data"` +} + +type ApplicationGroupResponseReq struct { + OperationID string `json:"operationID" binding:"required"` + GroupID string `json:"groupID" binding:"required"` + FromUserID string `json:"fromUserID" binding:"required"` //application from FromUserID + HandledMsg string `json:"handledMsg"` + HandleResult int32 `json:"handleResult" binding:"required,oneof=-1 1"` +} +type ApplicationGroupResponseResp struct { + CommResp +} + +type JoinGroupReq struct { + GroupID string `json:"groupID" binding:"required"` + ReqMessage string `json:"reqMessage"` + OperationID string `json:"operationID" binding:"required"` +} +type JoinGroupResp struct { + CommResp +} + +type QuitGroupReq struct { + GroupID string `json:"groupID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type QuitGroupResp struct { + CommResp +} + +type SetGroupInfoReq struct { + GroupID string `json:"groupID" binding:"required"` + GroupName string `json:"groupName"` + Notification string `json:"notification"` + Introduction string `json:"introduction"` + FaceURL string `json:"faceURL"` + Ex string `json:"ex"` + OperationID string `json:"operationID" binding:"required"` +} +type SetGroupInfoResp struct { + CommResp +} + +type TransferGroupOwnerReq struct { + GroupID string `json:"groupID" binding:"required"` + OldOwnerUserID string `json:"oldOwnerUserID" binding:"required"` + NewOwnerUserID string `json:"newOwnerUserID" binding:"required"` + OperationID string `json:"operationID" binding:"required"` +} +type TransferGroupOwnerResp struct { + CommResp +} diff --git a/pkg/base_info/manage_api_struct.go b/pkg/base_info/manage_api_struct.go new file mode 100644 index 000000000..61e2bbba4 --- /dev/null +++ b/pkg/base_info/manage_api_struct.go @@ -0,0 +1,38 @@ +package base_info + +import ( + pbRelay "Open_IM/pkg/proto/relay" + pbUser "Open_IM/pkg/proto/user" +) + +type DeleteUsersReq struct { + OperationID string `json:"operationID" binding:"required"` + DeleteUserIDList []string `json:"deleteUserIDList" binding:"required"` +} +type DeleteUsersResp struct { + CommResp + FailedUserIDList []string `json:"data"` +} +type GetAllUsersUidReq struct { + OperationID string `json:"operationID" binding:"required"` +} +type GetAllUsersUidResp struct { + CommResp + UserIDList []string `json:"data"` +} +type GetUsersOnlineStatusReq struct { + OperationID string `json:"operationID" binding:"required"` + UserIDList []string `json:"userIDList" binding:"required,lte=200"` +} +type GetUsersOnlineStatusResp struct { + CommResp + SuccessResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult `json:"data"` +} +type AccountCheckReq struct { + OperationID string `json:"operationID" binding:"required"` + CheckUserIDList []string `json:"checkUserIDList" binding:"required,lte=100"` +} +type AccountCheckResp struct { + CommResp + ResultList []*pbUser.AccountCheckResp_SingleUserStatus `json:"data"` +} diff --git a/pkg/base_info/public_struct.go b/pkg/base_info/public_struct.go new file mode 100644 index 000000000..1e60ae294 --- /dev/null +++ b/pkg/base_info/public_struct.go @@ -0,0 +1,125 @@ +package base_info + +import ( + "github.com/gin-gonic/gin" + "net/http" +) + +type ApiUserInfo struct { + UserID string `json:"userID" binding:"required,min=1,max=64"` + Nickname string `json:"nickname" binding:"omitempty,min=1,max=64"` + FaceURL string `json:"faceURL" binding:"omitempty,max=1024"` + Gender int32 `json:"gender" binding:"omitempty,oneof=0 1 2"` + PhoneNumber string `json:"phoneNumber" binding:"omitempty,max=32"` + Birth uint32 `json:"birth" binding:"omitempty"` + Email string `json:"email" binding:"omitempty,max=64"` + Ex string `json:"ex" binding:"omitempty,max=1024"` +} + +type GroupAddMemberInfo struct { + UserID string `json:"userID" binding:"required"` + RoleLevel int32 `json:"roleLevel" binding:"required"` +} + +func SetErrCodeMsg(c *gin.Context, status int) *CommResp { + resp := CommResp{ErrCode: int32(status), ErrMsg: http.StatusText(status)} + c.JSON(status, resp) + return &resp +} + +//GroupName string `json:"groupName"` +// Introduction string `json:"introduction"` +// Notification string `json:"notification"` +// FaceUrl string `json:"faceUrl"` +// OperationID string `json:"operationID" binding:"required"` +// GroupType int32 `json:"groupType"` +// Ex string `json:"ex"` + +//type GroupInfo struct { +// GroupID string `json:"groupID"` +// GroupName string `json:"groupName"` +// Notification string `json:"notification"` +// Introduction string `json:"introduction"` +// FaceUrl string `json:"faceUrl"` +// OwnerUserID string `json:"ownerUserID"` +// Ex string `json:"ex"` +// GroupType int32 `json:"groupType"` +//} + +//type GroupMemberFullInfo struct { +// GroupID string `json:"groupID"` +// UserID string `json:"userID"` +// RoleLevel int32 `json:"roleLevel"` +// JoinTime uint64 `json:"joinTime"` +// Nickname string `json:"nickname"` +// FaceUrl string `json:"faceUrl"` +// FriendRemark string `json:"friendRemark"` +// AppMangerLevel int32 `json:"appMangerLevel"` +// JoinSource int32 `json:"joinSource"` +// OperatorUserID string `json:"operatorUserID"` +// Ex string `json:"ex"` +//} +// +//type PublicUserInfo struct { +// UserID string `json:"userID"` +// Nickname string `json:"nickname"` +// FaceUrl string `json:"faceUrl"` +// Gender int32 `json:"gender"` +//} +// +//type UserInfo struct { +// UserID string `json:"userID"` +// Nickname string `json:"nickname"` +// FaceUrl string `json:"faceUrl"` +// Gender int32 `json:"gender"` +// Mobile string `json:"mobile"` +// Birth string `json:"birth"` +// Email string `json:"email"` +// Ex string `json:"ex"` +//} +// +//type FriendInfo struct { +// OwnerUserID string `json:"ownerUserID"` +// Remark string `json:"remark"` +// CreateTime int64 `json:"createTime"` +// FriendUser UserInfo `json:"friendUser"` +// AddSource int32 `json:"addSource"` +// OperatorUserID string `json:"operatorUserID"` +// Ex string `json:"ex"` +//} +// +//type BlackInfo struct { +// OwnerUserID string `json:"ownerUserID"` +// CreateTime int64 `json:"createTime"` +// BlackUser PublicUserInfo `json:"friendUser"` +// AddSource int32 `json:"addSource"` +// OperatorUserID string `json:"operatorUserID"` +// Ex string `json:"ex"` +//} +// +//type GroupRequest struct { +// UserID string `json:"userID"` +// GroupID string `json:"groupID"` +// HandleResult string `json:"handleResult"` +// ReqMsg string `json:"reqMsg"` +// HandleMsg string `json:"handleMsg"` +// ReqTime int64 `json:"reqTime"` +// HandleUserID string `json:"handleUserID"` +// HandleTime int64 `json:"handleTime"` +// Ex string `json:"ex"` +//} +// +//type FriendRequest struct { +// FromUserID string `json:"fromUserID"` +// ToUserID string `json:"toUserID"` +// HandleResult int32 `json:"handleResult"` +// ReqMessage string `json:"reqMessage"` +// CreateTime int64 `json:"createTime"` +// HandlerUserID string `json:"handlerUserID"` +// HandleMsg string `json:"handleMsg"` +// HandleTime int64 `json:"handleTime"` +// Ex string `json:"ex"` +//} +// +// +// diff --git a/pkg/base_info/user_api_struct.go b/pkg/base_info/user_api_struct.go new file mode 100644 index 000000000..f4be785f2 --- /dev/null +++ b/pkg/base_info/user_api_struct.go @@ -0,0 +1,34 @@ +package base_info + +import ( + open_im_sdk "Open_IM/pkg/proto/sdk_ws" +) + +type GetUsersInfoReq struct { + OperationID string `json:"operationID" binding:"required"` + UserIDList []string `json:"userIDList" binding:"required"` +} +type GetUsersInfoResp struct { + CommResp + UserInfoList []*open_im_sdk.PublicUserInfo + Data []map[string]interface{} `json:"data"` +} + +type UpdateSelfUserInfoReq struct { + ApiUserInfo + OperationID string `json:"operationID" binding:"required"` +} + +type UpdateUserInfoResp struct { + CommResp +} + +type GetSelfUserInfoReq struct { + OperationID string `json:"operationID" binding:"required"` + UserID string `json:"userID" binding:"required"` +} +type GetSelfUserInfoResp struct { + CommResp + UserInfo *open_im_sdk.UserInfo `json:"-"` + Data map[string]interface{} `json:"data"` +} diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go index 80dd04ead..2e6870557 100644 --- a/pkg/common/config/config.go +++ b/pkg/common/config/config.go @@ -159,6 +159,123 @@ type config struct { CallbackUrl string `yaml:"callbackUrl"` CallBackTimeOut int `yaml:"callbackTimeOut"` } + IOSPush struct { + PushSound string `yaml:"pushSound"` + BadgeCount bool `yaml:"badgeCount"` + } + Notification struct { + ///////////////////////group///////////////////////////// + GroupCreated struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } + + GroupInfoSet struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } + + JoinGroupApplication struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } + + MemberQuit struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } + + GroupApplicationAccepted struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } + + GroupApplicationRejected struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } + + GroupOwnerTransferred struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } + + MemberKicked struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } + + MemberInvited struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } + + MemberEnter struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } + ////////////////////////user/////////////////////// + UserInfoUpdated struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } + + //////////////////////friend/////////////////////// + FriendApplication struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } + FriendApplicationApproved struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } + + FriendApplicationRejected struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } + + FriendAdded struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } + + FriendDeleted struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } + FriendRemarkSet struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } + BlackAdded struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } + BlackDeleted struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } + } Demo struct { Port []int `yaml:"openImDemoPort"` AliSMSVerify struct { @@ -176,32 +293,20 @@ type config struct { SmtpPort int `yaml:"smtpPort"` } } - //notification: - // groupCreated: - // offlinePush: - // switch: true - // title: "create group title" - // desc: "create group desc" - // ext: "create group ext" - // defaultTips: - // tips: "create the group" # xx create the group - // conversationChanged: 1 - // +} +type PConversation struct { + ReliabilityLevel int `yaml:"reliabilityLevel"` + UnreadCount bool `yaml:"unreadCount"` +} - Notification struct { - GroupCreated struct { - OfflinePush struct { - Switch bool `yaml:"switch"` - Title string `yaml:"title"` - Desc string `yaml:"desc"` - Ext string `yaml:"ext"` - } - DefaultTips struct { - GroupCreatedTips string `yaml:"croupCreatedTips"` - GroupInfoChangedTips string `yaml:"groupInfoChangedTips"` - } - } - } +type POfflinePush struct { + PushSwitch bool `yaml:"switch"` + Title string `yaml:"title"` + Desc string `yaml:"desc"` + Ext string `yaml:"ext"` +} +type PDefaultTips struct { + Tips string `yaml:"tips"` } func init() { @@ -227,5 +332,5 @@ func init() { if err = yaml.Unmarshal(bytes, &Config); err != nil { panic(err.Error()) } - fmt.Println("init load config: ", Config) + fmt.Println("load config: ", Config) } diff --git a/pkg/common/constant/constant.go b/pkg/common/constant/constant.go index c00b98c7d..6e32cea2e 100644 --- a/pkg/common/constant/constant.go +++ b/pkg/common/constant/constant.go @@ -3,14 +3,14 @@ package constant const ( //group admin - OrdinaryMember = 0 - GroupOwner = 1 - Administrator = 2 + // OrdinaryMember = 0 + // GroupOwner = 1 + // Administrator = 2 //group application - Application = 0 - AgreeApplication = 1 + // Application = 0 + // AgreeApplication = 1 - //feiend related + //friend related BlackListFlag = 1 ApplicationFriendFlag = 0 FriendFlag = 1 @@ -18,9 +18,8 @@ const ( //Websocket Protocol WSGetNewestSeq = 1001 - WSPullMsg = 1002 + WSPullMsgBySeqList = 1002 WSSendMsg = 1003 - WSPullMsgBySeqList = 1004 WSPushMsg = 2001 WSKickOnlineMsg = 2002 WSDataError = 3001 @@ -37,6 +36,7 @@ const ( Card = 108 Location = 109 Custom = 110 + Revoke = 111 HasReadReceipt = 112 Typing = 113 Quote = 114 @@ -44,23 +44,28 @@ const ( GroupMsg = 201 //SysRelated - AcceptFriendApplicationTip = 201 - AddFriendTip = 202 - RefuseFriendApplicationTip = 203 - SetSelfInfoTip = 204 - Revoke = 205 - C2CMessageAsRead = 206 - TransferGroupOwnerTip = 501 - CreateGroupTip = 502 - GroupApplicationResponseTip = 503 - JoinGroupTip = 504 - QuitGroupTip = 505 - SetGroupInfoTip = 506 - AcceptGroupApplicationTip = 507 - RefuseGroupApplicationTip = 508 - KickGroupMemberTip = 509 - InviteUserToGroupTip = 510 + FriendApplicationApprovedNotification = 1201 //add_friend_response + FriendApplicationRejectedNotification = 1202 //add_friend_response + FriendApplicationNotification = 1203 //add_friend + FriendAddedNotification = 1204 + FriendDeletedNotification = 1205 //delete_friend + FriendRemarkSetNotification = 1206 //set_friend_remark? + BlackAddedNotification = 1207 //add_black + BlackDeletedNotification = 1208 //remove_black + + UserInfoUpdatedNotification = 1303 //SetSelfInfoTip = 204 + + GroupCreatedNotification = 1501 + GroupInfoSetNotification = 1502 + JoinGroupApplicationNotification = 1503 + MemberQuitNotification = 1504 + GroupApplicationAcceptedNotification = 1505 + GroupApplicationRejectedNotification = 1506 + GroupOwnerTransferredNotification = 1507 + MemberKickedNotification = 1508 + MemberInvitedNotification = 1509 + MemberEnterNotification = 1510 //MsgFrom UserMsgType = 100 @@ -76,13 +81,13 @@ const ( ExpiredToken = 3 //MultiTerminalLogin - //全端登录,但是同端互斥 + //Full-end login, but the same end is mutually exclusive AllLoginButSameTermKick = 1 - //所有端中只能有一端能够登录 + //Only one of the endpoints can log in SingleTerminalLogin = 2 - //web端可以同时在线,其他端只能有一端登录 + //The web side can be online at the same time, and the other side can only log in at one end WebAndOther = 3 - //Pc端互斥,移动端互斥,但是web端可以同时在线 + //The PC side is mutually exclusive, and the mobile side is mutually exclusive, but the web side can be online at the same time PcMobileAndWeb = 4 OnlineStatus = "online" @@ -94,6 +99,14 @@ const ( ReceiveMessage = 0 NotReceiveMessage = 1 ReceiveNotNotifyMessage = 2 + + //OptionsKey + IsHistory = "history" + IsPersistent = "persistent" + IsOfflinePush = "offlinePush" + IsUnreadCount = "unreadCount" + IsConversationUpdate = "conversationUpdate" + IsSenderSync = "senderSync" ) var ContentType2PushContent = map[int64]string{ @@ -107,4 +120,22 @@ var ContentType2PushContent = map[int64]string{ Common: "你收到一条新消息", } +const ( + AppOrdinaryUsers = 1 + AppAdmin = 2 + + GroupOrdinaryUsers = 1 + GroupOwner = 2 + GroupAdmin = 3 + + GroupResponseAgree = 1 + GroupResponseRefuse = -1 + + FriendResponseAgree = 1 + FriendResponseRefuse = -1 + + Male = 1 + Female = 2 +) + const FriendAcceptTip = "You have successfully become friends, so start chatting" diff --git a/pkg/common/constant/error.go b/pkg/common/constant/error.go index 7541a784e..6df403140 100644 --- a/pkg/common/constant/error.go +++ b/pkg/common/constant/error.go @@ -11,53 +11,60 @@ type ErrInfo struct { var ( OK = ErrInfo{0, ""} - ErrMysql = ErrInfo{100, ""} - ErrMongo = ErrInfo{110, ""} - ErrRedis = ErrInfo{120, ""} - ErrParseToken = ErrInfo{200, "Parse token failed"} - ErrCreateToken = ErrInfo{201, "Create token failed"} - ErrAppServerKey = ErrInfo{300, "key error"} - ErrTencentCredential = ErrInfo{400, ""} + // ErrMysql = ErrInfo{100, ""} + // ErrMongo = ErrInfo{110, ""} + // ErrRedis = ErrInfo{120, ""} + ErrParseToken = ErrInfo{200, ParseTokenMsg.Error()} + // ErrCreateToken = ErrInfo{201, "Create token failed"} + // ErrAppServerKey = ErrInfo{300, "key error"} + ErrTencentCredential = ErrInfo{400, ThirdPartyMsg.Error()} - ErrorUserRegister = ErrInfo{600, "User registration failed"} - ErrAccountExists = ErrInfo{601, "The account is already registered and cannot be registered again"} - ErrUserPassword = ErrInfo{602, "User password error"} - ErrRefreshToken = ErrInfo{605, "Failed to refresh token"} - ErrAddFriend = ErrInfo{606, "Failed to add friends"} - ErrAgreeToAddFriend = ErrInfo{607, "Failed to agree application"} - ErrAddFriendToBlack = ErrInfo{608, "Failed to add friends to the blacklist"} - ErrGetBlackList = ErrInfo{609, "Failed to get blacklist"} - ErrDeleteFriend = ErrInfo{610, "Failed to delete friend"} - ErrGetFriendApplyList = ErrInfo{611, "Failed to get friend application list"} - ErrGetFriendList = ErrInfo{612, "Failed to get friend list"} - ErrRemoveBlackList = ErrInfo{613, "Failed to remove blacklist"} - ErrSearchUserInfo = ErrInfo{614, "Can't find the user information"} - ErrDelAppleDeviceToken = ErrInfo{615, ""} - ErrModifyUserInfo = ErrInfo{616, "update user some attribute failed"} - ErrSetFriendComment = ErrInfo{617, "set friend comment failed"} - ErrSearchUserInfoFromTheGroup = ErrInfo{618, "There is no such group or the user not in the group"} - ErrCreateGroup = ErrInfo{619, "create group chat failed"} - ErrJoinGroupApplication = ErrInfo{620, "Failed to apply to join the group"} - ErrQuitGroup = ErrInfo{621, "Failed to quit the group"} - ErrSetGroupInfo = ErrInfo{622, "Failed to set group info"} - ErrParam = ErrInfo{700, "param failed"} - ErrTokenExpired = ErrInfo{701, TokenExpired.Error()} - ErrTokenInvalid = ErrInfo{702, TokenInvalid.Error()} - ErrTokenMalformed = ErrInfo{703, TokenMalformed.Error()} - ErrTokenNotValidYet = ErrInfo{704, TokenNotValidYet.Error()} - ErrTokenUnknown = ErrInfo{705, TokenUnknown.Error()} + // ErrorUserRegister = ErrInfo{600, "User registration failed"} + // ErrAccountExists = ErrInfo{601, "The account is already registered and cannot be registered again"} + // ErrUserPassword = ErrInfo{602, "User password error"} + // ErrRefreshToken = ErrInfo{605, "Failed to refresh token"} + // ErrAddFriend = ErrInfo{606, "Failed to add friends"} + // ErrAgreeToAddFriend = ErrInfo{607, "Failed to agree application"} + // ErrAddFriendToBlack = ErrInfo{608, "Failed to add friends to the blacklist"} + // ErrGetBlackList = ErrInfo{609, "Failed to get blacklist"} + // ErrDeleteFriend = ErrInfo{610, "Failed to delete friend"} + // ErrGetFriendApplyList = ErrInfo{611, "Failed to get friend application list"} + // ErrGetFriendList = ErrInfo{612, "Failed to get friend list"} + // ErrRemoveBlackList = ErrInfo{613, "Failed to remove blacklist"} + // ErrSearchUserInfo = ErrInfo{614, "Can't find the user information"} + // ErrDelAppleDeviceToken = ErrInfo{615, ""} + // ErrModifyUserInfo = ErrInfo{616, "update user some attribute failed"} + // ErrSetFriendComment = ErrInfo{617, "set friend comment failed"} + // ErrSearchUserInfoFromTheGroup = ErrInfo{618, "There is no such group or the user not in the group"} + // ErrCreateGroup = ErrInfo{619, "create group chat failed"} + // ErrJoinGroupApplication = ErrInfo{620, "Failed to apply to join the group"} + // ErrQuitGroup = ErrInfo{621, "Failed to quit the group"} + // ErrSetGroupInfo = ErrInfo{622, "Failed to set group info"} + // ErrParam = ErrInfo{700, "param failed"} + ErrTokenExpired = ErrInfo{701, TokenExpiredMsg.Error()} + ErrTokenInvalid = ErrInfo{702, TokenInvalidMsg.Error()} + ErrTokenMalformed = ErrInfo{703, TokenMalformedMsg.Error()} + ErrTokenNotValidYet = ErrInfo{704, TokenNotValidYetMsg.Error()} + ErrTokenUnknown = ErrInfo{705, TokenUnknownMsg.Error()} - ErrAccess = ErrInfo{ErrCode: 800, ErrMsg: "no permission"} - - ErrDb = ErrInfo{ErrCode: 900, ErrMsg: "db failed"} + ErrAccess = ErrInfo{ErrCode: 801, ErrMsg: AccessMsg.Error()} + ErrDB = ErrInfo{ErrCode: 802, ErrMsg: DBMsg.Error()} + ErrArgs = ErrInfo{ErrCode: 8003, ErrMsg: ArgsMsg.Error()} ) var ( - TokenExpired = errors.New("token is timed out, please log in again") - TokenInvalid = errors.New("token has been invalidated") - TokenNotValidYet = errors.New("token not active yet") - TokenMalformed = errors.New("that's not even a token") - TokenUnknown = errors.New("couldn't handle this token") + ParseTokenMsg = errors.New("parse token failed") + TokenExpiredMsg = errors.New("token is timed out, please log in again") + TokenInvalidMsg = errors.New("token has been invalidated") + TokenNotValidYetMsg = errors.New("token not active yet") + TokenMalformedMsg = errors.New("that's not even a token") + TokenUnknownMsg = errors.New("couldn't handle this token") + + AccessMsg = errors.New("no permission") + DBMsg = errors.New("db failed") + ArgsMsg = errors.New("args failed") + + ThirdPartyMsg = errors.New("third party error") ) const ( @@ -67,7 +74,7 @@ const ( LogicalError = 10003 ServerError = 10004 HttpError = 10005 - IoErrot = 10006 + IoError = 10006 IntentionalError = 10007 ) diff --git a/pkg/common/db/model_struct.go b/pkg/common/db/model_struct.go new file mode 100644 index 000000000..eabc26668 --- /dev/null +++ b/pkg/common/db/model_struct.go @@ -0,0 +1,186 @@ +package db + +import "time" + +// +//message FriendInfo{ +//string OwnerUserID = 1; +//string Remark = 2; +//int64 CreateTime = 3; +//UserInfo FriendUser = 4; +//int32 AddSource = 5; +//string OperatorUserID = 6; +//string Ex = 7; +//} +//open_im_sdk.FriendInfo(FriendUser) != imdb.Friend(FriendUserID) +type Friend struct { + OwnerUserID string `gorm:"column:owner_user_id;primary_key;size:64"` + FriendUserID string `gorm:"column:friend_user_id;primary_key;size:64"` + Remark string `gorm:"column:remark;size:255"` + CreateTime time.Time `gorm:"column:create_time"` + AddSource int32 `gorm:"column:add_source"` + OperatorUserID string `gorm:"column:operator_user_id;size:64"` + Ex string `gorm:"column:ex;size:1024"` +} + +//message FriendRequest{ +//string FromUserID = 1; +//string ToUserID = 2; +//int32 HandleResult = 3; +//string ReqMsg = 4; +//int64 CreateTime = 5; +//string HandlerUserID = 6; +//string HandleMsg = 7; +//int64 HandleTime = 8; +//string Ex = 9; +//} +//open_im_sdk.FriendRequest(nickname, farce url ...) != imdb.FriendRequest +type FriendRequest struct { + FromUserID string `gorm:"column:from_user_id;primary_key;size:64"` + ToUserID string `gorm:"column:to_user_id;primary_key;size:64"` + HandleResult int32 `gorm:"column:handle_result"` + ReqMsg string `gorm:"column:req_msg;size:255"` + CreateTime time.Time `gorm:"column:create_time"` + HandlerUserID string `gorm:"column:handler_user_id;size:64"` + HandleMsg string `gorm:"column:handle_msg;size:255"` + HandleTime time.Time `gorm:"column:handle_time"` + Ex string `gorm:"column:ex;size:1024"` +} + +//message GroupInfo{ +// string GroupID = 1; +// string GroupName = 2; +// string Notification = 3; +// string Introduction = 4; +// string FaceUrl = 5; +// string OwnerUserID = 6; +// uint32 MemberCount = 8; +// int64 CreateTime = 7; +// string Ex = 9; +// int32 Status = 10; +// string CreatorUserID = 11; +// int32 GroupType = 12; +//} +// open_im_sdk.GroupInfo (OwnerUserID , MemberCount )> imdb.Group +type Group struct { + //`json:"operationID" binding:"required"` + //`protobuf:"bytes,1,opt,name=GroupID" json:"GroupID,omitempty"` `json:"operationID" binding:"required"` + GroupID string `gorm:"column:group_id;primary_key;size:64" json:"groupID" binding:"required"` + GroupName string `gorm:"column:name;size:255" json:"groupName"` + Notification string `gorm:"column:notification;size:255" json:"notification"` + Introduction string `gorm:"column:introduction;size:255" json:"introduction"` + FaceUrl string `gorm:"column:face_url;size:255" json:"faceUrl"` + CreateTime time.Time `gorm:"column:create_time"` + Ex string `gorm:"column:ex" json:"ex;size:1024" json:"ex"` + Status int32 `gorm:"column:status"` + CreatorUserID string `gorm:"column:creator_user_id;size:64"` + GroupType int32 `gorm:"column:group_type"` +} + +//message GroupMemberFullInfo { +//string GroupID = 1 ; +//string UserID = 2 ; +//int32 roleLevel = 3; +//int64 JoinTime = 4; +//string NickName = 5; +//string FaceUrl = 6; +//int32 JoinSource = 8; +//string OperatorUserID = 9; +//string Ex = 10; +//int32 AppMangerLevel = 7; //if >0 +//} open_im_sdk.GroupMemberFullInfo(AppMangerLevel) > imdb.GroupMember +type GroupMember struct { + GroupID string `gorm:"column:group_id;primary_key;size:64"` + UserID string `gorm:"column:user_id;primary_key;size:64"` + Nickname string `gorm:"column:nickname;size:255"` + FaceUrl string `gorm:"column:user_group_face_url;size:255"` + RoleLevel int32 `gorm:"column:role_level"` + JoinTime time.Time `gorm:"column:join_time"` + JoinSource int32 `gorm:"column:join_source"` + OperatorUserID string `gorm:"column:operator_user_id;size:64"` + Ex string `gorm:"column:ex;size:1024"` +} + +//message GroupRequest{ +//string UserID = 1; +//string GroupID = 2; +//string HandleResult = 3; +//string ReqMsg = 4; +//string HandleMsg = 5; +//int64 ReqTime = 6; +//string HandleUserID = 7; +//int64 HandleTime = 8; +//string Ex = 9; +//}open_im_sdk.GroupRequest == imdb.GroupRequest +type GroupRequest struct { + UserID string `gorm:"column:user_id;primary_key;size:64"` + GroupID string `gorm:"column:group_id;primary_key;size:64"` + HandleResult int32 `gorm:"column:handle_result"` + ReqMsg string `gorm:"column:req_msg;size:1024"` + HandledMsg string `gorm:"column:handle_msg;size:1024"` + ReqTime time.Time `gorm:"column:req_time"` + HandleUserID string `gorm:"column:handle_user_id;size:64"` + HandledTime time.Time `gorm:"column:handle_time"` + Ex string `gorm:"column:ex;size:1024"` +} + +//string UserID = 1; +//string Nickname = 2; +//string FaceUrl = 3; +//int32 Gender = 4; +//string PhoneNumber = 5; +//string Birth = 6; +//string Email = 7; +//string Ex = 8; +//int64 CreateTime = 9; +//int32 AppMangerLevel = 10; +//open_im_sdk.User == imdb.User +type User struct { + UserID string `gorm:"column:user_id;primary_key;size:64"` + Nickname string `gorm:"column:name;size:255"` + FaceURL string `gorm:"column:face_url;size:255"` + Gender int32 `gorm:"column:gender"` + PhoneNumber string `gorm:"column:phone_number;size:32"` + Birth time.Time `gorm:"column:birth"` + Email string `gorm:"column:email;size:64"` + Ex string `gorm:"column:ex;size:1024"` + CreateTime time.Time `gorm:"column:create_time"` + AppMangerLevel int32 `gorm:"column:app_manger_level"` +} + +//message BlackInfo{ +//string OwnerUserID = 1; +//int64 CreateTime = 2; +//PublicUserInfo BlackUserInfo = 4; +//int32 AddSource = 5; +//string OperatorUserID = 6; +//string Ex = 7; +//} +// open_im_sdk.BlackInfo(BlackUserInfo) != imdb.Black (BlockUserID) +type Black struct { + OwnerUserID string `gorm:"column:owner_user_id;primary_key;size:64"` + BlockUserID string `gorm:"column:block_user_id;primary_key;size:64"` + CreateTime time.Time `gorm:"column:create_time"` + AddSource int32 `gorm:"column:add_source"` + OperatorUserID string `gorm:"column:operator_user_id;size:64"` + Ex string `gorm:"column:ex;size:1024"` +} + +type ChatLog struct { + ServerMsgID string `gorm:"column:server_msg_id;primary_key;type:char(64)" json:"serverMsgID"` + ClientMsgID string `gorm:"column:client_msg_id;type:char(64)" json:"clientMsgID"` + SendID string `gorm:"column:send_id;type:char(64)" json:"sendID"` + RecvID string `gorm:"column:recv_id;type:char(64)" json:"recvID"` + SenderPlatformID int32 `gorm:"column:sender_platform_id" json:"senderPlatformID"` + SenderNickname string `gorm:"column:sender_nick_name;type:varchar(255)" json:"senderNickname"` + SenderFaceURL string `gorm:"column:sender_face_url;type:varchar(255)" json:"senderFaceURL"` + SessionType int32 `gorm:"column:session_type" json:"sessionType"` + MsgFrom int32 `gorm:"column:msg_from" json:"msgFrom"` + ContentType int32 `gorm:"column:content_type" json:"contentType"` + Content string `gorm:"column:content;type:varchar(1000)" json:"content"` + Status int32 `gorm:"column:status" json:"status"` + Seq uint32 `gorm:"column:seq;index:index_seq;default:0" json:"seq"` + SendTime time.Time `gorm:"column:send_time" json:"sendTime"` + CreateTime time.Time `gorm:"column:create_time" json:"createTime"` + Ex string `gorm:"column:ex;type:varchar(1024)" json:"ex"` +} diff --git a/pkg/common/db/mongoModel.go b/pkg/common/db/mongoModel.go index 4137616ea..98318dd65 100644 --- a/pkg/common/db/mongoModel.go +++ b/pkg/common/db/mongoModel.go @@ -2,9 +2,10 @@ package db import ( "Open_IM/pkg/common/config" - "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" pbMsg "Open_IM/pkg/proto/chat" + open_im_sdk "Open_IM/pkg/proto/sdk_ws" + "Open_IM/pkg/utils" "errors" "github.com/garyburd/redigo/redis" "github.com/golang/protobuf/proto" @@ -13,7 +14,7 @@ import ( "time" ) -const cChat = "chat" +const cChat = "msg" const cGroup = "group" const singleGocMsgNum = 5000 @@ -27,69 +28,13 @@ type UserChat struct { Msg []MsgInfo } -type GroupMember struct { +type GroupMember_x struct { GroupID string UIDList []string } -func (d *DataBases) GetMsgBySeqRange(uid string, seqBegin, seqEnd int64) (SingleMsg []*pbMsg.MsgFormat, GroupMsg []*pbMsg.MsgFormat, MaxSeq int64, MinSeq int64, err error) { - var count int64 - session := d.mgoSession.Clone() - if session == nil { - return nil, nil, MaxSeq, MinSeq, errors.New("session == nil") - } - defer session.Close() - - c := session.DB(config.Config.Mongo.DBDatabase).C(cChat) - - sChat := UserChat{} - if err = c.Find(bson.M{"uid": uid}).One(&sChat); err != nil { - return nil, nil, MaxSeq, MinSeq, err - } - pChat := pbMsg.MsgSvrToPushSvrChatMsg{} - for i := 0; i < len(sChat.Msg); i++ { - temp := new(pbMsg.MsgFormat) - if err = proto.Unmarshal(sChat.Msg[i].Msg, &pChat); err != nil { - return nil, nil, MaxSeq, MinSeq, err - } - if pChat.RecvSeq >= seqBegin && pChat.RecvSeq <= seqEnd { - temp.SendID = pChat.SendID - temp.RecvID = pChat.RecvID - temp.MsgFrom = pChat.MsgFrom - temp.Seq = pChat.RecvSeq - temp.ServerMsgID = pChat.MsgID - temp.SendTime = pChat.SendTime - temp.Content = pChat.Content - temp.ContentType = pChat.ContentType - temp.SenderPlatformID = pChat.PlatformID - temp.ClientMsgID = pChat.ClientMsgID - temp.SenderFaceURL = pChat.SenderFaceURL - temp.SenderNickName = pChat.SenderNickName - if pChat.RecvSeq > MaxSeq { - MaxSeq = pChat.RecvSeq - } - if count == 0 { - MinSeq = pChat.RecvSeq - } - if pChat.RecvSeq < MinSeq { - MinSeq = pChat.RecvSeq - } - if pChat.SessionType == constant.SingleChatType { - SingleMsg = append(SingleMsg, temp) - } else { - GroupMsg = append(GroupMsg, temp) - } - count++ - if count == (seqEnd - seqBegin + 1) { - break - } - } - } - - return SingleMsg, GroupMsg, MaxSeq, MinSeq, nil -} -func (d *DataBases) GetMinSeqFromMongo(uid string) (MinSeq int64, err error) { - var i int64 +func (d *DataBases) GetMinSeqFromMongo(uid string) (MinSeq uint32, err error) { + var i, NB uint32 var seqUid string session := d.mgoSession.Clone() if session == nil { @@ -101,7 +46,7 @@ func (d *DataBases) GetMinSeqFromMongo(uid string) (MinSeq int64, err error) { if err != nil && err != redis.ErrNil { return MinSeq, err } - NB := MaxSeq / singleGocMsgNum + NB = uint32(MaxSeq / singleGocMsgNum) for i = 0; i <= NB; i++ { seqUid = indexGen(uid, i) n, err := c.Find(bson.M{"uid": seqUid}).Count() @@ -109,29 +54,28 @@ func (d *DataBases) GetMinSeqFromMongo(uid string) (MinSeq int64, err error) { if i == 0 { MinSeq = 1 } else { - MinSeq = i * singleGocMsgNum + MinSeq = uint32(i * singleGocMsgNum) } break } } return MinSeq, nil } -func (d *DataBases) GetMsgBySeqList(uid string, seqList []int64) (SingleMsg []*pbMsg.MsgFormat, GroupMsg []*pbMsg.MsgFormat, MaxSeq int64, MinSeq int64, err error) { - allCount := 0 +func (d *DataBases) GetMsgBySeqList(uid string, seqList []uint32, operationID string) (seqMsg []*open_im_sdk.MsgData, err error) { + var hasSeqList []uint32 singleCount := 0 session := d.mgoSession.Clone() if session == nil { - return nil, nil, MaxSeq, MinSeq, errors.New("session == nil") + return nil, errors.New("session == nil") } defer session.Close() - c := session.DB(config.Config.Mongo.DBDatabase).C(cChat) - m := func(uid string, seqList []int64) map[string][]int64 { - t := make(map[string][]int64) + m := func(uid string, seqList []uint32) map[string][]uint32 { + t := make(map[string][]uint32) for i := 0; i < len(seqList); i++ { seqUid := getSeqUid(uid, seqList[i]) if value, ok := t[seqUid]; !ok { - var temp []int64 + var temp []uint32 t[seqUid] = append(temp, seqList[i]) } else { t[seqUid] = append(value, seqList[i]) @@ -140,47 +84,21 @@ func (d *DataBases) GetMsgBySeqList(uid string, seqList []int64) (SingleMsg []*p return t }(uid, seqList) sChat := UserChat{} - pChat := pbMsg.MsgSvrToPushSvrChatMsg{} for seqUid, value := range m { if err = c.Find(bson.M{"uid": seqUid}).One(&sChat); err != nil { - log.NewError("", "not find seqUid", seqUid, value, uid, seqList) + log.NewError(operationID, "not find seqUid", seqUid, value, uid, seqList, err.Error()) continue } singleCount = 0 for i := 0; i < len(sChat.Msg); i++ { - temp := new(pbMsg.MsgFormat) - if err = proto.Unmarshal(sChat.Msg[i].Msg, &pChat); err != nil { - log.NewError("", "not find seqUid", seqUid, value, uid, seqList) - return nil, nil, MaxSeq, MinSeq, err + msg := new(open_im_sdk.MsgData) + if err = proto.Unmarshal(sChat.Msg[i].Msg, msg); err != nil { + log.NewError(operationID, "Unmarshal err", seqUid, value, uid, seqList, err.Error()) + return nil, err } - if isContainInt64(pChat.RecvSeq, value) { - temp.SendID = pChat.SendID - temp.RecvID = pChat.RecvID - temp.MsgFrom = pChat.MsgFrom - temp.Seq = pChat.RecvSeq - temp.ServerMsgID = pChat.MsgID - temp.SendTime = pChat.SendTime - temp.Content = pChat.Content - temp.ContentType = pChat.ContentType - temp.SenderPlatformID = pChat.PlatformID - temp.ClientMsgID = pChat.ClientMsgID - temp.SenderFaceURL = pChat.SenderFaceURL - temp.SenderNickName = pChat.SenderNickName - if pChat.RecvSeq > MaxSeq { - MaxSeq = pChat.RecvSeq - } - if allCount == 0 { - MinSeq = pChat.RecvSeq - } - if pChat.RecvSeq < MinSeq { - MinSeq = pChat.RecvSeq - } - if pChat.SessionType == constant.SingleChatType { - SingleMsg = append(SingleMsg, temp) - } else { - GroupMsg = append(GroupMsg, temp) - } - allCount++ + if isContainInt32(msg.Seq, value) { + seqMsg = append(seqMsg, msg) + hasSeqList = append(hasSeqList, msg.Seq) singleCount++ if singleCount == len(value) { break @@ -188,9 +106,25 @@ func (d *DataBases) GetMsgBySeqList(uid string, seqList []int64) (SingleMsg []*p } } } - return SingleMsg, GroupMsg, MaxSeq, MinSeq, nil + if len(hasSeqList) != len(seqList) { + var diff []uint32 + diff = utils.Difference(hasSeqList, seqList) + exceptionMSg := genExceptionMessageBySeqList(diff) + seqMsg = append(seqMsg, exceptionMSg...) + + } + return seqMsg, nil } -func (d *DataBases) SaveUserChat(uid string, sendTime int64, m *pbMsg.MsgSvrToPushSvrChatMsg) error { +func genExceptionMessageBySeqList(seqList []uint32) (exceptionMsg []*open_im_sdk.MsgData) { + for _, v := range seqList { + msg := new(open_im_sdk.MsgData) + msg.Seq = v + exceptionMsg = append(exceptionMsg, msg) + } + return exceptionMsg +} + +func (d *DataBases) SaveUserChat(uid string, sendTime int64, m *pbMsg.MsgDataToDB) error { var seqUid string newTime := getCurrentTimestampByMill() session := d.mgoSession.Clone() @@ -200,7 +134,7 @@ func (d *DataBases) SaveUserChat(uid string, sendTime int64, m *pbMsg.MsgSvrToPu defer session.Close() log.NewDebug("", "get mgoSession cost time", getCurrentTimestampByMill()-newTime) c := session.DB(config.Config.Mongo.DBDatabase).C(cChat) - seqUid = getSeqUid(uid, m.RecvSeq) + seqUid = getSeqUid(uid, m.MsgData.Seq) n, err := c.Find(bson.M{"uid": seqUid}).Count() if err != nil { return err @@ -208,7 +142,7 @@ func (d *DataBases) SaveUserChat(uid string, sendTime int64, m *pbMsg.MsgSvrToPu log.NewDebug("", "find mgo uid cost time", getCurrentTimestampByMill()-newTime) sMsg := MsgInfo{} sMsg.SendTime = sendTime - if sMsg.Msg, err = proto.Marshal(m); err != nil { + if sMsg.Msg, err = proto.Marshal(m.MsgData); err != nil { return err } if n == 0 { @@ -273,7 +207,7 @@ func (d *DataBases) MgoSkipUID(count int) (string, error) { } func (d *DataBases) GetGroupMember(groupID string) []string { - groupInfo := GroupMember{} + groupInfo := GroupMember_x{} groupInfo.GroupID = groupID groupInfo.UIDList = make([]string, 0) @@ -307,7 +241,7 @@ func (d *DataBases) AddGroupMember(groupID, uid string) error { } if n == 0 { - groupInfo := GroupMember{} + groupInfo := GroupMember_x{} groupInfo.GroupID = groupID groupInfo.UIDList = append(groupInfo.UIDList, uid) err = c.Insert(&groupInfo) @@ -343,11 +277,11 @@ func (d *DataBases) DelGroupMember(groupID, uid string) error { func getCurrentTimestampByMill() int64 { return time.Now().UnixNano() / 1e6 } -func getSeqUid(uid string, seq int64) string { +func getSeqUid(uid string, seq uint32) string { seqSuffix := seq / singleGocMsgNum return indexGen(uid, seqSuffix) } -func isContainInt64(target int64, List []int64) bool { +func isContainInt32(target uint32, List []uint32) bool { for _, element := range List { @@ -358,6 +292,6 @@ func isContainInt64(target int64, List []int64) bool { return false } -func indexGen(uid string, seqSuffix int64) string { - return uid + ":" + strconv.FormatInt(seqSuffix, 10) +func indexGen(uid string, seqSuffix uint32) string { + return uid + ":" + strconv.FormatInt(int64(seqSuffix), 10) } diff --git a/pkg/common/db/mysql.go b/pkg/common/db/mysql.go index 859620e36..56ca3648c 100644 --- a/pkg/common/db/mysql.go +++ b/pkg/common/db/mysql.go @@ -23,19 +23,22 @@ func initMysqlDB() { var err1 error db, err := gorm.Open("mysql", dsn) if err != nil { - log.Error("", "", dsn) + log.NewError("0", "Open failed ", err.Error(), dsn) } if err != nil { time.Sleep(time.Duration(30) * time.Second) db, err1 = gorm.Open("mysql", dsn) if err1 != nil { + log.NewError("0", "Open failed ", err1.Error(), dsn) panic(err1.Error()) } } + //Check the database and table during initialization - sql := fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %s ;", config.Config.Mysql.DBDatabaseName) + sql := fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %s ;", config.Config.Mysql.DBDatabaseName+"test1") err = db.Exec(sql).Error if err != nil { + log.NewError("0", "Exec failed ", err.Error(), sql) panic(err.Error()) } db.Close() @@ -44,9 +47,58 @@ func initMysqlDB() { config.Config.Mysql.DBUserName, config.Config.Mysql.DBPassword, config.Config.Mysql.DBAddress[0], config.Config.Mysql.DBDatabaseName) db, err = gorm.Open("mysql", dsn) if err != nil { + log.NewError("0", "Open failed ", err.Error(), dsn) panic(err.Error()) } + log.NewInfo("open db ok ", dsn) + db.AutoMigrate(&Friend{}, + &FriendRequest{}, + &Group{}, + &GroupMember{}, + &GroupRequest{}, + &User{}, + &Black{}, &ChatLog{}) + db.Set("gorm:table_options", "CHARSET=utf8") + + // + //if !db.HasTable(&Friend{}) { + // log.NewInfo("CreateTable Friend") + // db.CreateTable(&Friend{}) + //} + // + //if !db.HasTable(&FriendRequest{}) { + // log.NewInfo("CreateTable FriendRequest") + // db.CreateTable(&FriendRequest{}) + //} + // + //if !db.HasTable(&Group{}) { + // log.NewInfo("CreateTable Group") + // db.CreateTable(&Group{}) + //} + // + //if !db.HasTable(&GroupMember{}) { + // log.NewInfo("CreateTable GroupMember") + // db.CreateTable(&GroupMember{}) + //} + // + //if !db.HasTable(&GroupRequest{}) { + // log.NewInfo("CreateTable GroupRequest") + // db.CreateTable(&GroupRequest{}) + //} + // + //if !db.HasTable(&User{}) { + // log.NewInfo("CreateTable User") + // db.CreateTable(&User{}) + //} + // + //if !db.HasTable(&Black{}) { + // log.NewInfo("CreateTable Black") + // db.CreateTable(&Black{}) + //} + + return + sqlTable := "CREATE TABLE IF NOT EXISTS `user` (" + " `uid` varchar(64) NOT NULL," + " `name` varchar(64) DEFAULT NULL," + @@ -91,18 +143,6 @@ func initMysqlDB() { panic(err.Error()) } - sqlTable = "CREATE TABLE IF NOT EXISTS `black_list` (" + - " `uid` varchar(32) NOT NULL COMMENT 'uid'," + - " `begin_disable_time` datetime DEFAULT NULL," + - " `end_disable_time` datetime DEFAULT NULL," + - " `ex` varchar(1024) DEFAULT NULL," + - " PRIMARY KEY (`uid`) USING BTREE" + - " ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;" - err = db.Exec(sqlTable).Error - if err != nil { - panic(err.Error()) - } - sqlTable = "CREATE TABLE IF NOT EXISTS `user_black_list` (" + " `owner_id` varchar(64) NOT NULL," + " `block_id` varchar(64) NOT NULL," + diff --git a/pkg/common/db/mysql_model/im_mysql_model/friend_model.go b/pkg/common/db/mysql_model/im_mysql_model/friend_model.go index ce029a0bb..45650357b 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/friend_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/friend_model.go @@ -6,64 +6,73 @@ import ( "time" ) -func InsertToFriend(ownerId, friendId string, flag int32) error { +func InsertToFriend(toInsertFollow *db.Friend) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return err } - toInsertFollow := Friend{ - OwnerId: ownerId, - FriendId: friendId, - FriendFlag: flag, - CreateTime: time.Now(), - } - err = dbConn.Table("friend").Create(toInsertFollow).Error + toInsertFollow.CreateTime = time.Now() + + err = dbConn.Table("friends").Create(toInsertFollow).Error if err != nil { return err } return nil } -func FindFriendRelationshipFromFriend(ownerId, friendId string) (*Friend, error) { +func GetFriendRelationshipFromFriend(OwnerUserID, FriendUserID string) (*db.Friend, error) { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return nil, err } - var friend Friend - err = dbConn.Table("friend").Where("owner_id=? and friend_id=?", ownerId, friendId).Find(&friend).Error + var friend db.Friend + err = dbConn.Table("friends").Where("owner_user_id=? and friend_user_id=?", OwnerUserID, FriendUserID).Find(&friend).Error if err != nil { return nil, err } return &friend, err } -func FindUserInfoFromFriend(ownerId string) ([]Friend, error) { +func GetFriendListByUserID(OwnerUserID string) ([]db.Friend, error) { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return nil, err } - var friends []Friend - err = dbConn.Table("friend").Where("owner_id=?", ownerId).Find(&friends).Error + var friends []db.Friend + var x db.Friend + x.OwnerUserID = OwnerUserID + err = dbConn.Table("friends").Where("owner_user_id=?", OwnerUserID).Find(&friends).Error + if err != nil { return nil, err } return friends, nil } -func UpdateFriendComment(ownerId, friendId, comment string) error { +func UpdateFriendComment(OwnerUserID, FriendUserID, Remark string) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return err } - err = dbConn.Exec("update friend set comment=? where owner_id=? and friend_id=?", comment, ownerId, friendId).Error + err = dbConn.Exec("update friends set remark=? where owner_user_id=? and friend_user_id=?", Remark, OwnerUserID, FriendUserID).Error return err } -func DeleteSingleFriendInfo(ownerId, friendId string) error { +func DeleteSingleFriendInfo(OwnerUserID, FriendUserID string) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return err } - err = dbConn.Table("friend").Where("owner_id=? and friend_id=?", ownerId, friendId).Delete(Friend{}).Error + err = dbConn.Table("friends").Where("owner_user_id=? and friend_user_id=?", OwnerUserID, FriendUserID).Delete(db.Friend{}).Error return err } + +//type Friend struct { +// OwnerUserID string `gorm:"column:owner_user_id;primaryKey;"` +// FriendUserID string `gorm:"column:friend_user_id;primaryKey;"` +// Remark string `gorm:"column:remark"` +// CreateTime time.Time `gorm:"column:create_time"` +// AddSource int32 `gorm:"column:add_source"` +// OperatorUserID string `gorm:"column:operator_user_id"` +// Ex string `gorm:"column:ex"` +//} diff --git a/pkg/common/db/mysql_model/im_mysql_model/friend_request_model.go b/pkg/common/db/mysql_model/im_mysql_model/friend_request_model.go index 1a7308cb9..2591426a2 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/friend_request_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/friend_request_model.go @@ -2,67 +2,87 @@ package im_mysql_model import ( "Open_IM/pkg/common/db" + "Open_IM/pkg/utils" "time" ) -func ReplaceIntoFriendReq(reqId, userId string, flag int32, reqMessage string) error { - dbConn, err := db.DB.MysqlDB.DefaultGormDB() - if err != nil { - return err - } - err = dbConn.Exec("replace into friend_request(req_id,user_id,flag,req_message,create_time) values(?,?,?,?,?)", reqId, userId, flag, reqMessage, time.Now()).Error - if err != nil { - return err - } - return nil -} +//type FriendRequest struct { +// FromUserID string `gorm:"column:from_user_id;primaryKey;"` +// ToUserID string `gorm:"column:to_user_id;primaryKey;"` +// HandleResult int32 `gorm:"column:handle_result"` +// ReqMessage string `gorm:"column:req_message"` +// CreateTime time.Time `gorm:"column:create_time"` +// HandlerUserID string `gorm:"column:handler_user_id"` +// HandleMsg string `gorm:"column:handle_msg"` +// HandleTime time.Time `gorm:"column:handle_time"` +// Ex string `gorm:"column:ex"` +//} -func FindFriendsApplyFromFriendReq(userId string) ([]FriendRequest, error) { +// who apply to add me +func GetReceivedFriendsApplicationListByUserID(ToUserID string) ([]db.FriendRequest, error) { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return nil, err } - var usersInfo []FriendRequest - //dbConn.LogMode(true) - err = dbConn.Table("friend_request").Where("user_id=?", userId).Find(&usersInfo).Error + var usersInfo []db.FriendRequest + err = dbConn.Table("friend_requests").Where("to_user_id=?", ToUserID).Find(&usersInfo).Error if err != nil { return nil, err } return usersInfo, nil } -func FindSelfApplyFromFriendReq(userId string) ([]FriendRequest, error) { +//I apply to add somebody +func GetSendFriendApplicationListByUserID(FromUserID string) ([]db.FriendRequest, error) { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return nil, err } - var usersInfo []FriendRequest - err = dbConn.Table("friend_request").Where("req_id=?", userId).Find(&usersInfo).Error + var usersInfo []db.FriendRequest + err = dbConn.Table("friend_requests").Where("from_user_id=?", FromUserID).Find(&usersInfo).Error if err != nil { return nil, err } return usersInfo, nil } -func FindFriendApplyFromFriendReqByUid(reqId, userId string) (*FriendRequest, error) { +//FromUserId apply to add ToUserID +func GetFriendApplicationByBothUserID(FromUserID, ToUserID string) (*db.FriendRequest, error) { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return nil, err } - var friendRequest FriendRequest - err = dbConn.Table("friend_request").Where("req_id=? and user_id=?", reqId, userId).Find(&friendRequest).Error + var friendRequest db.FriendRequest + err = dbConn.Table("friend_requests").Where("from_user_id=? and to_user_id=?", FromUserID, ToUserID).Find(&friendRequest).Error if err != nil { return nil, err } return &friendRequest, nil } -func UpdateFriendRelationshipToFriendReq(reqId, userId string, flag int32) error { +func UpdateFriendApplication(friendRequest *db.FriendRequest) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return err } - err = dbConn.Exec("update friend_request set flag=? where req_id=? and user_id=?", flag, reqId, userId).Error + friendRequest.CreateTime = time.Now() + + return dbConn.Table("friend_requests").Where("from_user_id=? and to_user_id=?", + friendRequest.FromUserID, friendRequest.ToUserID).Update(&friendRequest).Error +} + +func InsertFriendApplication(friendRequest *db.FriendRequest) error { + dbConn, err := db.DB.MysqlDB.DefaultGormDB() + if err != nil { + return err + } + if friendRequest.CreateTime.Unix() < 0 { + friendRequest.CreateTime = time.Now() + } + if friendRequest.HandleTime.Unix() < 0 { + friendRequest.HandleTime = utils.UnixSecondToTime(0) + } + err = dbConn.Table("friend_requests").Create(friendRequest).Error if err != nil { 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 a31f973e1..f4684f9a4 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 @@ -1,171 +1,189 @@ package im_mysql_model import ( + "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db" + "Open_IM/pkg/utils" "time" ) -func InsertIntoGroupMember(groupId, uid, nickName, userGroupFaceUrl string, administratorLevel int32) error { +//type GroupMember struct { +// GroupID string `gorm:"column:group_id;primaryKey;"` +// UserID string `gorm:"column:user_id;primaryKey;"` +// 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"` +// JoinSource int32 `gorm:"column:join_source"` +// OperatorUserID string `gorm:"column:operator_user_id"` +// Ex string `gorm:"column:ex"` +//} + +func InsertIntoGroupMember(toInsertInfo db.GroupMember) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return err } - toInsertInfo := GroupMember{GroupId: groupId, Uid: uid, NickName: nickName, AdministratorLevel: administratorLevel, JoinTime: time.Now(), UserGroupFaceUrl: userGroupFaceUrl} - err = dbConn.Table("group_member").Create(toInsertInfo).Error + toInsertInfo.JoinTime = time.Now() + if toInsertInfo.RoleLevel == 0 { + toInsertInfo.RoleLevel = constant.GroupOrdinaryUsers + } + err = dbConn.Table("group_members").Create(toInsertInfo).Error if err != nil { return err } return nil } -func FindGroupMemberListByUserId(uid string) ([]GroupMember, error) { +func GetGroupMemberListByUserID(userID string) ([]db.GroupMember, error) { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return nil, err } - var groupMemberList []GroupMember - err = dbConn.Raw("select * from `group_member` where uid=?", uid).Find(&groupMemberList).Error + var groupMemberList []db.GroupMember + err = dbConn.Table("group_members").Where("user_id=?", userID).Find(&groupMemberList).Error if err != nil { return nil, err } return groupMemberList, nil } -func FindGroupMemberListByGroupId(groupId string) ([]GroupMember, error) { +func GetGroupMemberListByGroupID(groupID string) ([]db.GroupMember, error) { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return nil, err } - var groupMemberList []GroupMember - err = dbConn.Raw("select * from `group_member` where group_id=?", groupId).Find(&groupMemberList).Error + var groupMemberList []db.GroupMember + err = dbConn.Table("group_members").Where("group_id=?", groupID).Find(&groupMemberList).Error + if err != nil { return nil, err } return groupMemberList, nil } -func FindGroupMemberListByGroupIdAndFilterInfo(groupId string, filter int32) ([]GroupMember, error) { +func GetGroupMemberListByGroupIDAndRoleLevel(groupID string, roleLevel int32) ([]db.GroupMember, error) { dbConn, err := db.DB.MysqlDB.DefaultGormDB() - dbConn.LogMode(true) if err != nil { return nil, err } - var groupMemberList []GroupMember - err = dbConn.Raw("select * from `group_member` where group_id=? and administrator_level=?", groupId, filter).Find(&groupMemberList).Error + var groupMemberList []db.GroupMember + err = dbConn.Table("group_members").Where("group_id=? and role_level=?", groupID, roleLevel).Find(&groupMemberList).Error if err != nil { return nil, err } return groupMemberList, nil } -func FindGroupMemberInfoByGroupIdAndUserId(groupId, uid string) (*GroupMember, error) { + +func GetGroupMemberInfoByGroupIDAndUserID(groupID, userID string) (*db.GroupMember, error) { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return nil, err } - var groupMember GroupMember - err = dbConn.Raw("select * from `group_member` where group_id=? and uid=? limit 1", groupId, uid).Find(&groupMember).Error + var groupMember db.GroupMember + err = dbConn.Table("group_members").Where("group_id=? and user_id=? ", groupID, userID).Limit(1).Find(&groupMember).Error if err != nil { return nil, err } return &groupMember, nil } -func DeleteGroupMemberByGroupIdAndUserId(groupId, uid string) error { +func DeleteGroupMemberByGroupIDAndUserID(groupID, userID string) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return err } - err = dbConn.Exec("delete from `group_member` where group_id=? and uid=?", groupId, uid).Error + err = dbConn.Table("group_members").Where("group_id=? and user_id=? ", groupID, userID).Delete(db.GroupMember{}).Error if err != nil { return err } return nil } -func UpdateOwnerGroupNickName(groupId, userId, groupNickName string) error { +func UpdateGroupMemberInfo(groupMemberInfo db.GroupMember) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return err } - err = dbConn.Exec("update `group_member` set nickname=? where group_id=? and uid=?", groupNickName, groupId, userId).Error + err = dbConn.Table("group_members").Where("group_id=? and user_id=?", groupMemberInfo.GroupID, groupMemberInfo.UserID).Update(&groupMemberInfo).Error if err != nil { return err } return nil } -func SelectGroupList(groupID string) ([]string, error) { - var groupUserID string - var groupList []string - dbConn, err := db.DB.MysqlDB.DefaultGormDB() - if err != nil { - return groupList, err - } - - rows, err := dbConn.Model(&GroupMember{}).Where("group_id = ?", groupID).Select("user_id").Rows() - if err != nil { - return groupList, err - } - defer rows.Close() - for rows.Next() { - rows.Scan(&groupUserID) - groupList = append(groupList, groupUserID) - } - return groupList, nil -} - -func UpdateTheUserAdministratorLevel(groupId, uid string, administratorLevel int64) error { - dbConn, err := db.DB.MysqlDB.DefaultGormDB() - if err != nil { - return err - } - err = dbConn.Exec("update `group_member` set administrator_level=? where group_id=? and uid=?", administratorLevel, groupId, uid).Error - if err != nil { - return err - } - return nil -} - -func GetOwnerManagerByGroupId(groupId string) ([]GroupMember, error) { +func GetOwnerManagerByGroupID(groupID string) ([]db.GroupMember, error) { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return nil, err } - var groupMemberList []GroupMember - err = dbConn.Raw("select * from `group_member` where group_id=? and administrator_level > 0", groupId).Find(&groupMemberList).Error + var groupMemberList []db.GroupMember + err = dbConn.Table("group_members").Where("group_id=? and role_level>?", groupID, constant.GroupOrdinaryUsers).Find(&groupMemberList).Error if err != nil { return nil, err } return groupMemberList, nil } -func IsExistGroupMember(groupId, uid string) bool { +func GetGroupMemberNumByGroupID(groupID string) (uint32, error) { + dbConn, err := db.DB.MysqlDB.DefaultGormDB() + if err != nil { + return 0, utils.Wrap(err, "DefaultGormDB failed") + } + var number uint32 + err = dbConn.Table("group_members").Where("group_id=?", groupID).Count(&number).Error + if err != nil { + return 0, utils.Wrap(err, "") + } + return number, nil +} + +func GetGroupOwnerInfoByGroupID(groupID string) (*db.GroupMember, error) { + omList, err := GetOwnerManagerByGroupID(groupID) + if err != nil { + return nil, err + } + for _, v := range omList { + if v.RoleLevel == constant.GroupOwner { + return &v, nil + } + } + return nil, nil +} + +func IsExistGroupMember(groupID, userID string) bool { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return false } var number int32 - err = dbConn.Raw("select count(*) from `group_member` where group_id = ? and uid = ?", groupId, uid).Count(&number).Error + err = dbConn.Table("group_members").Where("group_id = ? and user_id = ?", groupID, userID).Count(&number).Error if err != nil { return false } - if number != 1 { return false } return true } -func RemoveGroupMember(groupId string, memberId string) error { - return DeleteGroupMemberByGroupIdAndUserId(groupId, memberId) +func RemoveGroupMember(groupID string, UserID string) error { + return DeleteGroupMemberByGroupIDAndUserID(groupID, UserID) } -func GetMemberInfoById(groupId string, memberId string) (*GroupMember, error) { - return FindGroupMemberInfoByGroupIdAndUserId(groupId, memberId) +func GetMemberInfoByID(groupID string, userID string) (*db.GroupMember, error) { + return GetGroupMemberInfoByGroupIDAndUserID(groupID, userID) } -func GetGroupMemberByGroupId(groupId string, filter int32, begin int32, maxNumber int32) ([]GroupMember, error) { - memberList, err := FindGroupMemberListByGroupId(groupId) //sorted by join time +func GetGroupMemberByGroupID(groupID string, filter int32, begin int32, maxNumber int32) ([]db.GroupMember, error) { + var memberList []db.GroupMember + var err error + if filter >= 0 { + memberList, err = GetGroupMemberListByGroupIDAndRoleLevel(groupID, filter) //sorted by join time + } else { + memberList, err = GetGroupMemberListByGroupID(groupID) + } + if err != nil { return nil, err } @@ -182,36 +200,48 @@ func GetGroupMemberByGroupId(groupId string, filter int32, begin int32, maxNumbe return memberList[begin:end], nil } -func GetJoinedGroupIdListByMemberId(memberId string) ([]GroupMember, error) { - return FindGroupMemberListByUserId(memberId) +func GetJoinedGroupIDListByUserID(userID string) ([]string, error) { + memberList, err := GetGroupMemberListByUserID(userID) + if err != nil { + return nil, err + } + var groupIDList []string = make([]string, len(memberList)) + for _, v := range memberList { + groupIDList = append(groupIDList, v.GroupID) + } + return groupIDList, nil } -func GetGroupMemberNumByGroupId(groupId string) int32 { - dbConn, err := db.DB.MysqlDB.DefaultGormDB() +func IsGroupOwnerAdmin(groupID, UserID string) bool { + groupMemberList, err := GetOwnerManagerByGroupID(groupID) if err != nil { - return 0 + return false } - var number int32 - err = dbConn.Raw("select count(*) from `group_member` where group_id=? ", groupId).Count(&number).Error - if err != nil { - return 0 - } - return number -} - -func GetGroupOwnerByGroupId(groupId string) string { - omList, err := GetOwnerManagerByGroupId(groupId) - if err != nil { - return "" - } - for _, v := range omList { - if v.AdministratorLevel == 1 { - return v.Uid + for _, v := range groupMemberList { + if v.UserID == UserID && v.RoleLevel > constant.GroupOrdinaryUsers { + return true } } - return "" + return false } -func InsertGroupMember(groupId, userId, nickName, userFaceUrl string, role int32) error { - return InsertIntoGroupMember(groupId, userId, nickName, userFaceUrl, role) -} +// +//func SelectGroupList(groupID string) ([]string, error) { +// var groupUserID string +// var groupList []string +// dbConn, err := db.DB.MysqlDB.DefaultGormDB() +// if err != nil { +// return groupList, err +// } +// +// rows, err := dbConn.Model(&GroupMember{}).Where("group_id = ?", groupID).Select("user_id").Rows() +// if err != nil { +// return groupList, err +// } +// defer rows.Close() +// for rows.Next() { +// rows.Scan(&groupUserID) +// groupList = append(groupList, groupUserID) +// } +// return groupList, nil +//} 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 2988741e5..60b470685 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 @@ -2,301 +2,57 @@ package im_mysql_model import ( "Open_IM/pkg/common/db" - "Open_IM/pkg/common/log" - "Open_IM/pkg/proto/group" - "errors" + "Open_IM/pkg/utils" "time" ) -func InsertIntoGroup(groupId, name, introduction, notification, faceUrl, ex string) error { +//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 db.Group) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return err } - //Default group name - if name == "" { - name = "groupChat" + if groupInfo.GroupName == "" { + groupInfo.GroupName = "Group Chat" } - toInsertInfo := Group{GroupId: groupId, Name: name, Introduction: introduction, Notification: notification, FaceUrl: faceUrl, CreateTime: time.Now(), Ex: ex} - err = dbConn.Table("group").Create(toInsertInfo).Error + groupInfo.CreateTime = time.Now() + err = dbConn.Table("groups").Create(groupInfo).Error if err != nil { return err } return nil } -func FindGroupInfoByGroupId(groupId string) (*Group, error) { +func GetGroupInfoByGroupID(groupId string) (*db.Group, error) { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { - return nil, err + return nil, utils.Wrap(err, "") } - var groupInfo Group - err = dbConn.Raw("select * from `group` where group_id=?", groupId).Scan(&groupInfo).Error + var groupInfo db.Group + err = dbConn.Table("groups").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 db.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.OldOwner) - if err != nil { - return nil, err - } - newOwner, err := FindGroupMemberInfoByGroupIdAndUserId(pb.GroupID, pb.NewOwner) - if err != nil { - return nil, err - } - - if oldOwner.Uid == newOwner.Uid { - return nil, errors.New("the self") - } - - if err = UpdateTheUserAdministratorLevel(pb.GroupID, pb.OldOwner, 0); err != nil { - return nil, err - } - - if err = UpdateTheUserAdministratorLevel(pb.GroupID, pb.NewOwner, 1); err != nil { - UpdateTheUserAdministratorLevel(pb.GroupID, pb.OldOwner, 1) - return nil, err - } - - return &group.TransferGroupOwnerResp{}, nil -} - -func GroupApplicationResponse(pb *group.GroupApplicationResponseReq) (*group.GroupApplicationResponseResp, 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 - } - } - } - - //if err != nil { - // err = dbConn.Raw("select * from `group_request` where handled_user = ? and group_id = ? and to_user_id = ? and from_user_id = ?", "", pb.GroupID, "0", pb.UID).Scan(&groupRequest).Error - // if err != nil { - // return nil, err - // } - // if pb.Flag == 1 { - // err = dbConn.Exec("update `group_request` set flag = ?, handled_msg = ?, handled_user = ? where group_id = ? and to_user_id = ? and from_user_id = ?", - // pb.Flag, pb.RespMsg, pb.OwnerID, pb.GroupID, "0", pb.UID).Error - // if err != nil { - // return nil, err - // } - // - // // add to group member - // err = InsertIntoGroupMember(pb.GroupID, pb.UID, groupRequest.FromUserNickname, groupRequest.FromUserFaceUrl, 0) - // if err != nil { - // return nil, err - // } - // } else if pb.Flag == -1 { - // err = dbConn.Exec("update `group_request` set flag = ?, handled_msg = ?, handled_user = ? where group_id = ? and to_user_id = ? and from_user_id = ?", - // pb.Flag, pb.RespMsg, pb.OwnerID, pb.GroupID, "0", pb.UID).Error - // if err != nil { - // return nil, err - // } - // } else { - // return nil, errors.New("flag error") - // } - //} else { - // if pb.Flag == 1 { - // err = dbConn.Exec("update `group_request` set flag = ?, handled_msg = ?, handled_user = ? where group_id = ? and to_user_id = ?", - // pb.Flag, pb.RespMsg, pb.OwnerID, pb.GroupID, pb.UID).Error - // if err != nil { - // return nil, err - // } - // - // // add to group member - // err = InsertIntoGroupMember(pb.GroupID, pb.UID, groupRequest.ToUserNickname, groupRequest.ToUserFaceUrl, 0) - // if err != nil { - // return nil, err - // } - // } else if pb.Flag == -1 { - // err = dbConn.Exec("update `group_request` set flag = ?, handled_msg = ?, handled_user = ? where group_id = ? and to_user_id = ?", - // pb.Flag, pb.RespMsg, pb.OwnerID, pb.GroupID, pb.UID).Error - // if err != nil { - // return nil, err - // } - // } else { - // return nil, errors.New("flag error") - // } - //} - - return &group.GroupApplicationResponseResp{}, nil + err = dbConn.Table("groups").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..84988a3f4 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 @@ -1,62 +1,189 @@ package im_mysql_model import ( + "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db" + "Open_IM/pkg/utils" "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 db.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").Create(&toInsertInfo).Error + if groupRequest.HandledTime.Unix() < 0 { + groupRequest.HandledTime = utils.UnixSecondToTime(0) + } + return dbConn.Table("group_requests").Where("group_id=? and user_id=?", groupRequest.GroupID, groupRequest.UserID).Update(&groupRequest).Error +} + +func InsertIntoGroupRequest(toInsertInfo db.GroupRequest) error { + dbConn, err := db.DB.MysqlDB.DefaultGormDB() + if err != nil { + return err + } + + toInsertInfo.ReqTime = time.Now() + if toInsertInfo.HandledTime.Unix() < 0 { + toInsertInfo.HandledTime = utils.UnixSecondToTime(0) + } + + err = dbConn.Table("group_requests").Create(&toInsertInfo).Error if err != nil { return err } return nil } -func FindGroupRequestUserInfoByGroupIDAndUid(groupId, uid string) (*GroupRequest, error) { +func GetGroupRequestByGroupIDAndUserID(groupID, userID string) (*db.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 db.GroupRequest + err = dbConn.Table("group_requests").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_requests").Where("group_id=? and user_id=?", groupID, userID).Delete(db.GroupRequest{}).Error if err != nil { return err } return nil } -func FindGroupBeInvitedRequestInfoByUidAndGroupID(groupId, uid string) (*GroupRequest, error) { +func GetGroupRequestByGroupID(groupID string) ([]db.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 []db.GroupRequest + err = dbConn.Table("group_requests").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) ([]db.GroupRequest, error) { + var groupRequestList []db.GroupRequest + memberList, err := GetGroupMemberListByUserID(userID) + if err != nil { + return nil, err + } + for _, v := range memberList { + if v.RoleLevel > constant.GroupOrdinaryUsers { + list, err := GetGroupRequestByGroupID(v.GroupID) + if err != nil { + // fmt.Println("111 GetGroupRequestByGroupID failed ", err.Error()) + continue + } + // fmt.Println("222 GetGroupRequestByGroupID ok ", list) + groupRequestList = append(groupRequestList, list...) + // fmt.Println("333 GetGroupRequestByGroupID ok ", groupRequestList) + } + } + 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 deleted file mode 100644 index d8576ac19..000000000 --- a/pkg/common/db/mysql_model/im_mysql_model/model_struct.go +++ /dev/null @@ -1,70 +0,0 @@ -package im_mysql_model - -import "time" - -type User struct { - UID string `gorm:"column:uid;primaryKey;"` - Name string `gorm:"column:name"` - Icon string `gorm:"column:icon"` - Gender int32 `gorm:"column:gender"` - Mobile string `gorm:"column:mobile"` - Birth string `gorm:"column:birth"` - Email string `gorm:"column:email"` - Ex string `gorm:"column:ex"` - CreateTime time.Time `gorm:"column:create_time"` -} - -type Friend struct { - OwnerId string `gorm:"column:owner_id"` - FriendId string `gorm:"column:friend_id"` - Comment string `gorm:"column:comment"` - FriendFlag int32 `gorm:"column:friend_flag"` - CreateTime time.Time `gorm:"column:create_time"` -} -type FriendRequest struct { - ReqId string `gorm:"column:req_id"` - Uid string `gorm:"column:user_id"` - Flag int32 `gorm:"column:flag"` - ReqMessage string `gorm:"column:req_message"` - CreateTime time.Time `gorm:"column:create_time"` -} -type BlackList struct { - OwnerId string `gorm:"column:owner_id"` - BlockId string `gorm:"column:block_id"` - CreateTime time.Time `gorm:"column:create_time"` -} - -type Group struct { - GroupId string `gorm:"column:group_id"` - Name 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"` - Ex string `gorm:"column:ex"` -} - -type GroupMember struct { - GroupId string `gorm:"column:group_id"` - Uid string `gorm:"column:uid"` - NickName string `gorm:"column:nickname"` - AdministratorLevel int32 `gorm:"column:administrator_level"` - JoinTime time.Time `gorm:"column:join_time"` - UserGroupFaceUrl string `gorm:"user_group_face_url"` -} - -type GroupRequest struct { - ID string `gorm:"column:id"` - GroupID string `gorm:"column:group_id"` - FromUserID string `gorm:"column:from_user_id"` - ToUserID string `gorm:"column:to_user_id"` - Flag int32 `gorm:"column:flag"` - ReqMsg string `gorm:"column:req_msg"` - HandledMsg string `gorm:"column:handled_msg"` - CreateTime time.Time `gorm:"column:create_time"` - FromUserNickname string `gorm:"from_user_nickname"` - ToUserNickname string `gorm:"to_user_nickname"` - FromUserFaceUrl string `gorm:"from_user_face_url"` - ToUserFaceUrl string `gorm:"to_user_face_url"` - HandledUser string `gorm:"handled_user"` -} 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 907b0f223..7a60287a6 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 @@ -2,45 +2,55 @@ package im_mysql_model import ( "Open_IM/pkg/common/db" + "Open_IM/pkg/utils" "time" ) -func InsertInToUserBlackList(ownerID, blockID string) error { +func InsertInToUserBlackList(black db.Black) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return err } - toInsertInfo := BlackList{OwnerId: ownerID, BlockId: blockID, CreateTime: time.Now()} - err = dbConn.Table("user_black_list").Create(toInsertInfo).Error + black.CreateTime = time.Now() + err = dbConn.Table("blacks").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 db.Black + err = dbConn.Table("blacks").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 - return err + err = dbConn.Table("blacks").Where("owner_user_id=? and block_user_id=?", ownerUserID, blockUserID).Delete(db.Black{}).Error + return utils.Wrap(err, "RemoveBlackList failed") } -func GetBlackListByUID(ownerID string) ([]BlackList, error) { +func GetBlackListByUserID(ownerUserID string) ([]db.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 []db.Black + err = dbConn.Table("blacks").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 be4e60069..5c3b226d5 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 @@ -2,8 +2,8 @@ package im_mysql_model import ( "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db" - pbAuth "Open_IM/pkg/proto/auth" "Open_IM/pkg/utils" "fmt" _ "github.com/jinzhu/gorm/dialects/mysql" @@ -12,168 +12,112 @@ 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) + } else { + continue } + var appMgr db.User + appMgr.UserID = v + appMgr.Nickname = "AppManager" + utils.IntToString(k+1) + appMgr.AppMangerLevel = constant.AppAdmin + err = UserRegister(appMgr) + if err != nil { + fmt.Println("AppManager insert error", err.Error(), appMgr, "time: ", appMgr.Birth.Unix()) + } + } } -func UserRegister(pb *pbAuth.UserRegisterReq) error { + +func UserRegister(user db.User) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return err } - addUser := User{ - UID: pb.UID, - Name: pb.Name, - Icon: pb.Icon, - Gender: pb.Gender, - Mobile: pb.Mobile, - Birth: pb.Birth, - Email: pb.Email, - Ex: pb.Ex, - CreateTime: time.Now(), + user.CreateTime = time.Now() + if user.AppMangerLevel == 0 { + user.AppMangerLevel = constant.AppOrdinaryUsers } - err = dbConn.Table("user").Create(&addUser).Error + if user.Birth.Unix() < 0 { + user.Birth = utils.UnixSecondToTime(0) + } + err = dbConn.Table("users").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) (i int64) { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { - return err + return 0 } - err = dbConn.Table("user").Where("uid=?", uid).Delete(User{}).Error - if err != nil { - return err - } - return nil + i = dbConn.Table("users").Where("user_id=?", userID).Delete(db.User{}).RowsAffected + return i } -func FindUserByUID(uid string) (*User, error) { + +func GetUserByUserID(userID string) (*db.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 + var user db.User + err = dbConn.Table("users").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 db.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("users").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("users").Pluck("user_id", &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() + dbConn.LogMode(true) 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 resultArr []string + err = dbConn.Table("users").Where("user_id IN (?) ", userIDList).Pluck("user_id", &resultArr).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 resultArr, nil } diff --git a/pkg/common/db/mysql_model/im_mysql_msg_model/chat_log_model.go b/pkg/common/db/mysql_model/im_mysql_msg_model/chat_log_model.go index 73defd89d..96d03a7c7 100644 --- a/pkg/common/db/mysql_model/im_mysql_msg_model/chat_log_model.go +++ b/pkg/common/db/mysql_model/im_mysql_msg_model/chat_log_model.go @@ -7,42 +7,28 @@ package im_mysql_msg_model import ( + "Open_IM/pkg/common/constant" "Open_IM/pkg/common/db" pbMsg "Open_IM/pkg/proto/chat" "Open_IM/pkg/utils" - "database/sql" - "time" + "github.com/jinzhu/copier" ) -// ChatLog Chat information table structure -type ChatLog struct { - MsgId string `gorm:"primary_key"` // Chat history primary key ID - SendID string `gorm:"column:send_id"` // Send ID - RecvID string `gorm:"column:recv_id"` //Receive ID - SendTime time.Time `gorm:"column:send_time"` // Send time - SessionType int32 `gorm:"column:session_type"` // Session type - ContentType int32 `gorm:"column:content_type"` // Message content type - MsgFrom int32 `gorm:"column:msg_from"` // Source, user, system - Content string `gorm:"column:content"` // Chat content - SenderPlatformID int32 `gorm:"column:sender_platform_id"` //The sender's platform ID - Remark sql.NullString `gorm:"column:remark"` // remark -} - -func InsertMessageToChatLog(msgData pbMsg.WSToMsgSvrChatMsg) error { +func InsertMessageToChatLog(msg pbMsg.MsgDataToMQ) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { return err } - chatLog := ChatLog{ - MsgId: msgData.MsgID, - SendID: msgData.SendID, - RecvID: msgData.RecvID, - SendTime: utils.UnixNanoSecondToTime(msgData.SendTime), - SessionType: msgData.SessionType, - ContentType: msgData.ContentType, - MsgFrom: msgData.MsgFrom, - Content: msgData.Content, - SenderPlatformID: msgData.PlatformID, + chatLog := new(db.ChatLog) + copier.Copy(chatLog, msg.MsgData) + switch msg.MsgData.SessionType { + case constant.GroupChatType: + chatLog.RecvID = msg.MsgData.GroupID + case constant.SingleChatType: + chatLog.RecvID = msg.MsgData.RecvID } - return dbConn.Table("chat_log").Create(chatLog).Error + chatLog.Content = string(msg.MsgData.Content) + chatLog.CreateTime = utils.UnixMillSecondToTime(msg.MsgData.CreateTime) + chatLog.SendTime = utils.UnixMillSecondToTime(msg.MsgData.SendTime) + return dbConn.Table("chat_logs").Create(chatLog).Error } diff --git a/pkg/common/db/mysql_model/im_mysql_msg_model/receive_model.go b/pkg/common/db/mysql_model/im_mysql_msg_model/receive_model.go deleted file mode 100644 index 3973f71ef..000000000 --- a/pkg/common/db/mysql_model/im_mysql_msg_model/receive_model.go +++ /dev/null @@ -1,36 +0,0 @@ -/* -** description(""). -** copyright('tuoyun,www.tuoyun.net'). -** author("fg,Gordon@tuoyun.net"). -** time(2021/3/4 11:18). - */ -package im_mysql_msg_model - -import ( - "time" -) - -// Receive Inbox table structure -type Receive struct { - UserId string `gorm:"primary_key"` // 收件箱主键ID - Seq int64 `gorm:"primary_key"` // 收件箱主键ID - MsgId string - CreateTime *time.Time -} - -//func InsertMessageToReceive(seq int64, userid, msgid string) error { -// conn := db.NewDbConnection() -// receive := Receive{ -// UID: userid, -// Seq: seq, -// MsgId: msgid, -// } -// err := conn.Table("receive").Create(&receive).Error -// return err -//} -//func GetBiggestSeqFromReceive(userid string) (seq int64, err error) { -// //得到数据库的连接(并非真连接,调用时才连接,由gorm自动维护数据库连接池) -// conn := db.NewDbConnection() -// err = conn.Raw("select max(seq) from receive where user_id = ?", userid).Row().Scan(&seq) -// return seq, err -//} diff --git a/pkg/common/db/redisModel.go b/pkg/common/db/redisModel.go index a9d552699..a3e2ade8e 100644 --- a/pkg/common/db/redisModel.go +++ b/pkg/common/db/redisModel.go @@ -35,28 +35,28 @@ func (d *DataBases) Exec(cmd string, key interface{}, args ...interface{}) (inte } //Perform seq auto-increment operation of user messages -func (d *DataBases) IncrUserSeq(uid string) (int64, error) { +func (d *DataBases) IncrUserSeq(uid string) (uint64, error) { key := userIncrSeq + uid - return redis.Int64(d.Exec("INCR", key)) + return redis.Uint64(d.Exec("INCR", key)) } //Get the largest Seq -func (d *DataBases) GetUserMaxSeq(uid string) (int64, error) { +func (d *DataBases) GetUserMaxSeq(uid string) (uint64, error) { key := userIncrSeq + uid - return redis.Int64(d.Exec("GET", key)) + return redis.Uint64(d.Exec("GET", key)) } //Set the user's minimum seq -func (d *DataBases) SetUserMinSeq(uid string, minSeq int64) (err error) { +func (d *DataBases) SetUserMinSeq(uid string, minSeq uint32) (err error) { key := userMinSeq + uid _, err = d.Exec("SET", key, minSeq) return err } //Get the smallest Seq -func (d *DataBases) GetUserMinSeq(uid string) (int64, error) { +func (d *DataBases) GetUserMinSeq(uid string) (uint64, error) { key := userMinSeq + uid - return redis.Int64(d.Exec("GET", key)) + return redis.Uint64(d.Exec("GET", key)) } //Store Apple's device token to redis @@ -91,10 +91,15 @@ func (d *DataBases) SetTokenMapByUidPid(userID string, platformID int32, m map[s _, err := d.Exec("hmset", key, redis.Args{}.Add().AddFlat(m)...) return err } +func (d *DataBases) DeleteTokenByUidPid(userID string, platformID int32, fields []string) error { + key := uidPidToken + userID + ":" + constant.PlatformIDToName(platformID) + _, err := d.Exec("HDEL", key, redis.Args{}.Add().AddFlat(fields)...) + return err +} func (d *DataBases) SetSingleConversationMsgOpt(userID, conversationID string, opt int) error { key := conversationReceiveMessageOpt + userID - _, err1 := d.Exec("HSet", key, conversationID, opt) - return err1 + _, err := d.Exec("HSet", key, conversationID, opt) + return err } func (d *DataBases) GetSingleConversationMsgOpt(userID, conversationID string) (int, error) { key := conversationReceiveMessageOpt + userID diff --git a/pkg/common/log/file_line_hk.go b/pkg/common/log/file_line_hk.go index 7eeb6ea82..9ffa7806e 100644 --- a/pkg/common/log/file_line_hk.go +++ b/pkg/common/log/file_line_hk.go @@ -24,7 +24,7 @@ func (f *fileHook) Levels() []logrus.Level { } func (f *fileHook) Fire(entry *logrus.Entry) error { - entry.Data["FilePath"] = findCaller(5) + entry.Data["FilePath"] = findCaller(6) return nil } diff --git a/pkg/common/log/logrus.go b/pkg/common/log/logrus.go index 03b768eca..936f3e9b2 100644 --- a/pkg/common/log/logrus.go +++ b/pkg/common/log/logrus.go @@ -88,33 +88,25 @@ func initRotateLogs(rotationTime time.Duration, maxRemainNum uint, level string, } } -//Deprecated -func Info(token, OperationID, format string, args ...interface{}) { +func Info(OperationID string, args ...interface{}) { logger.WithFields(logrus.Fields{ - "PID": logger.Pid, "OperationID": OperationID, - }).Infof(format, args...) - + "PID": logger.Pid, + }).Infoln(args) } -//Deprecated -func Error(token, OperationID, format string, args ...interface{}) { - +func Error(OperationID string, args ...interface{}) { logger.WithFields(logrus.Fields{ - "PID": logger.Pid, "OperationID": OperationID, - }).Errorf(format, args...) - + "PID": logger.Pid, + }).Errorln(args) } -//Deprecated -func Debug(token, OperationID, format string, args ...interface{}) { - +func Debug(OperationID string, args ...interface{}) { logger.WithFields(logrus.Fields{ - "PID": logger.Pid, "OperationID": OperationID, - }).Debugf(format, args...) - + "PID": logger.Pid, + }).Debugln(args) } //Deprecated diff --git a/pkg/common/token_verify/jwt_token.go b/pkg/common/token_verify/jwt_token.go index 961919605..50aecc8ae 100644 --- a/pkg/common/token_verify/jwt_token.go +++ b/pkg/common/token_verify/jwt_token.go @@ -5,6 +5,8 @@ import ( "Open_IM/pkg/common/constant" commonDB "Open_IM/pkg/common/db" "Open_IM/pkg/common/log" + "Open_IM/pkg/utils" + "github.com/garyburd/redigo/redis" "github.com/golang-jwt/jwt/v4" "time" ) @@ -42,6 +44,24 @@ func CreateToken(userID string, platformID int32) (string, int64, error) { if err != nil { return "", 0, err } + //remove Invalid token + m, err := commonDB.DB.GetTokenMapByUidPid(userID, constant.PlatformIDToName(platformID)) + if err != nil && err != redis.ErrNil { + return "", 0, err + } + var deleteTokenKey []string + for k, v := range m { + _, err = GetClaimFromToken(k) + if err != nil || v != constant.NormalToken { + deleteTokenKey = append(deleteTokenKey, k) + } + } + if len(deleteTokenKey) != 0 { + err = commonDB.DB.DeleteTokenByUidPid(userID, platformID, deleteTokenKey) + if err != nil { + return "", 0, err + } + } err = commonDB.DB.AddTokenFlag(userID, platformID, tokenString, constant.NormalToken) if err != nil { return "", 0, err @@ -80,6 +100,43 @@ func GetClaimFromToken(tokensString string) (*Claims, error) { } } +func IsAppManagerAccess(token string, OpUserID string) bool { + claims, err := ParseToken(token) + if err != nil { + return false + } + if utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) && claims.UID == OpUserID { + return true + } + return false +} + +func IsMangerUserID(OpUserID string) bool { + if utils.IsContain(OpUserID, config.Config.Manager.AppManagerUid) { + return true + } else { + return false + } +} + +func CheckAccess(OpUserID string, OwnerUserID string) bool { + if utils.IsContain(OpUserID, config.Config.Manager.AppManagerUid) { + return true + } + if OpUserID == OwnerUserID { + return true + } + return false +} + +func GetUserIDFromToken(token string) (bool, string) { + claims, err := ParseToken(token) + if err != nil { + return false, "" + } + return true, claims.UID +} + func ParseToken(tokensString string) (claims *Claims, err error) { claims, err = GetClaimFromToken(tokensString) diff --git a/pkg/common/utils/utils.go b/pkg/common/utils/utils.go new file mode 100644 index 000000000..2fbcf1930 --- /dev/null +++ b/pkg/common/utils/utils.go @@ -0,0 +1,150 @@ +package utils + +import ( + db "Open_IM/pkg/common/db" + imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model" + "Open_IM/pkg/common/token_verify" + open_im_sdk "Open_IM/pkg/proto/sdk_ws" + "Open_IM/pkg/utils" + "math/rand" + "strconv" + "time" +) + +func OperationIDGenerator() string { + return strconv.FormatInt(time.Now().UnixNano()+int64(rand.Uint32()), 10) +} + +func FriendOpenIMCopyDB(dst *db.Friend, src *open_im_sdk.FriendInfo) { + utils.CopyStructFields(dst, src) + dst.FriendUserID = src.FriendUser.UserID + dst.CreateTime = utils.UnixSecondToTime(int64(src.CreateTime)) +} + +func FriendDBCopyOpenIM(dst *open_im_sdk.FriendInfo, src *db.Friend) error { + utils.CopyStructFields(dst, src) + user, err := imdb.GetUserByUserID(src.FriendUserID) + if err != nil { + return utils.Wrap(err, "") + } + utils.CopyStructFields(dst.FriendUser, user) + dst.CreateTime = uint32(src.CreateTime.Unix()) + dst.FriendUser.CreateTime = uint32(user.CreateTime.Unix()) + return nil +} + +// +func FriendRequestOpenIMCopyDB(dst *db.FriendRequest, src *open_im_sdk.FriendRequest) { + utils.CopyStructFields(dst, src) + dst.CreateTime = utils.UnixSecondToTime(int64(src.CreateTime)) + dst.HandleTime = utils.UnixSecondToTime(int64(src.HandleTime)) +} + +func FriendRequestDBCopyOpenIM(dst *open_im_sdk.FriendRequest, src *db.FriendRequest) error { + utils.CopyStructFields(dst, src) + user, err := imdb.GetUserByUserID(src.FromUserID) + if err != nil { + return utils.Wrap(err, "") + } + dst.FromNickname = user.Nickname + dst.FromFaceURL = user.FaceURL + dst.FromGender = user.Gender + user, err = imdb.GetUserByUserID(src.ToUserID) + if err != nil { + return utils.Wrap(err, "") + } + dst.ToNickname = user.Nickname + dst.ToFaceURL = user.FaceURL + dst.ToGender = user.Gender + dst.CreateTime = uint32(src.CreateTime.Unix()) + dst.HandleTime = uint32(src.HandleTime.Unix()) + return nil +} + +func BlackOpenIMCopyDB(dst *db.Black, src *open_im_sdk.BlackInfo) { + utils.CopyStructFields(dst, src) + dst.BlockUserID = src.BlackUserInfo.UserID + dst.CreateTime = utils.UnixSecondToTime(int64(src.CreateTime)) +} + +func BlackDBCopyOpenIM(dst *open_im_sdk.BlackInfo, src *db.Black) error { + utils.CopyStructFields(dst, src) + dst.CreateTime = uint32(src.CreateTime.Unix()) + user, err := imdb.GetUserByUserID(src.BlockUserID) + if err != nil { + return utils.Wrap(err, "") + } + utils.CopyStructFields(dst.BlackUserInfo, user) + return nil +} + +func GroupOpenIMCopyDB(dst *db.Group, src *open_im_sdk.GroupInfo) { + utils.CopyStructFields(dst, src) +} + +func GroupDBCopyOpenIM(dst *open_im_sdk.GroupInfo, src *db.Group) error { + utils.CopyStructFields(dst, src) + user, err := imdb.GetGroupOwnerInfoByGroupID(src.GroupID) + if err != nil { + return utils.Wrap(err, "") + } + dst.OwnerUserID = user.UserID + + dst.MemberCount, err = imdb.GetGroupMemberNumByGroupID(src.GroupID) + if err != nil { + return utils.Wrap(err, "") + } + dst.CreateTime = uint32(src.CreateTime.Unix()) + return nil +} + +func GroupMemberOpenIMCopyDB(dst *db.GroupMember, src *open_im_sdk.GroupMemberFullInfo) { + utils.CopyStructFields(dst, src) +} + +func GroupMemberDBCopyOpenIM(dst *open_im_sdk.GroupMemberFullInfo, src *db.GroupMember) error { + utils.CopyStructFields(dst, src) + if token_verify.IsMangerUserID(src.UserID) { + u, err := imdb.GetUserByUserID(src.UserID) + if err != nil { + return utils.Wrap(err, "") + } + + utils.CopyStructFields(dst, u) + + dst.AppMangerLevel = 1 + } + dst.JoinTime = src.JoinTime.Unix() + return nil +} + +func GroupRequestOpenIMCopyDB(dst *db.GroupRequest, src *open_im_sdk.GroupRequest) { + utils.CopyStructFields(dst, src) +} + +func GroupRequestDBCopyOpenIM(dst *open_im_sdk.GroupRequest, src *db.GroupRequest) { + utils.CopyStructFields(dst, src) + dst.ReqTime = uint32(src.ReqTime.Unix()) + dst.HandleTime = uint32(src.HandledTime.Unix()) +} + +func UserOpenIMCopyDB(dst *db.User, src *open_im_sdk.UserInfo) { + utils.CopyStructFields(dst, src) + dst.Birth = utils.UnixSecondToTime(int64(src.Birth)) + dst.CreateTime = utils.UnixSecondToTime(int64(src.CreateTime)) +} + +func UserDBCopyOpenIM(dst *open_im_sdk.UserInfo, src *db.User) { + utils.CopyStructFields(dst, src) + dst.CreateTime = uint32(src.CreateTime.Unix()) + dst.Birth = uint32(src.Birth.Unix()) +} + +func UserDBCopyOpenIMPublicUser(dst *open_im_sdk.PublicUserInfo, src *db.User) { + utils.CopyStructFields(dst, src) +} + +// +//func PublicUserDBCopyOpenIM(dst *open_im_sdk.PublicUserInfo, src *db.User){ +// +//} diff --git a/pkg/proto/auth/auth.pb.go b/pkg/proto/auth/auth.pb.go index 71ab5fe7a..3941570ee 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_88965eda3ab7f34d, []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_88965eda3ab7f34d, []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_88965eda3ab7f34d, []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_88965eda3ab7f34d, []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_88965eda3ab7f34d, []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,32 @@ 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_88965eda3ab7f34d) } -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_88965eda3ab7f34d = []byte{ + // 369 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0x4d, 0x4b, 0xc3, 0x40, + 0x10, 0x25, 0xf6, 0xc3, 0x76, 0x6a, 0xa9, 0x2c, 0x55, 0x43, 0x04, 0xa9, 0x39, 0xf5, 0x94, 0x40, + 0x3d, 0x28, 0x08, 0x42, 0xad, 0x16, 0x7a, 0x28, 0x95, 0xa5, 0x5e, 0xbc, 0x84, 0x94, 0x6e, 0xdb, + 0x90, 0x26, 0xbb, 0xee, 0xa6, 0x56, 0xf0, 0xe8, 0xc5, 0x9f, 0x2d, 0xbb, 0xf9, 0x70, 0xad, 0x3d, + 0x79, 0x49, 0x98, 0x79, 0x2f, 0xf3, 0xde, 0x9b, 0x0c, 0xb4, 0xfc, 0x4d, 0xb2, 0x72, 0xe5, 0xc3, + 0x61, 0x9c, 0x26, 0x14, 0x55, 0xd9, 0xac, 0xbf, 0x49, 0x56, 0xd6, 0xe5, 0x84, 0x91, 0xd8, 0x1b, + 0x8d, 0x5d, 0x16, 0x2e, 0x5d, 0x05, 0xb9, 0x62, 0x1e, 0x7a, 0x5b, 0xe1, 0x6e, 0x45, 0x4a, 0xb5, + 0xef, 0x00, 0x06, 0x34, 0x8a, 0x68, 0x8c, 0x89, 0x60, 0xc8, 0x84, 0x43, 0xc2, 0xf9, 0x80, 0xce, + 0x89, 0x69, 0x74, 0x8c, 0x6e, 0x05, 0xe7, 0x25, 0x3a, 0x85, 0x2a, 0xe1, 0x7c, 0x2c, 0x96, 0xe6, + 0x41, 0xc7, 0xe8, 0xd6, 0x71, 0x56, 0xd9, 0x6b, 0x68, 0x3d, 0x0b, 0xc2, 0x31, 0x59, 0x06, 0x22, + 0x91, 0xef, 0x57, 0x74, 0x0d, 0x35, 0xd9, 0x1a, 0xc5, 0x0b, 0xaa, 0xa6, 0x34, 0x7a, 0xe7, 0x8e, + 0x20, 0xfc, 0x8d, 0x70, 0xcf, 0x67, 0x81, 0xc7, 0x7c, 0xee, 0x47, 0xc2, 0xc9, 0x29, 0xb8, 0x20, + 0xa3, 0x0e, 0x34, 0x26, 0x8c, 0x70, 0x3f, 0x09, 0x68, 0x3c, 0x7a, 0xc8, 0x84, 0xf4, 0x96, 0x3d, + 0x84, 0xe3, 0xdf, 0x6a, 0x82, 0xa1, 0x9e, 0x9e, 0x20, 0x13, 0x44, 0x4e, 0xba, 0x01, 0xe7, 0x07, + 0xc1, 0x1a, 0xcb, 0xfe, 0x32, 0xe0, 0x48, 0x0e, 0x9a, 0xd2, 0x90, 0xc4, 0xd2, 0xb3, 0x05, 0xb5, + 0xa7, 0xb5, 0x9f, 0x2c, 0x28, 0x8f, 0xb2, 0xe4, 0x45, 0x8d, 0x2e, 0x00, 0x86, 0x9c, 0x46, 0xca, + 0x66, 0xee, 0x4a, 0xeb, 0xc8, 0x6f, 0x27, 0x2c, 0x43, 0x4b, 0x0a, 0x2d, 0xea, 0xdd, 0x48, 0xe5, + 0xbf, 0x91, 0x3e, 0xa0, 0xa9, 0x39, 0xf9, 0x5f, 0x1e, 0xd4, 0x86, 0x8a, 0x1a, 0x90, 0xb9, 0x4b, + 0x0b, 0x29, 0xfe, 0xf8, 0xce, 0x02, 0x4e, 0xe6, 0xd3, 0x20, 0x22, 0xca, 0x5b, 0x09, 0xeb, 0xad, + 0xde, 0xa7, 0x01, 0x65, 0x39, 0x17, 0xf5, 0xd3, 0x7d, 0xe4, 0x8b, 0x45, 0x67, 0xb9, 0xe0, 0xce, + 0xcf, 0xb5, 0xcc, 0xfd, 0x80, 0x60, 0xe8, 0x06, 0xea, 0x45, 0x10, 0xd4, 0xd6, 0x69, 0xf9, 0x96, + 0xad, 0x93, 0x3d, 0x5d, 0xc1, 0xee, 0x5b, 0x2f, 0x4d, 0x47, 0x9d, 0xef, 0x6d, 0x0a, 0xcf, 0xaa, + 0xea, 0x36, 0xaf, 0xbe, 0x03, 0x00, 0x00, 0xff, 0xff, 0x1b, 0x20, 0x74, 0x9f, 0xd9, 0x02, 0x00, + 0x00, } diff --git a/pkg/proto/auth/auth.proto b/pkg/proto/auth/auth.proto index 21b82ff40..c91921fe9 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 { + server_api_params.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/auto_proto.sh b/pkg/proto/auto_proto.sh index 309186817..25408d46e 100644 --- a/pkg/proto/auto_proto.sh +++ b/pkg/proto/auto_proto.sh @@ -4,7 +4,7 @@ source ./proto_dir.cfg for ((i = 0; i < ${#all_proto[*]}; i++)); do proto=${all_proto[$i]} - protoc --go_out=plugins=grpc:. $proto + protoc -I ../../../ -I ./ --go_out=plugins=grpc:. $proto s=`echo $proto | sed 's/ //g'` v=${s//proto/pb.go} protoc-go-inject-tag -input=./$v diff --git a/pkg/proto/base/base.proto b/pkg/proto/base/base.proto new file mode 100644 index 000000000..6d5144f0b --- /dev/null +++ b/pkg/proto/base/base.proto @@ -0,0 +1,5 @@ +syntax = "proto3"; +package base; + + + diff --git a/pkg/proto/chat/chat.pb.go b/pkg/proto/chat/chat.pb.go index dfe51b472..5d4fd0bec 100644 --- a/pkg/proto/chat/chat.pb.go +++ b/pkg/proto/chat/chat.pb.go @@ -6,6 +6,7 @@ package pbChat // import "./chat" 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,524 +24,172 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package -type WSToMsgSvrChatMsg struct { - SendID string `protobuf:"bytes,1,opt,name=SendID" json:"SendID,omitempty"` - RecvID string `protobuf:"bytes,2,opt,name=RecvID" json:"RecvID,omitempty"` - Content string `protobuf:"bytes,3,opt,name=Content" json:"Content,omitempty"` - SendTime int64 `protobuf:"varint,4,opt,name=SendTime" json:"SendTime,omitempty"` - MsgFrom int32 `protobuf:"varint,5,opt,name=MsgFrom" json:"MsgFrom,omitempty"` - SenderNickName string `protobuf:"bytes,6,opt,name=SenderNickName" json:"SenderNickName,omitempty"` - SenderFaceURL string `protobuf:"bytes,7,opt,name=SenderFaceURL" json:"SenderFaceURL,omitempty"` - ContentType int32 `protobuf:"varint,8,opt,name=ContentType" json:"ContentType,omitempty"` - SessionType int32 `protobuf:"varint,9,opt,name=SessionType" json:"SessionType,omitempty"` - OperationID string `protobuf:"bytes,10,opt,name=OperationID" json:"OperationID,omitempty"` - MsgID string `protobuf:"bytes,11,opt,name=MsgID" json:"MsgID,omitempty"` - Token string `protobuf:"bytes,12,opt,name=Token" json:"Token,omitempty"` - OfflineInfo string `protobuf:"bytes,13,opt,name=OfflineInfo" json:"OfflineInfo,omitempty"` - Options string `protobuf:"bytes,14,opt,name=Options" json:"Options,omitempty"` - PlatformID int32 `protobuf:"varint,15,opt,name=PlatformID" json:"PlatformID,omitempty"` - ForceList []string `protobuf:"bytes,16,rep,name=ForceList" json:"ForceList,omitempty"` - ClientMsgID string `protobuf:"bytes,17,opt,name=ClientMsgID" json:"ClientMsgID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +type MsgDataToMQ struct { + Token string `protobuf:"bytes,1,opt,name=token" json:"token,omitempty"` + OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` + MsgData *sdk_ws.MsgData `protobuf:"bytes,3,opt,name=msgData" json:"msgData,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *WSToMsgSvrChatMsg) Reset() { *m = WSToMsgSvrChatMsg{} } -func (m *WSToMsgSvrChatMsg) String() string { return proto.CompactTextString(m) } -func (*WSToMsgSvrChatMsg) ProtoMessage() {} -func (*WSToMsgSvrChatMsg) Descriptor() ([]byte, []int) { - return fileDescriptor_chat_163a8d226aa6edb5, []int{0} +func (m *MsgDataToMQ) Reset() { *m = MsgDataToMQ{} } +func (m *MsgDataToMQ) String() string { return proto.CompactTextString(m) } +func (*MsgDataToMQ) ProtoMessage() {} +func (*MsgDataToMQ) Descriptor() ([]byte, []int) { + return fileDescriptor_chat_68ff093a75fc0634, []int{0} } -func (m *WSToMsgSvrChatMsg) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WSToMsgSvrChatMsg.Unmarshal(m, b) +func (m *MsgDataToMQ) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MsgDataToMQ.Unmarshal(m, b) } -func (m *WSToMsgSvrChatMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WSToMsgSvrChatMsg.Marshal(b, m, deterministic) +func (m *MsgDataToMQ) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MsgDataToMQ.Marshal(b, m, deterministic) } -func (dst *WSToMsgSvrChatMsg) XXX_Merge(src proto.Message) { - xxx_messageInfo_WSToMsgSvrChatMsg.Merge(dst, src) +func (dst *MsgDataToMQ) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDataToMQ.Merge(dst, src) } -func (m *WSToMsgSvrChatMsg) XXX_Size() int { - return xxx_messageInfo_WSToMsgSvrChatMsg.Size(m) +func (m *MsgDataToMQ) XXX_Size() int { + return xxx_messageInfo_MsgDataToMQ.Size(m) } -func (m *WSToMsgSvrChatMsg) XXX_DiscardUnknown() { - xxx_messageInfo_WSToMsgSvrChatMsg.DiscardUnknown(m) +func (m *MsgDataToMQ) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDataToMQ.DiscardUnknown(m) } -var xxx_messageInfo_WSToMsgSvrChatMsg proto.InternalMessageInfo +var xxx_messageInfo_MsgDataToMQ proto.InternalMessageInfo -func (m *WSToMsgSvrChatMsg) GetSendID() string { - if m != nil { - return m.SendID - } - return "" -} - -func (m *WSToMsgSvrChatMsg) GetRecvID() string { - if m != nil { - return m.RecvID - } - return "" -} - -func (m *WSToMsgSvrChatMsg) GetContent() string { - if m != nil { - return m.Content - } - return "" -} - -func (m *WSToMsgSvrChatMsg) GetSendTime() int64 { - if m != nil { - return m.SendTime - } - return 0 -} - -func (m *WSToMsgSvrChatMsg) GetMsgFrom() int32 { - if m != nil { - return m.MsgFrom - } - return 0 -} - -func (m *WSToMsgSvrChatMsg) GetSenderNickName() string { - if m != nil { - return m.SenderNickName - } - return "" -} - -func (m *WSToMsgSvrChatMsg) GetSenderFaceURL() string { - if m != nil { - return m.SenderFaceURL - } - return "" -} - -func (m *WSToMsgSvrChatMsg) GetContentType() int32 { - if m != nil { - return m.ContentType - } - return 0 -} - -func (m *WSToMsgSvrChatMsg) GetSessionType() int32 { - if m != nil { - return m.SessionType - } - return 0 -} - -func (m *WSToMsgSvrChatMsg) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - -func (m *WSToMsgSvrChatMsg) GetMsgID() string { - if m != nil { - return m.MsgID - } - return "" -} - -func (m *WSToMsgSvrChatMsg) GetToken() string { +func (m *MsgDataToMQ) GetToken() string { if m != nil { return m.Token } return "" } -func (m *WSToMsgSvrChatMsg) GetOfflineInfo() string { +func (m *MsgDataToMQ) GetOperationID() string { if m != nil { - return m.OfflineInfo + return m.OperationID } return "" } -func (m *WSToMsgSvrChatMsg) GetOptions() string { +func (m *MsgDataToMQ) GetMsgData() *sdk_ws.MsgData { if m != nil { - return m.Options - } - return "" -} - -func (m *WSToMsgSvrChatMsg) GetPlatformID() int32 { - if m != nil { - return m.PlatformID - } - return 0 -} - -func (m *WSToMsgSvrChatMsg) GetForceList() []string { - if m != nil { - return m.ForceList + return m.MsgData } return nil } -func (m *WSToMsgSvrChatMsg) GetClientMsgID() string { - if m != nil { - return m.ClientMsgID - } - return "" -} - -type MsgSvrToPushSvrChatMsg struct { - SendID string `protobuf:"bytes,1,opt,name=SendID" json:"SendID,omitempty"` - RecvID string `protobuf:"bytes,2,opt,name=RecvID" json:"RecvID,omitempty"` - Content string `protobuf:"bytes,3,opt,name=Content" json:"Content,omitempty"` - RecvSeq int64 `protobuf:"varint,4,opt,name=RecvSeq" json:"RecvSeq,omitempty"` - SendTime int64 `protobuf:"varint,5,opt,name=SendTime" json:"SendTime,omitempty"` - MsgFrom int32 `protobuf:"varint,6,opt,name=MsgFrom" json:"MsgFrom,omitempty"` - SenderNickName string `protobuf:"bytes,7,opt,name=SenderNickName" json:"SenderNickName,omitempty"` - SenderFaceURL string `protobuf:"bytes,8,opt,name=SenderFaceURL" json:"SenderFaceURL,omitempty"` - ContentType int32 `protobuf:"varint,9,opt,name=ContentType" json:"ContentType,omitempty"` - SessionType int32 `protobuf:"varint,10,opt,name=SessionType" json:"SessionType,omitempty"` - OperationID string `protobuf:"bytes,11,opt,name=OperationID" json:"OperationID,omitempty"` - MsgID string `protobuf:"bytes,12,opt,name=MsgID" json:"MsgID,omitempty"` - OfflineInfo string `protobuf:"bytes,13,opt,name=OfflineInfo" json:"OfflineInfo,omitempty"` - Options string `protobuf:"bytes,14,opt,name=Options" json:"Options,omitempty"` - PlatformID int32 `protobuf:"varint,15,opt,name=PlatformID" json:"PlatformID,omitempty"` - ClientMsgID string `protobuf:"bytes,16,opt,name=ClientMsgID" json:"ClientMsgID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MsgSvrToPushSvrChatMsg) Reset() { *m = MsgSvrToPushSvrChatMsg{} } -func (m *MsgSvrToPushSvrChatMsg) String() string { return proto.CompactTextString(m) } -func (*MsgSvrToPushSvrChatMsg) ProtoMessage() {} -func (*MsgSvrToPushSvrChatMsg) Descriptor() ([]byte, []int) { - return fileDescriptor_chat_163a8d226aa6edb5, []int{1} -} -func (m *MsgSvrToPushSvrChatMsg) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MsgSvrToPushSvrChatMsg.Unmarshal(m, b) -} -func (m *MsgSvrToPushSvrChatMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MsgSvrToPushSvrChatMsg.Marshal(b, m, deterministic) -} -func (dst *MsgSvrToPushSvrChatMsg) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSvrToPushSvrChatMsg.Merge(dst, src) -} -func (m *MsgSvrToPushSvrChatMsg) XXX_Size() int { - return xxx_messageInfo_MsgSvrToPushSvrChatMsg.Size(m) -} -func (m *MsgSvrToPushSvrChatMsg) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSvrToPushSvrChatMsg.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSvrToPushSvrChatMsg proto.InternalMessageInfo - -func (m *MsgSvrToPushSvrChatMsg) GetSendID() string { - if m != nil { - return m.SendID - } - return "" -} - -func (m *MsgSvrToPushSvrChatMsg) GetRecvID() string { - if m != nil { - return m.RecvID - } - return "" -} - -func (m *MsgSvrToPushSvrChatMsg) GetContent() string { - if m != nil { - return m.Content - } - return "" -} - -func (m *MsgSvrToPushSvrChatMsg) GetRecvSeq() int64 { - if m != nil { - return m.RecvSeq - } - return 0 -} - -func (m *MsgSvrToPushSvrChatMsg) GetSendTime() int64 { - if m != nil { - return m.SendTime - } - return 0 -} - -func (m *MsgSvrToPushSvrChatMsg) GetMsgFrom() int32 { - if m != nil { - return m.MsgFrom - } - return 0 -} - -func (m *MsgSvrToPushSvrChatMsg) GetSenderNickName() string { - if m != nil { - return m.SenderNickName - } - return "" -} - -func (m *MsgSvrToPushSvrChatMsg) GetSenderFaceURL() string { - if m != nil { - return m.SenderFaceURL - } - return "" -} - -func (m *MsgSvrToPushSvrChatMsg) GetContentType() int32 { - if m != nil { - return m.ContentType - } - return 0 -} - -func (m *MsgSvrToPushSvrChatMsg) GetSessionType() int32 { - if m != nil { - return m.SessionType - } - return 0 -} - -func (m *MsgSvrToPushSvrChatMsg) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - -func (m *MsgSvrToPushSvrChatMsg) GetMsgID() string { - if m != nil { - return m.MsgID - } - return "" -} - -func (m *MsgSvrToPushSvrChatMsg) GetOfflineInfo() string { - if m != nil { - return m.OfflineInfo - } - return "" -} - -func (m *MsgSvrToPushSvrChatMsg) GetOptions() string { - if m != nil { - return m.Options - } - return "" -} - -func (m *MsgSvrToPushSvrChatMsg) GetPlatformID() int32 { - if m != nil { - return m.PlatformID - } - return 0 -} - -func (m *MsgSvrToPushSvrChatMsg) GetClientMsgID() string { - if m != nil { - return m.ClientMsgID - } - return "" -} - -type PullMessageReq struct { - UserID string `protobuf:"bytes,1,opt,name=UserID" json:"UserID,omitempty"` - SeqBegin int64 `protobuf:"varint,2,opt,name=SeqBegin" json:"SeqBegin,omitempty"` - SeqEnd int64 `protobuf:"varint,3,opt,name=SeqEnd" json:"SeqEnd,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 *PullMessageReq) Reset() { *m = PullMessageReq{} } -func (m *PullMessageReq) String() string { return proto.CompactTextString(m) } -func (*PullMessageReq) ProtoMessage() {} -func (*PullMessageReq) Descriptor() ([]byte, []int) { - return fileDescriptor_chat_163a8d226aa6edb5, []int{2} -} -func (m *PullMessageReq) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PullMessageReq.Unmarshal(m, b) -} -func (m *PullMessageReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PullMessageReq.Marshal(b, m, deterministic) -} -func (dst *PullMessageReq) XXX_Merge(src proto.Message) { - xxx_messageInfo_PullMessageReq.Merge(dst, src) -} -func (m *PullMessageReq) XXX_Size() int { - return xxx_messageInfo_PullMessageReq.Size(m) -} -func (m *PullMessageReq) XXX_DiscardUnknown() { - xxx_messageInfo_PullMessageReq.DiscardUnknown(m) -} - -var xxx_messageInfo_PullMessageReq proto.InternalMessageInfo - -func (m *PullMessageReq) GetUserID() string { - if m != nil { - return m.UserID - } - return "" -} - -func (m *PullMessageReq) GetSeqBegin() int64 { - if m != nil { - return m.SeqBegin - } - return 0 -} - -func (m *PullMessageReq) GetSeqEnd() int64 { - if m != nil { - return m.SeqEnd - } - return 0 -} - -func (m *PullMessageReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - -type PullMessageResp struct { - ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"` - ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"` - MaxSeq int64 `protobuf:"varint,3,opt,name=MaxSeq" json:"MaxSeq,omitempty"` - MinSeq int64 `protobuf:"varint,4,opt,name=MinSeq" json:"MinSeq,omitempty"` - SingleUserMsg []*GatherFormat `protobuf:"bytes,5,rep,name=SingleUserMsg" json:"SingleUserMsg,omitempty"` - GroupUserMsg []*GatherFormat `protobuf:"bytes,6,rep,name=GroupUserMsg" json:"GroupUserMsg,omitempty"` +type MsgDataToDB struct { + MsgData *sdk_ws.MsgData `protobuf:"bytes,1,opt,name=msgData" json:"msgData,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 *PullMessageResp) Reset() { *m = PullMessageResp{} } -func (m *PullMessageResp) String() string { return proto.CompactTextString(m) } -func (*PullMessageResp) ProtoMessage() {} -func (*PullMessageResp) Descriptor() ([]byte, []int) { - return fileDescriptor_chat_163a8d226aa6edb5, []int{3} +func (m *MsgDataToDB) Reset() { *m = MsgDataToDB{} } +func (m *MsgDataToDB) String() string { return proto.CompactTextString(m) } +func (*MsgDataToDB) ProtoMessage() {} +func (*MsgDataToDB) Descriptor() ([]byte, []int) { + return fileDescriptor_chat_68ff093a75fc0634, []int{1} } -func (m *PullMessageResp) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PullMessageResp.Unmarshal(m, b) +func (m *MsgDataToDB) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MsgDataToDB.Unmarshal(m, b) } -func (m *PullMessageResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PullMessageResp.Marshal(b, m, deterministic) +func (m *MsgDataToDB) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MsgDataToDB.Marshal(b, m, deterministic) } -func (dst *PullMessageResp) XXX_Merge(src proto.Message) { - xxx_messageInfo_PullMessageResp.Merge(dst, src) +func (dst *MsgDataToDB) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDataToDB.Merge(dst, src) } -func (m *PullMessageResp) XXX_Size() int { - return xxx_messageInfo_PullMessageResp.Size(m) +func (m *MsgDataToDB) XXX_Size() int { + return xxx_messageInfo_MsgDataToDB.Size(m) } -func (m *PullMessageResp) XXX_DiscardUnknown() { - xxx_messageInfo_PullMessageResp.DiscardUnknown(m) +func (m *MsgDataToDB) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDataToDB.DiscardUnknown(m) } -var xxx_messageInfo_PullMessageResp proto.InternalMessageInfo +var xxx_messageInfo_MsgDataToDB proto.InternalMessageInfo -func (m *PullMessageResp) GetErrCode() int32 { +func (m *MsgDataToDB) GetMsgData() *sdk_ws.MsgData { if m != nil { - return m.ErrCode - } - return 0 -} - -func (m *PullMessageResp) GetErrMsg() string { - if m != nil { - return m.ErrMsg - } - return "" -} - -func (m *PullMessageResp) GetMaxSeq() int64 { - if m != nil { - return m.MaxSeq - } - return 0 -} - -func (m *PullMessageResp) GetMinSeq() int64 { - if m != nil { - return m.MinSeq - } - return 0 -} - -func (m *PullMessageResp) GetSingleUserMsg() []*GatherFormat { - if m != nil { - return m.SingleUserMsg + return m.MsgData } return nil } -func (m *PullMessageResp) GetGroupUserMsg() []*GatherFormat { - if m != nil { - return m.GroupUserMsg - } - return nil -} - -type PullMessageBySeqListReq struct { - UserID string `protobuf:"bytes,1,opt,name=UserID" json:"UserID,omitempty"` - OperationID string `protobuf:"bytes,2,opt,name=OperationID" json:"OperationID,omitempty"` - SeqList []int64 `protobuf:"varint,3,rep,packed,name=seqList" json:"seqList,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PullMessageBySeqListReq) Reset() { *m = PullMessageBySeqListReq{} } -func (m *PullMessageBySeqListReq) String() string { return proto.CompactTextString(m) } -func (*PullMessageBySeqListReq) ProtoMessage() {} -func (*PullMessageBySeqListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_chat_163a8d226aa6edb5, []int{4} -} -func (m *PullMessageBySeqListReq) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PullMessageBySeqListReq.Unmarshal(m, b) -} -func (m *PullMessageBySeqListReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PullMessageBySeqListReq.Marshal(b, m, deterministic) -} -func (dst *PullMessageBySeqListReq) XXX_Merge(src proto.Message) { - xxx_messageInfo_PullMessageBySeqListReq.Merge(dst, src) -} -func (m *PullMessageBySeqListReq) XXX_Size() int { - return xxx_messageInfo_PullMessageBySeqListReq.Size(m) -} -func (m *PullMessageBySeqListReq) XXX_DiscardUnknown() { - xxx_messageInfo_PullMessageBySeqListReq.DiscardUnknown(m) -} - -var xxx_messageInfo_PullMessageBySeqListReq proto.InternalMessageInfo - -func (m *PullMessageBySeqListReq) GetUserID() string { - if m != nil { - return m.UserID - } - return "" -} - -func (m *PullMessageBySeqListReq) GetOperationID() string { +func (m *MsgDataToDB) GetOperationID() string { if m != nil { return m.OperationID } return "" } -func (m *PullMessageBySeqListReq) GetSeqList() []int64 { +type PushMsgDataToMQ struct { + OperationID string `protobuf:"bytes,1,opt,name=OperationID" json:"OperationID,omitempty"` + MsgData *sdk_ws.MsgData `protobuf:"bytes,2,opt,name=msgData" json:"msgData,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PushMsgDataToMQ) Reset() { *m = PushMsgDataToMQ{} } +func (m *PushMsgDataToMQ) String() string { return proto.CompactTextString(m) } +func (*PushMsgDataToMQ) ProtoMessage() {} +func (*PushMsgDataToMQ) Descriptor() ([]byte, []int) { + return fileDescriptor_chat_68ff093a75fc0634, []int{2} +} +func (m *PushMsgDataToMQ) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PushMsgDataToMQ.Unmarshal(m, b) +} +func (m *PushMsgDataToMQ) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PushMsgDataToMQ.Marshal(b, m, deterministic) +} +func (dst *PushMsgDataToMQ) XXX_Merge(src proto.Message) { + xxx_messageInfo_PushMsgDataToMQ.Merge(dst, src) +} +func (m *PushMsgDataToMQ) XXX_Size() int { + return xxx_messageInfo_PushMsgDataToMQ.Size(m) +} +func (m *PushMsgDataToMQ) XXX_DiscardUnknown() { + xxx_messageInfo_PushMsgDataToMQ.DiscardUnknown(m) +} + +var xxx_messageInfo_PushMsgDataToMQ proto.InternalMessageInfo + +func (m *PushMsgDataToMQ) GetOperationID() string { if m != nil { - return m.SeqList + return m.OperationID + } + return "" +} + +func (m *PushMsgDataToMQ) GetMsgData() *sdk_ws.MsgData { + if m != nil { + return m.MsgData } return nil } +// message PullMessageReq { +// string UserID = 1; +// int64 SeqBegin = 2; +// int64 SeqEnd = 3; +// string OperationID = 4; +// } +// +// message PullMessageResp { +// int32 ErrCode = 1; +// string ErrMsg = 2; +// int64 MaxSeq = 3; +// int64 MinSeq = 4; +// repeated GatherFormat SingleUserMsg = 5; +// repeated GatherFormat GroupUserMsg = 6; +// } +// message PullMessageBySeqListReq{ +// string UserID = 1; +// string OperationID = 2; +// repeated int64 seqList =3; +// } type GetMaxAndMinSeqReq struct { UserID string `protobuf:"bytes,1,opt,name=UserID" json:"UserID,omitempty"` OperationID string `protobuf:"bytes,2,opt,name=OperationID" json:"OperationID,omitempty"` @@ -553,7 +202,7 @@ func (m *GetMaxAndMinSeqReq) Reset() { *m = GetMaxAndMinSeqReq{} } func (m *GetMaxAndMinSeqReq) String() string { return proto.CompactTextString(m) } func (*GetMaxAndMinSeqReq) ProtoMessage() {} func (*GetMaxAndMinSeqReq) Descriptor() ([]byte, []int) { - return fileDescriptor_chat_163a8d226aa6edb5, []int{5} + return fileDescriptor_chat_68ff093a75fc0634, []int{3} } func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b) @@ -590,8 +239,8 @@ func (m *GetMaxAndMinSeqReq) GetOperationID() string { type GetMaxAndMinSeqResp struct { ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"` ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"` - MaxSeq int64 `protobuf:"varint,3,opt,name=MaxSeq" json:"MaxSeq,omitempty"` - MinSeq int64 `protobuf:"varint,4,opt,name=MinSeq" json:"MinSeq,omitempty"` + MaxSeq uint32 `protobuf:"varint,3,opt,name=MaxSeq" json:"MaxSeq,omitempty"` + MinSeq uint32 `protobuf:"varint,4,opt,name=MinSeq" json:"MinSeq,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -601,7 +250,7 @@ func (m *GetMaxAndMinSeqResp) Reset() { *m = GetMaxAndMinSeqResp{} } func (m *GetMaxAndMinSeqResp) String() string { return proto.CompactTextString(m) } func (*GetMaxAndMinSeqResp) ProtoMessage() {} func (*GetMaxAndMinSeqResp) Descriptor() ([]byte, []int) { - return fileDescriptor_chat_163a8d226aa6edb5, []int{6} + return fileDescriptor_chat_68ff093a75fc0634, []int{4} } func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b) @@ -635,452 +284,138 @@ func (m *GetMaxAndMinSeqResp) GetErrMsg() string { return "" } -func (m *GetMaxAndMinSeqResp) GetMaxSeq() int64 { +func (m *GetMaxAndMinSeqResp) GetMaxSeq() uint32 { if m != nil { return m.MaxSeq } return 0 } -func (m *GetMaxAndMinSeqResp) GetMinSeq() int64 { +func (m *GetMaxAndMinSeqResp) GetMinSeq() uint32 { if m != nil { return m.MinSeq } return 0 } -type GatherFormat struct { - // @inject_tag: json:"id" - ID string `protobuf:"bytes,1,opt,name=ID" json:"id"` - // @inject_tag: json:"list" - List []*MsgFormat `protobuf:"bytes,2,rep,name=List" json:"list"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +type SendMsgReq struct { + Token string `protobuf:"bytes,1,opt,name=token" json:"token,omitempty"` + OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` + MsgData *sdk_ws.MsgData `protobuf:"bytes,3,opt,name=msgData" json:"msgData,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *GatherFormat) Reset() { *m = GatherFormat{} } -func (m *GatherFormat) String() string { return proto.CompactTextString(m) } -func (*GatherFormat) ProtoMessage() {} -func (*GatherFormat) Descriptor() ([]byte, []int) { - return fileDescriptor_chat_163a8d226aa6edb5, []int{7} +func (m *SendMsgReq) Reset() { *m = SendMsgReq{} } +func (m *SendMsgReq) String() string { return proto.CompactTextString(m) } +func (*SendMsgReq) ProtoMessage() {} +func (*SendMsgReq) Descriptor() ([]byte, []int) { + return fileDescriptor_chat_68ff093a75fc0634, []int{5} } -func (m *GatherFormat) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GatherFormat.Unmarshal(m, b) +func (m *SendMsgReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SendMsgReq.Unmarshal(m, b) } -func (m *GatherFormat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GatherFormat.Marshal(b, m, deterministic) +func (m *SendMsgReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SendMsgReq.Marshal(b, m, deterministic) } -func (dst *GatherFormat) XXX_Merge(src proto.Message) { - xxx_messageInfo_GatherFormat.Merge(dst, src) +func (dst *SendMsgReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_SendMsgReq.Merge(dst, src) } -func (m *GatherFormat) XXX_Size() int { - return xxx_messageInfo_GatherFormat.Size(m) +func (m *SendMsgReq) XXX_Size() int { + return xxx_messageInfo_SendMsgReq.Size(m) } -func (m *GatherFormat) XXX_DiscardUnknown() { - xxx_messageInfo_GatherFormat.DiscardUnknown(m) +func (m *SendMsgReq) XXX_DiscardUnknown() { + xxx_messageInfo_SendMsgReq.DiscardUnknown(m) } -var xxx_messageInfo_GatherFormat proto.InternalMessageInfo +var xxx_messageInfo_SendMsgReq proto.InternalMessageInfo -func (m *GatherFormat) GetID() string { - if m != nil { - return m.ID - } - return "" -} - -func (m *GatherFormat) GetList() []*MsgFormat { - if m != nil { - return m.List - } - return nil -} - -type MsgFormat struct { - // @inject_tag: json:"sendID" - SendID string `protobuf:"bytes,1,opt,name=SendID" json:"sendID"` - // @inject_tag: json:"recvID" - RecvID string `protobuf:"bytes,2,opt,name=RecvID" json:"recvID"` - // @inject_tag: json:"msgFrom" - MsgFrom int32 `protobuf:"varint,3,opt,name=MsgFrom" json:"msgFrom"` - // @inject_tag: json:"contentType" - ContentType int32 `protobuf:"varint,4,opt,name=ContentType" json:"contentType"` - // @inject_tag: json:"serverMsgID" - ServerMsgID string `protobuf:"bytes,5,opt,name=ServerMsgID" json:"serverMsgID"` - // @inject_tag: json:"content" - Content string `protobuf:"bytes,6,opt,name=Content" json:"content"` - // @inject_tag: json:"seq" - Seq int64 `protobuf:"varint,7,opt,name=Seq" json:"seq"` - // @inject_tag: json:"sendTime" - SendTime int64 `protobuf:"varint,8,opt,name=SendTime" json:"sendTime"` - // @inject_tag: json:"senderPlatformID" - SenderPlatformID int32 `protobuf:"varint,9,opt,name=SenderPlatformID" json:"senderPlatformID"` - // @inject_tag: json:"senderNickName" - SenderNickName string `protobuf:"bytes,10,opt,name=SenderNickName" json:"senderNickName"` - // @inject_tag: json:"senderFaceUrl" - SenderFaceURL string `protobuf:"bytes,11,opt,name=SenderFaceURL" json:"senderFaceUrl"` - // @inject_tag: json:"clientMsgID" - ClientMsgID string `protobuf:"bytes,12,opt,name=ClientMsgID" json:"clientMsgID"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MsgFormat) Reset() { *m = MsgFormat{} } -func (m *MsgFormat) String() string { return proto.CompactTextString(m) } -func (*MsgFormat) ProtoMessage() {} -func (*MsgFormat) Descriptor() ([]byte, []int) { - return fileDescriptor_chat_163a8d226aa6edb5, []int{8} -} -func (m *MsgFormat) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MsgFormat.Unmarshal(m, b) -} -func (m *MsgFormat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MsgFormat.Marshal(b, m, deterministic) -} -func (dst *MsgFormat) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgFormat.Merge(dst, src) -} -func (m *MsgFormat) XXX_Size() int { - return xxx_messageInfo_MsgFormat.Size(m) -} -func (m *MsgFormat) XXX_DiscardUnknown() { - xxx_messageInfo_MsgFormat.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgFormat proto.InternalMessageInfo - -func (m *MsgFormat) GetSendID() string { - if m != nil { - return m.SendID - } - return "" -} - -func (m *MsgFormat) GetRecvID() string { - if m != nil { - return m.RecvID - } - return "" -} - -func (m *MsgFormat) GetMsgFrom() int32 { - if m != nil { - return m.MsgFrom - } - return 0 -} - -func (m *MsgFormat) GetContentType() int32 { - if m != nil { - return m.ContentType - } - return 0 -} - -func (m *MsgFormat) GetServerMsgID() string { - if m != nil { - return m.ServerMsgID - } - return "" -} - -func (m *MsgFormat) GetContent() string { - if m != nil { - return m.Content - } - return "" -} - -func (m *MsgFormat) GetSeq() int64 { - if m != nil { - return m.Seq - } - return 0 -} - -func (m *MsgFormat) GetSendTime() int64 { - if m != nil { - return m.SendTime - } - return 0 -} - -func (m *MsgFormat) GetSenderPlatformID() int32 { - if m != nil { - return m.SenderPlatformID - } - return 0 -} - -func (m *MsgFormat) GetSenderNickName() string { - if m != nil { - return m.SenderNickName - } - return "" -} - -func (m *MsgFormat) GetSenderFaceURL() string { - if m != nil { - return m.SenderFaceURL - } - return "" -} - -func (m *MsgFormat) GetClientMsgID() string { - if m != nil { - return m.ClientMsgID - } - return "" -} - -type UserSendMsgReq struct { - ReqIdentifier int32 `protobuf:"varint,1,opt,name=ReqIdentifier" json:"ReqIdentifier,omitempty"` - Token string `protobuf:"bytes,2,opt,name=Token" json:"Token,omitempty"` - SendID string `protobuf:"bytes,3,opt,name=SendID" json:"SendID,omitempty"` - OperationID string `protobuf:"bytes,4,opt,name=OperationID" json:"OperationID,omitempty"` - SenderNickName string `protobuf:"bytes,5,opt,name=SenderNickName" json:"SenderNickName,omitempty"` - SenderFaceURL string `protobuf:"bytes,6,opt,name=SenderFaceURL" json:"SenderFaceURL,omitempty"` - PlatformID int32 `protobuf:"varint,7,opt,name=PlatformID" json:"PlatformID,omitempty"` - SessionType int32 `protobuf:"varint,8,opt,name=SessionType" json:"SessionType,omitempty"` - MsgFrom int32 `protobuf:"varint,9,opt,name=MsgFrom" json:"MsgFrom,omitempty"` - ContentType int32 `protobuf:"varint,10,opt,name=ContentType" json:"ContentType,omitempty"` - RecvID string `protobuf:"bytes,11,opt,name=RecvID" json:"RecvID,omitempty"` - ForceList []string `protobuf:"bytes,12,rep,name=ForceList" json:"ForceList,omitempty"` - Content string `protobuf:"bytes,13,opt,name=Content" json:"Content,omitempty"` - Options string `protobuf:"bytes,14,opt,name=Options" json:"Options,omitempty"` - ClientMsgID string `protobuf:"bytes,15,opt,name=ClientMsgID" json:"ClientMsgID,omitempty"` - OffLineInfo string `protobuf:"bytes,16,opt,name=OffLineInfo" json:"OffLineInfo,omitempty"` - Ex string `protobuf:"bytes,17,opt,name=Ex" json:"Ex,omitempty"` - SendTime int64 `protobuf:"varint,18,opt,name=sendTime" json:"sendTime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UserSendMsgReq) Reset() { *m = UserSendMsgReq{} } -func (m *UserSendMsgReq) String() string { return proto.CompactTextString(m) } -func (*UserSendMsgReq) ProtoMessage() {} -func (*UserSendMsgReq) Descriptor() ([]byte, []int) { - return fileDescriptor_chat_163a8d226aa6edb5, []int{9} -} -func (m *UserSendMsgReq) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UserSendMsgReq.Unmarshal(m, b) -} -func (m *UserSendMsgReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UserSendMsgReq.Marshal(b, m, deterministic) -} -func (dst *UserSendMsgReq) XXX_Merge(src proto.Message) { - xxx_messageInfo_UserSendMsgReq.Merge(dst, src) -} -func (m *UserSendMsgReq) XXX_Size() int { - return xxx_messageInfo_UserSendMsgReq.Size(m) -} -func (m *UserSendMsgReq) XXX_DiscardUnknown() { - xxx_messageInfo_UserSendMsgReq.DiscardUnknown(m) -} - -var xxx_messageInfo_UserSendMsgReq proto.InternalMessageInfo - -func (m *UserSendMsgReq) GetReqIdentifier() int32 { - if m != nil { - return m.ReqIdentifier - } - return 0 -} - -func (m *UserSendMsgReq) GetToken() string { +func (m *SendMsgReq) GetToken() string { if m != nil { return m.Token } return "" } -func (m *UserSendMsgReq) GetSendID() string { - if m != nil { - return m.SendID - } - return "" -} - -func (m *UserSendMsgReq) GetOperationID() string { +func (m *SendMsgReq) GetOperationID() string { if m != nil { return m.OperationID } return "" } -func (m *UserSendMsgReq) GetSenderNickName() string { +func (m *SendMsgReq) GetMsgData() *sdk_ws.MsgData { if m != nil { - return m.SenderNickName - } - return "" -} - -func (m *UserSendMsgReq) GetSenderFaceURL() string { - if m != nil { - return m.SenderFaceURL - } - return "" -} - -func (m *UserSendMsgReq) GetPlatformID() int32 { - if m != nil { - return m.PlatformID - } - return 0 -} - -func (m *UserSendMsgReq) GetSessionType() int32 { - if m != nil { - return m.SessionType - } - return 0 -} - -func (m *UserSendMsgReq) GetMsgFrom() int32 { - if m != nil { - return m.MsgFrom - } - return 0 -} - -func (m *UserSendMsgReq) GetContentType() int32 { - if m != nil { - return m.ContentType - } - return 0 -} - -func (m *UserSendMsgReq) GetRecvID() string { - if m != nil { - return m.RecvID - } - return "" -} - -func (m *UserSendMsgReq) GetForceList() []string { - if m != nil { - return m.ForceList + return m.MsgData } return nil } -func (m *UserSendMsgReq) GetContent() string { - if m != nil { - return m.Content - } - return "" -} - -func (m *UserSendMsgReq) GetOptions() string { - if m != nil { - return m.Options - } - return "" -} - -func (m *UserSendMsgReq) GetClientMsgID() string { - if m != nil { - return m.ClientMsgID - } - return "" -} - -func (m *UserSendMsgReq) GetOffLineInfo() string { - if m != nil { - return m.OffLineInfo - } - return "" -} - -func (m *UserSendMsgReq) GetEx() string { - if m != nil { - return m.Ex - } - return "" -} - -func (m *UserSendMsgReq) GetSendTime() int64 { - if m != nil { - return m.SendTime - } - return 0 -} - -type UserSendMsgResp struct { - ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"` - ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"` - ReqIdentifier int32 `protobuf:"varint,3,opt,name=ReqIdentifier" json:"ReqIdentifier,omitempty"` - ServerMsgID string `protobuf:"bytes,4,opt,name=ServerMsgID" json:"ServerMsgID,omitempty"` - ClientMsgID string `protobuf:"bytes,5,opt,name=ClientMsgID" json:"ClientMsgID,omitempty"` +type SendMsgResp struct { + ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` + ServerMsgID string `protobuf:"bytes,4,opt,name=serverMsgID" json:"serverMsgID,omitempty"` + ClientMsgID string `protobuf:"bytes,5,opt,name=clientMsgID" json:"clientMsgID,omitempty"` SendTime int64 `protobuf:"varint,6,opt,name=sendTime" json:"sendTime,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *UserSendMsgResp) Reset() { *m = UserSendMsgResp{} } -func (m *UserSendMsgResp) String() string { return proto.CompactTextString(m) } -func (*UserSendMsgResp) ProtoMessage() {} -func (*UserSendMsgResp) Descriptor() ([]byte, []int) { - return fileDescriptor_chat_163a8d226aa6edb5, []int{10} +func (m *SendMsgResp) Reset() { *m = SendMsgResp{} } +func (m *SendMsgResp) String() string { return proto.CompactTextString(m) } +func (*SendMsgResp) ProtoMessage() {} +func (*SendMsgResp) Descriptor() ([]byte, []int) { + return fileDescriptor_chat_68ff093a75fc0634, []int{6} } -func (m *UserSendMsgResp) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UserSendMsgResp.Unmarshal(m, b) +func (m *SendMsgResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SendMsgResp.Unmarshal(m, b) } -func (m *UserSendMsgResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UserSendMsgResp.Marshal(b, m, deterministic) +func (m *SendMsgResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SendMsgResp.Marshal(b, m, deterministic) } -func (dst *UserSendMsgResp) XXX_Merge(src proto.Message) { - xxx_messageInfo_UserSendMsgResp.Merge(dst, src) +func (dst *SendMsgResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_SendMsgResp.Merge(dst, src) } -func (m *UserSendMsgResp) XXX_Size() int { - return xxx_messageInfo_UserSendMsgResp.Size(m) +func (m *SendMsgResp) XXX_Size() int { + return xxx_messageInfo_SendMsgResp.Size(m) } -func (m *UserSendMsgResp) XXX_DiscardUnknown() { - xxx_messageInfo_UserSendMsgResp.DiscardUnknown(m) +func (m *SendMsgResp) XXX_DiscardUnknown() { + xxx_messageInfo_SendMsgResp.DiscardUnknown(m) } -var xxx_messageInfo_UserSendMsgResp proto.InternalMessageInfo +var xxx_messageInfo_SendMsgResp proto.InternalMessageInfo -func (m *UserSendMsgResp) GetErrCode() int32 { +func (m *SendMsgResp) GetErrCode() int32 { if m != nil { return m.ErrCode } return 0 } -func (m *UserSendMsgResp) GetErrMsg() string { +func (m *SendMsgResp) GetErrMsg() string { if m != nil { return m.ErrMsg } return "" } -func (m *UserSendMsgResp) GetReqIdentifier() int32 { - if m != nil { - return m.ReqIdentifier - } - return 0 -} - -func (m *UserSendMsgResp) GetServerMsgID() string { +func (m *SendMsgResp) GetServerMsgID() string { if m != nil { return m.ServerMsgID } return "" } -func (m *UserSendMsgResp) GetClientMsgID() string { +func (m *SendMsgResp) GetClientMsgID() string { if m != nil { return m.ClientMsgID } return "" } -func (m *UserSendMsgResp) GetSendTime() int64 { +func (m *SendMsgResp) GetSendTime() int64 { if m != nil { return m.SendTime } @@ -1088,17 +423,13 @@ func (m *UserSendMsgResp) GetSendTime() int64 { } func init() { - proto.RegisterType((*WSToMsgSvrChatMsg)(nil), "pbChat.WSToMsgSvrChatMsg") - proto.RegisterType((*MsgSvrToPushSvrChatMsg)(nil), "pbChat.MsgSvrToPushSvrChatMsg") - proto.RegisterType((*PullMessageReq)(nil), "pbChat.PullMessageReq") - proto.RegisterType((*PullMessageResp)(nil), "pbChat.PullMessageResp") - proto.RegisterType((*PullMessageBySeqListReq)(nil), "pbChat.PullMessageBySeqListReq") + proto.RegisterType((*MsgDataToMQ)(nil), "pbChat.MsgDataToMQ") + proto.RegisterType((*MsgDataToDB)(nil), "pbChat.MsgDataToDB") + proto.RegisterType((*PushMsgDataToMQ)(nil), "pbChat.PushMsgDataToMQ") proto.RegisterType((*GetMaxAndMinSeqReq)(nil), "pbChat.GetMaxAndMinSeqReq") proto.RegisterType((*GetMaxAndMinSeqResp)(nil), "pbChat.GetMaxAndMinSeqResp") - proto.RegisterType((*GatherFormat)(nil), "pbChat.GatherFormat") - proto.RegisterType((*MsgFormat)(nil), "pbChat.MsgFormat") - proto.RegisterType((*UserSendMsgReq)(nil), "pbChat.UserSendMsgReq") - proto.RegisterType((*UserSendMsgResp)(nil), "pbChat.UserSendMsgResp") + proto.RegisterType((*SendMsgReq)(nil), "pbChat.SendMsgReq") + proto.RegisterType((*SendMsgResp)(nil), "pbChat.SendMsgResp") } // Reference imports to suppress errors if they are not otherwise used. @@ -1113,9 +444,8 @@ const _ = grpc.SupportPackageIsVersion4 type ChatClient interface { GetMaxAndMinSeq(ctx context.Context, in *GetMaxAndMinSeqReq, opts ...grpc.CallOption) (*GetMaxAndMinSeqResp, error) - PullMessage(ctx context.Context, in *PullMessageReq, opts ...grpc.CallOption) (*PullMessageResp, error) - PullMessageBySeqList(ctx context.Context, in *PullMessageBySeqListReq, opts ...grpc.CallOption) (*PullMessageResp, error) - UserSendMsg(ctx context.Context, in *UserSendMsgReq, opts ...grpc.CallOption) (*UserSendMsgResp, error) + PullMessageBySeqList(ctx context.Context, in *sdk_ws.PullMessageBySeqListReq, opts ...grpc.CallOption) (*sdk_ws.PullMessageBySeqListResp, error) + SendMsg(ctx context.Context, in *SendMsgReq, opts ...grpc.CallOption) (*SendMsgResp, error) } type chatClient struct { @@ -1135,17 +465,8 @@ func (c *chatClient) GetMaxAndMinSeq(ctx context.Context, in *GetMaxAndMinSeqReq return out, nil } -func (c *chatClient) PullMessage(ctx context.Context, in *PullMessageReq, opts ...grpc.CallOption) (*PullMessageResp, error) { - out := new(PullMessageResp) - err := grpc.Invoke(ctx, "/pbChat.Chat/PullMessage", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *chatClient) PullMessageBySeqList(ctx context.Context, in *PullMessageBySeqListReq, opts ...grpc.CallOption) (*PullMessageResp, error) { - out := new(PullMessageResp) +func (c *chatClient) PullMessageBySeqList(ctx context.Context, in *sdk_ws.PullMessageBySeqListReq, opts ...grpc.CallOption) (*sdk_ws.PullMessageBySeqListResp, error) { + out := new(sdk_ws.PullMessageBySeqListResp) err := grpc.Invoke(ctx, "/pbChat.Chat/PullMessageBySeqList", in, out, c.cc, opts...) if err != nil { return nil, err @@ -1153,9 +474,9 @@ func (c *chatClient) PullMessageBySeqList(ctx context.Context, in *PullMessageBy return out, nil } -func (c *chatClient) UserSendMsg(ctx context.Context, in *UserSendMsgReq, opts ...grpc.CallOption) (*UserSendMsgResp, error) { - out := new(UserSendMsgResp) - err := grpc.Invoke(ctx, "/pbChat.Chat/UserSendMsg", in, out, c.cc, opts...) +func (c *chatClient) SendMsg(ctx context.Context, in *SendMsgReq, opts ...grpc.CallOption) (*SendMsgResp, error) { + out := new(SendMsgResp) + err := grpc.Invoke(ctx, "/pbChat.Chat/SendMsg", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -1166,9 +487,8 @@ func (c *chatClient) UserSendMsg(ctx context.Context, in *UserSendMsgReq, opts . type ChatServer interface { GetMaxAndMinSeq(context.Context, *GetMaxAndMinSeqReq) (*GetMaxAndMinSeqResp, error) - PullMessage(context.Context, *PullMessageReq) (*PullMessageResp, error) - PullMessageBySeqList(context.Context, *PullMessageBySeqListReq) (*PullMessageResp, error) - UserSendMsg(context.Context, *UserSendMsgReq) (*UserSendMsgResp, error) + PullMessageBySeqList(context.Context, *sdk_ws.PullMessageBySeqListReq) (*sdk_ws.PullMessageBySeqListResp, error) + SendMsg(context.Context, *SendMsgReq) (*SendMsgResp, error) } func RegisterChatServer(s *grpc.Server, srv ChatServer) { @@ -1193,26 +513,8 @@ func _Chat_GetMaxAndMinSeq_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } -func _Chat_PullMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PullMessageReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ChatServer).PullMessage(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/pbChat.Chat/PullMessage", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ChatServer).PullMessage(ctx, req.(*PullMessageReq)) - } - return interceptor(ctx, in, info, handler) -} - func _Chat_PullMessageBySeqList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PullMessageBySeqListReq) + in := new(sdk_ws.PullMessageBySeqListReq) if err := dec(in); err != nil { return nil, err } @@ -1224,25 +526,25 @@ func _Chat_PullMessageBySeqList_Handler(srv interface{}, ctx context.Context, de FullMethod: "/pbChat.Chat/PullMessageBySeqList", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ChatServer).PullMessageBySeqList(ctx, req.(*PullMessageBySeqListReq)) + return srv.(ChatServer).PullMessageBySeqList(ctx, req.(*sdk_ws.PullMessageBySeqListReq)) } return interceptor(ctx, in, info, handler) } -func _Chat_UserSendMsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UserSendMsgReq) +func _Chat_SendMsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SendMsgReq) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ChatServer).UserSendMsg(ctx, in) + return srv.(ChatServer).SendMsg(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/pbChat.Chat/UserSendMsg", + FullMethod: "/pbChat.Chat/SendMsg", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ChatServer).UserSendMsg(ctx, req.(*UserSendMsgReq)) + return srv.(ChatServer).SendMsg(ctx, req.(*SendMsgReq)) } return interceptor(ctx, in, info, handler) } @@ -1255,87 +557,51 @@ var _Chat_serviceDesc = grpc.ServiceDesc{ MethodName: "GetMaxAndMinSeq", Handler: _Chat_GetMaxAndMinSeq_Handler, }, - { - MethodName: "PullMessage", - Handler: _Chat_PullMessage_Handler, - }, { MethodName: "PullMessageBySeqList", Handler: _Chat_PullMessageBySeqList_Handler, }, { - MethodName: "UserSendMsg", - Handler: _Chat_UserSendMsg_Handler, + MethodName: "SendMsg", + Handler: _Chat_SendMsg_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "chat/chat.proto", } -func init() { proto.RegisterFile("chat/chat.proto", fileDescriptor_chat_163a8d226aa6edb5) } +func init() { proto.RegisterFile("chat/chat.proto", fileDescriptor_chat_68ff093a75fc0634) } -var fileDescriptor_chat_163a8d226aa6edb5 = []byte{ - // 981 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xdd, 0x6a, 0xe3, 0x46, - 0x14, 0xc6, 0x92, 0x2d, 0xdb, 0xc7, 0xbf, 0x99, 0x86, 0xec, 0x90, 0x96, 0xd6, 0x88, 0x6d, 0x31, - 0xbd, 0x48, 0x61, 0x7b, 0x53, 0x5a, 0x58, 0x68, 0x62, 0x27, 0xa8, 0x44, 0xd9, 0x20, 0x7b, 0x29, - 0xf4, 0x4e, 0x6b, 0x8f, 0x15, 0xb1, 0xb6, 0x24, 0xcf, 0x28, 0x69, 0xf6, 0xa6, 0xaf, 0xd0, 0x97, - 0xe8, 0x65, 0x5f, 0xa4, 0x8f, 0xd2, 0x57, 0x28, 0x14, 0xca, 0xcc, 0x48, 0xd6, 0xe8, 0xc7, 0x49, - 0xd8, 0xb2, 0x7b, 0x13, 0x38, 0x9f, 0xce, 0xfc, 0x9c, 0xf3, 0x7d, 0xf3, 0x1d, 0x07, 0x06, 0x8b, - 0x1b, 0x37, 0xfe, 0x86, 0xff, 0x39, 0x89, 0x68, 0x18, 0x87, 0xc8, 0x88, 0xde, 0x9c, 0xdd, 0xb8, - 0xb1, 0xf9, 0x7b, 0x1d, 0x0e, 0x7e, 0x9e, 0xcd, 0x43, 0x9b, 0x79, 0xb3, 0x3b, 0xca, 0x21, 0x9b, - 0x79, 0xe8, 0x08, 0x8c, 0x19, 0x09, 0x96, 0xd6, 0x04, 0xd7, 0x46, 0xb5, 0x71, 0xdb, 0x49, 0x22, - 0x8e, 0x3b, 0x64, 0x71, 0x67, 0x4d, 0xb0, 0x26, 0x71, 0x19, 0x21, 0x0c, 0xcd, 0xb3, 0x30, 0x88, - 0x49, 0x10, 0x63, 0x5d, 0x7c, 0x48, 0x43, 0x74, 0x0c, 0x2d, 0xbe, 0x76, 0xee, 0x6f, 0x08, 0xae, - 0x8f, 0x6a, 0x63, 0xdd, 0xd9, 0xc5, 0x7c, 0x95, 0xcd, 0xbc, 0x73, 0x1a, 0x6e, 0x70, 0x63, 0x54, - 0x1b, 0x37, 0x9c, 0x34, 0x44, 0x5f, 0x41, 0x9f, 0x67, 0x11, 0x7a, 0xe5, 0x2f, 0xde, 0x5e, 0xb9, - 0x1b, 0x82, 0x0d, 0xb1, 0x6d, 0x01, 0x45, 0xcf, 0xa1, 0x27, 0x91, 0x73, 0x77, 0x41, 0x5e, 0x3b, - 0x97, 0xb8, 0x29, 0xd2, 0xf2, 0x20, 0x1a, 0x41, 0x27, 0xb9, 0xce, 0xfc, 0x5d, 0x44, 0x70, 0x4b, - 0x9c, 0xa5, 0x42, 0x3c, 0x63, 0x46, 0x18, 0xf3, 0xc3, 0x40, 0x64, 0xb4, 0x65, 0x86, 0x02, 0xf1, - 0x8c, 0x57, 0x11, 0xa1, 0x6e, 0xec, 0x87, 0x81, 0x35, 0xc1, 0x20, 0xce, 0x51, 0x21, 0x74, 0x08, - 0x0d, 0x9b, 0x79, 0xd6, 0x04, 0x77, 0xc4, 0x37, 0x19, 0x70, 0x74, 0x1e, 0xbe, 0x25, 0x01, 0xee, - 0x4a, 0x54, 0x04, 0x62, 0xb7, 0xd5, 0x6a, 0xed, 0x07, 0xc4, 0x0a, 0x56, 0x21, 0xee, 0x25, 0xbb, - 0x65, 0x10, 0xef, 0xcd, 0xab, 0x88, 0xef, 0xcc, 0x70, 0x5f, 0x76, 0x34, 0x09, 0xd1, 0xe7, 0x00, - 0xd7, 0x6b, 0x37, 0x5e, 0x85, 0x74, 0x63, 0x4d, 0xf0, 0x40, 0x5c, 0x55, 0x41, 0xd0, 0x67, 0xd0, - 0x3e, 0x0f, 0xe9, 0x82, 0x5c, 0xfa, 0x2c, 0xc6, 0xc3, 0x91, 0x3e, 0x6e, 0x3b, 0x19, 0x20, 0x7a, - 0xb1, 0xf6, 0x49, 0x10, 0xcb, 0xbb, 0x1e, 0xc8, 0x93, 0x15, 0xc8, 0xfc, 0x47, 0x87, 0x23, 0xa9, - 0x86, 0x79, 0x78, 0x7d, 0xcb, 0x6e, 0x3e, 0x88, 0x2c, 0x30, 0x34, 0x79, 0xce, 0x8c, 0x6c, 0x13, - 0x55, 0xa4, 0x61, 0x4e, 0x30, 0x8d, 0xfd, 0x82, 0x31, 0x1e, 0x13, 0x4c, 0xf3, 0x69, 0x82, 0x69, - 0x3d, 0x41, 0x30, 0xed, 0x47, 0x05, 0x03, 0x8f, 0x0a, 0xa6, 0xf3, 0x80, 0x60, 0xba, 0xaa, 0x60, - 0x3e, 0xa4, 0x34, 0x0a, 0xe4, 0x0f, 0xcb, 0xe4, 0xff, 0x06, 0xfd, 0xeb, 0xdb, 0xf5, 0xda, 0x26, - 0x8c, 0xb9, 0x1e, 0x71, 0xc8, 0x96, 0x73, 0xfb, 0x9a, 0x11, 0x9a, 0x71, 0x2e, 0x23, 0xc9, 0xd3, - 0xf6, 0x94, 0x78, 0x7e, 0x20, 0x58, 0x17, 0x3c, 0xc9, 0x58, 0xea, 0x64, 0x3b, 0x0d, 0x96, 0x82, - 0x76, 0xdd, 0x49, 0xa2, 0x62, 0x4f, 0xea, 0xa5, 0x9e, 0x98, 0x7f, 0xd7, 0x60, 0x90, 0xbb, 0x00, - 0x8b, 0x78, 0xbd, 0x53, 0x4a, 0xcf, 0xc2, 0x25, 0x11, 0x57, 0x68, 0x38, 0x69, 0xc8, 0xcf, 0x99, - 0x52, 0x6a, 0x33, 0x2f, 0xd5, 0x9d, 0x8c, 0x38, 0x6e, 0xbb, 0xf7, 0x5c, 0x5c, 0xc9, 0xf9, 0x32, - 0x12, 0xb8, 0x1f, 0x64, 0xa2, 0x4b, 0x22, 0xf4, 0x3d, 0xf4, 0x66, 0x7e, 0xe0, 0xad, 0x09, 0xaf, - 0x8d, 0x6f, 0xd7, 0x18, 0xe9, 0xe3, 0xce, 0x8b, 0xc3, 0x13, 0x69, 0x92, 0x27, 0x17, 0x6e, 0x7c, - 0x43, 0xe8, 0x79, 0x48, 0x37, 0x6e, 0xec, 0xe4, 0x53, 0xd1, 0x77, 0xd0, 0xbd, 0xa0, 0xe1, 0x6d, - 0x94, 0x2e, 0x35, 0x1e, 0x58, 0x9a, 0xcb, 0x34, 0x37, 0xf0, 0x4c, 0x29, 0xf5, 0xf4, 0xdd, 0x8c, - 0x6c, 0xf9, 0x13, 0x7d, 0xa8, 0xe9, 0x85, 0x06, 0x6a, 0x65, 0x51, 0x61, 0x68, 0x32, 0xb9, 0x0f, - 0xd6, 0x47, 0x3a, 0x7f, 0x58, 0x49, 0x68, 0x5e, 0x01, 0xba, 0x20, 0xb1, 0xed, 0xde, 0xff, 0x18, - 0x2c, 0x65, 0xdd, 0xff, 0xeb, 0x24, 0xf3, 0x57, 0xf8, 0xa4, 0xb4, 0xdf, 0xc7, 0x60, 0xcb, 0x9c, - 0x42, 0x57, 0xed, 0x2a, 0xea, 0x83, 0xb6, 0xbb, 0xbe, 0x66, 0x4d, 0xd0, 0x97, 0x50, 0x17, 0xf5, - 0x6b, 0x82, 0x89, 0x83, 0x94, 0x09, 0x6e, 0x15, 0x92, 0x06, 0xf1, 0xd9, 0xfc, 0x57, 0x83, 0xf6, - 0x0e, 0x7b, 0x1f, 0x6b, 0x4b, 0xad, 0x48, 0xcf, 0x5b, 0x51, 0xc1, 0x3c, 0xea, 0x7b, 0xcc, 0x83, - 0xde, 0x09, 0x15, 0x58, 0x13, 0xe1, 0x72, 0x6d, 0x47, 0x85, 0x54, 0xe3, 0x34, 0xf2, 0xc6, 0x39, - 0x04, 0x9d, 0x77, 0xa4, 0x29, 0x3a, 0xa2, 0x17, 0x0d, 0xb3, 0x55, 0x30, 0xcc, 0xaf, 0x61, 0x28, - 0x9d, 0x4d, 0xb1, 0x05, 0xe9, 0x66, 0x25, 0xbc, 0xc2, 0x42, 0xe1, 0x69, 0x16, 0xda, 0xd9, 0x67, - 0xa1, 0x8a, 0xd5, 0x74, 0xcb, 0x56, 0xf3, 0x67, 0x1d, 0xfa, 0x5c, 0x6c, 0x7c, 0x9d, 0xcd, 0x3c, - 0x2e, 0xc6, 0xe7, 0xd0, 0x73, 0xc8, 0xd6, 0x5a, 0x92, 0x20, 0xf6, 0x57, 0x3e, 0xa1, 0x89, 0x82, - 0xf2, 0x60, 0x36, 0x52, 0x35, 0x75, 0xa4, 0x66, 0x04, 0xea, 0x39, 0x02, 0x1f, 0xf5, 0x9c, 0x8a, - 0xc2, 0x1b, 0x4f, 0x2b, 0xdc, 0xa8, 0x2a, 0x3c, 0xef, 0xc1, 0xcd, 0x2a, 0x0f, 0x56, 0x27, 0x47, - 0xab, 0x3c, 0x39, 0x14, 0x69, 0xb5, 0x1f, 0x94, 0x16, 0x94, 0xa5, 0x95, 0xc9, 0xb5, 0x93, 0x93, - 0x6b, 0xee, 0x47, 0x41, 0xb7, 0xf8, 0xa3, 0x40, 0x91, 0x5b, 0xaf, 0x34, 0xa7, 0xf7, 0xcc, 0x9a, - 0x02, 0xc1, 0x83, 0x12, 0xc1, 0xc9, 0x24, 0xbb, 0x4c, 0x27, 0xd9, 0x70, 0x37, 0xc9, 0x52, 0x88, - 0xbf, 0xdc, 0xe9, 0x7d, 0xf2, 0x1b, 0x44, 0x9b, 0xde, 0x73, 0x29, 0xb3, 0x54, 0xca, 0x48, 0x4a, - 0x39, 0x8d, 0xcd, 0xbf, 0x6a, 0x30, 0xc8, 0xc9, 0xe5, 0xbd, 0xbc, 0xa6, 0xa4, 0x30, 0xbd, 0x4a, - 0x61, 0x85, 0x07, 0x5a, 0x2f, 0x3f, 0xd0, 0x42, 0xf5, 0x8d, 0x72, 0xf5, 0x6a, 0x2d, 0x46, 0xbe, - 0x96, 0x17, 0x7f, 0x68, 0x50, 0xe7, 0x9e, 0x84, 0x7e, 0x82, 0x41, 0xc1, 0x43, 0xd1, 0xf1, 0x6e, - 0x72, 0x94, 0xcc, 0xfa, 0xf8, 0xd3, 0xbd, 0xdf, 0x58, 0x84, 0x5e, 0x42, 0x47, 0x19, 0x27, 0xe8, - 0x28, 0xcd, 0xcd, 0xcf, 0xf3, 0xe3, 0x67, 0x95, 0x38, 0x8b, 0xd0, 0x35, 0x1c, 0x56, 0x8d, 0x23, - 0xf4, 0x45, 0xc5, 0x02, 0x75, 0x58, 0xed, 0xdf, 0xf1, 0x25, 0x74, 0x14, 0xc6, 0xb2, 0x1b, 0xe5, - 0x5f, 0x7d, 0xb6, 0xbe, 0x40, 0xef, 0xe9, 0xe0, 0x97, 0xde, 0x89, 0xf8, 0x9f, 0xe5, 0x07, 0x99, - 0xf0, 0xc6, 0x10, 0xff, 0xbb, 0x7c, 0xfb, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc2, 0x44, 0x4e, - 0x52, 0xce, 0x0c, 0x00, 0x00, +var fileDescriptor_chat_68ff093a75fc0634 = []byte{ + // 469 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0x4f, 0x6f, 0xd3, 0x4e, + 0x10, 0x95, 0xd3, 0x26, 0xf9, 0x75, 0xac, 0x2a, 0xd2, 0xb6, 0xfa, 0xc9, 0x32, 0x17, 0xe3, 0x53, + 0x04, 0x92, 0x2d, 0x05, 0x6e, 0x9c, 0x48, 0x53, 0xa1, 0x20, 0x96, 0x16, 0xa7, 0x5c, 0xb8, 0x44, + 0xdb, 0x7a, 0xe4, 0x58, 0x49, 0xec, 0xcd, 0x8e, 0x4b, 0x0a, 0x7c, 0x18, 0x3e, 0x26, 0x57, 0xe4, + 0x5d, 0x27, 0xdd, 0x36, 0x45, 0xe4, 0xc4, 0xc5, 0xd2, 0x7b, 0x33, 0x7e, 0x6f, 0xde, 0xfe, 0x83, + 0xde, 0xcd, 0x4c, 0x54, 0x71, 0xfd, 0x89, 0xa4, 0x2a, 0xab, 0x92, 0x75, 0xe4, 0xf5, 0xd9, 0x4c, + 0x54, 0xfe, 0xf3, 0x0b, 0x89, 0xc5, 0x74, 0xcc, 0x63, 0x39, 0xcf, 0x62, 0x5d, 0x8a, 0x29, 0x9d, + 0x4f, 0xd7, 0x14, 0xaf, 0xc9, 0xb4, 0x86, 0x3f, 0xc0, 0xe5, 0x94, 0x8d, 0x44, 0x25, 0xae, 0x4a, + 0xfe, 0x89, 0x9d, 0x42, 0xbb, 0x2a, 0xe7, 0x58, 0x78, 0x4e, 0xe0, 0xf4, 0x8f, 0x12, 0x03, 0x58, + 0x00, 0x6e, 0x29, 0x51, 0x89, 0x2a, 0x2f, 0x8b, 0xf1, 0xc8, 0x6b, 0xe9, 0x9a, 0x4d, 0xb1, 0xd7, + 0xd0, 0x5d, 0x1a, 0x19, 0xef, 0x20, 0x70, 0xfa, 0xee, 0xc0, 0x8f, 0x08, 0xd5, 0x57, 0x54, 0x53, + 0x21, 0xf3, 0xa9, 0x14, 0x4a, 0x2c, 0x29, 0x6a, 0x8c, 0x92, 0x4d, 0x6b, 0x88, 0x96, 0xf9, 0x68, + 0x68, 0x8b, 0x38, 0x7b, 0x8b, 0xfc, 0x7d, 0xb8, 0x30, 0x87, 0xde, 0xe5, 0x2d, 0xcd, 0xec, 0x9c, + 0x01, 0xb8, 0x17, 0xd6, 0x4f, 0x26, 0xad, 0x4d, 0xd9, 0xc3, 0xb4, 0xf6, 0x4f, 0xf4, 0x11, 0xd8, + 0x3b, 0xac, 0xb8, 0xb8, 0x7b, 0x5b, 0xa4, 0x3c, 0x2f, 0x26, 0xb8, 0x4a, 0x70, 0xc5, 0xfe, 0x87, + 0xce, 0x67, 0x42, 0xb5, 0x35, 0x6a, 0xd0, 0xe3, 0x29, 0x5a, 0x3b, 0x53, 0x84, 0x6b, 0x38, 0xd9, + 0xd1, 0x23, 0xc9, 0x3c, 0xe8, 0x9e, 0x2b, 0x75, 0x56, 0xa6, 0xa8, 0x15, 0xdb, 0xc9, 0x06, 0xd6, + 0x56, 0xe7, 0x4a, 0x71, 0xca, 0x1a, 0xb5, 0x06, 0xd5, 0x3c, 0x17, 0x77, 0x13, 0x5c, 0xe9, 0xfd, + 0x39, 0x4e, 0x1a, 0xa4, 0x79, 0xad, 0xeb, 0x1d, 0x36, 0xbc, 0x46, 0xe1, 0x77, 0x80, 0x09, 0x16, + 0x29, 0xa7, 0xac, 0x0e, 0xf0, 0x6f, 0x8f, 0xc5, 0x4f, 0x07, 0xdc, 0xad, 0xb9, 0x49, 0x8b, 0x0f, + 0xd3, 0xe2, 0x7d, 0x5a, 0x7c, 0x90, 0xd6, 0xa0, 0x7a, 0x32, 0xe3, 0xc3, 0x29, 0x1b, 0x8f, 0x74, + 0xb4, 0xa3, 0xc4, 0xa6, 0xea, 0x8e, 0x9b, 0x45, 0x8e, 0x45, 0x65, 0x3a, 0xda, 0xa6, 0xc3, 0xa2, + 0x98, 0x0f, 0xff, 0x11, 0x16, 0xe9, 0x55, 0xbe, 0x44, 0xaf, 0x13, 0x38, 0xfd, 0x83, 0x64, 0x8b, + 0x07, 0xbf, 0x1c, 0x38, 0xac, 0x6f, 0x18, 0x7b, 0x0f, 0xbd, 0x47, 0xfb, 0xc3, 0xfc, 0xc8, 0xdc, + 0xbe, 0x68, 0xf7, 0x20, 0xf8, 0xcf, 0xfe, 0x58, 0x23, 0xc9, 0x4a, 0x38, 0xbd, 0xbc, 0x5d, 0x2c, + 0x38, 0x12, 0x89, 0x0c, 0x87, 0xdf, 0x26, 0xb8, 0xfa, 0x90, 0x53, 0xc5, 0x5e, 0x3c, 0xb1, 0x66, + 0x4f, 0x35, 0xd6, 0x06, 0x2f, 0xf7, 0xee, 0x25, 0xc9, 0x06, 0xd0, 0x6d, 0x96, 0x99, 0xb1, 0xcd, + 0x60, 0xf7, 0x9b, 0xee, 0x9f, 0xec, 0x70, 0x24, 0x87, 0xbd, 0x2f, 0xc7, 0x91, 0x7e, 0x6a, 0xde, + 0x98, 0xe2, 0x75, 0x47, 0xbf, 0x23, 0xaf, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0x3a, 0xe6, 0x81, + 0xce, 0x85, 0x04, 0x00, 0x00, } diff --git a/pkg/proto/chat/chat.proto b/pkg/proto/chat/chat.proto index 3c66c99dc..7fe50ddc1 100644 --- a/pkg/proto/chat/chat.proto +++ b/pkg/proto/chat/chat.proto @@ -1,68 +1,45 @@ syntax = "proto3"; +import "Open_IM/pkg/proto/sdk_ws/ws.proto"; package pbChat;//The package name to which the proto file belongs option go_package = "./chat;pbChat";//The generated go pb file is in the current directory, and the package name is pbChat -message WSToMsgSvrChatMsg{ - string SendID = 1; - string RecvID = 2; - string Content = 3; - int64 SendTime = 4; - int32 MsgFrom = 5; - string SenderNickName = 6; - string SenderFaceURL = 7; - int32 ContentType = 8; - int32 SessionType = 9; - string OperationID = 10; - string MsgID = 11; - string Token = 12; - string OfflineInfo =13; - string Options = 14; - int32 PlatformID =15; - repeated string ForceList = 16; - string ClientMsgID = 17; +message MsgDataToMQ{ + string token =1; + string operationID = 2; + server_api_params.MsgData msgData = 3; } -message MsgSvrToPushSvrChatMsg { - string SendID = 1; - string RecvID = 2; - string Content = 3; - int64 RecvSeq = 4; - int64 SendTime = 5; - int32 MsgFrom = 6; - string SenderNickName = 7; - string SenderFaceURL = 8; - int32 ContentType = 9; - int32 SessionType = 10; - string OperationID = 11; - string MsgID = 12; - string OfflineInfo = 13; - string Options =14; - int32 PlatformID =15; - string ClientMsgID = 16; +message MsgDataToDB { + server_api_params.MsgData msgData = 1; + string operationID = 2; } - -message PullMessageReq { - string UserID = 1; - int64 SeqBegin = 2; - int64 SeqEnd = 3; - string OperationID = 4; +message PushMsgDataToMQ{ + string OperationID = 1; + server_api_params.MsgData msgData = 2; } -message PullMessageResp { - int32 ErrCode = 1; - string ErrMsg = 2; - int64 MaxSeq = 3; - int64 MinSeq = 4; - repeated GatherFormat SingleUserMsg = 5; - repeated GatherFormat GroupUserMsg = 6; -} -message PullMessageBySeqListReq{ - string UserID = 1; - string OperationID = 2; - repeated int64 seqList =3; -} +//message PullMessageReq { +// string UserID = 1; +// int64 SeqBegin = 2; +// int64 SeqEnd = 3; +// string OperationID = 4; +//} +// +//message PullMessageResp { +// int32 ErrCode = 1; +// string ErrMsg = 2; +// int64 MaxSeq = 3; +// int64 MinSeq = 4; +// repeated GatherFormat SingleUserMsg = 5; +// repeated GatherFormat GroupUserMsg = 6; +//} +//message PullMessageBySeqListReq{ +// string UserID = 1; +// string OperationID = 2; +// repeated int64 seqList =3; +//} message GetMaxAndMinSeqReq { string UserID = 1; string OperationID = 2; @@ -70,78 +47,29 @@ message GetMaxAndMinSeqReq { message GetMaxAndMinSeqResp { int32 ErrCode = 1; string ErrMsg = 2; - int64 MaxSeq = 3; - int64 MinSeq = 4; -} -message GatherFormat{ - // @inject_tag: json:"id" - string ID = 1; - // @inject_tag: json:"list" - repeated MsgFormat List = 2;//detail msg -} -message MsgFormat{ - // @inject_tag: json:"sendID" - string SendID = 1; - // @inject_tag: json:"recvID" - string RecvID = 2; - // @inject_tag: json:"msgFrom" - int32 MsgFrom = 3; - // @inject_tag: json:"contentType" - int32 ContentType = 4; - // @inject_tag: json:"serverMsgID" - string ServerMsgID = 5; - // @inject_tag: json:"content" - string Content = 6; - // @inject_tag: json:"seq" - int64 Seq = 7; - // @inject_tag: json:"sendTime" - int64 SendTime = 8; - // @inject_tag: json:"senderPlatformID" - int32 SenderPlatformID = 9; - // @inject_tag: json:"senderNickName" - string SenderNickName = 10; - // @inject_tag: json:"senderFaceUrl" - string SenderFaceURL = 11; - // @inject_tag: json:"clientMsgID" - string ClientMsgID = 12; + uint32 MaxSeq = 3; + uint32 MinSeq = 4; } -message UserSendMsgReq { +message SendMsgReq { - int32 ReqIdentifier = 1; - string Token = 2; - string SendID = 3; - string OperationID = 4; - string SenderNickName = 5; - string SenderFaceURL = 6; - int32 PlatformID = 7; - int32 SessionType = 8; - int32 MsgFrom = 9; - int32 ContentType = 10; - string RecvID = 11; - repeated string ForceList = 12; - string Content = 13; - string Options = 14; - string ClientMsgID = 15; - string OffLineInfo = 16; - string Ex = 17; - int64 sendTime = 18; +string token =1; +string operationID = 2; +server_api_params.MsgData msgData = 3; } -message UserSendMsgResp { - int32 ErrCode = 1; - string ErrMsg = 2; - int32 ReqIdentifier = 3; - string ServerMsgID = 4; - string ClientMsgID = 5; +message SendMsgResp { + int32 errCode = 1; + string errMsg = 2; + string serverMsgID = 4; + string clientMsgID = 5; int64 sendTime = 6; } service Chat { rpc GetMaxAndMinSeq(GetMaxAndMinSeqReq) returns(GetMaxAndMinSeqResp); - rpc PullMessage(PullMessageReq) returns(PullMessageResp); - rpc PullMessageBySeqList(PullMessageBySeqListReq) returns(PullMessageResp); - rpc UserSendMsg(UserSendMsgReq) returns(UserSendMsgResp); + rpc PullMessageBySeqList(server_api_params.PullMessageBySeqListReq) returns(server_api_params.PullMessageBySeqListResp); + rpc SendMsg(SendMsgReq) returns(SendMsgResp); } diff --git a/pkg/proto/friend/friend.pb.go b/pkg/proto/friend/friend.pb.go index a393857af..88e92e2f5 100644 --- a/pkg/proto/friend/friend.pb.go +++ b/pkg/proto/friend/friend.pb.go @@ -6,6 +6,7 @@ package friend // import "./friend" 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_friend_03bf5fbe59a174aa, []int{0} + return fileDescriptor_friend_74b4824fb8c5de90, []int{0} } func (m *CommonResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CommonResp.Unmarshal(m, b) @@ -55,24 +56,84 @@ 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 CommID struct { + OpUserID string `protobuf:"bytes,1,opt,name=OpUserID" json:"OpUserID,omitempty"` + OperationID string `protobuf:"bytes,2,opt,name=OperationID" json:"OperationID,omitempty"` + ToUserID string `protobuf:"bytes,4,opt,name=ToUserID" json:"ToUserID,omitempty"` + FromUserID string `protobuf:"bytes,5,opt,name=FromUserID" json:"FromUserID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CommID) Reset() { *m = CommID{} } +func (m *CommID) String() string { return proto.CompactTextString(m) } +func (*CommID) ProtoMessage() {} +func (*CommID) Descriptor() ([]byte, []int) { + return fileDescriptor_friend_74b4824fb8c5de90, []int{1} +} +func (m *CommID) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CommID.Unmarshal(m, b) +} +func (m *CommID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CommID.Marshal(b, m, deterministic) +} +func (dst *CommID) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommID.Merge(dst, src) +} +func (m *CommID) XXX_Size() int { + return xxx_messageInfo_CommID.Size(m) +} +func (m *CommID) XXX_DiscardUnknown() { + xxx_messageInfo_CommID.DiscardUnknown(m) +} + +var xxx_messageInfo_CommID proto.InternalMessageInfo + +func (m *CommID) GetOpUserID() string { + if m != nil { + return m.OpUserID + } + return "" +} + +func (m *CommID) GetOperationID() string { + if m != nil { + return m.OperationID + } + return "" +} + +func (m *CommID) GetToUserID() string { + if m != nil { + return m.ToUserID + } + return "" +} + +func (m *CommID) GetFromUserID() string { + if m != nil { + return m.FromUserID } return "" } type GetFriendsInfoReq struct { - Uid string `protobuf:"bytes,1,opt,name=uid" json:"uid,omitempty"` - OperationID string `protobuf:"bytes,2,opt,name=OperationID" json:"OperationID,omitempty"` - Token string `protobuf:"bytes,3,opt,name=Token" json:"Token,omitempty"` + CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -82,7 +143,7 @@ func (m *GetFriendsInfoReq) Reset() { *m = GetFriendsInfoReq{} } func (m *GetFriendsInfoReq) String() string { return proto.CompactTextString(m) } func (*GetFriendsInfoReq) ProtoMessage() {} func (*GetFriendsInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_03bf5fbe59a174aa, []int{1} + return fileDescriptor_friend_74b4824fb8c5de90, []int{2} } func (m *GetFriendsInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendsInfoReq.Unmarshal(m, b) @@ -102,41 +163,27 @@ func (m *GetFriendsInfoReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetFriendsInfoReq proto.InternalMessageInfo -func (m *GetFriendsInfoReq) GetUid() string { +func (m *GetFriendsInfoReq) GetCommID() *CommID { if m != nil { - return m.Uid + return m.CommID } - return "" -} - -func (m *GetFriendsInfoReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - -func (m *GetFriendsInfoReq) GetToken() string { - if m != nil { - return m.Token - } - return "" + return nil } type GetFriendInfoResp struct { - ErrorCode int32 `protobuf:"varint,1,opt,name=errorCode" json:"errorCode,omitempty"` - ErrorMsg string `protobuf:"bytes,2,opt,name=errorMsg" json:"errorMsg,omitempty"` - Data *GetFriendData `protobuf:"bytes,3,opt,name=Data" json:"Data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"` + FriendInfoList []*sdk_ws.FriendInfo `protobuf:"bytes,3,rep,name=FriendInfoList" json:"FriendInfoList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetFriendInfoResp) Reset() { *m = GetFriendInfoResp{} } func (m *GetFriendInfoResp) String() string { return proto.CompactTextString(m) } func (*GetFriendInfoResp) ProtoMessage() {} func (*GetFriendInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_03bf5fbe59a174aa, []int{2} + return fileDescriptor_friend_74b4824fb8c5de90, []int{3} } func (m *GetFriendInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendInfoResp.Unmarshal(m, b) @@ -156,150 +203,30 @@ func (m *GetFriendInfoResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetFriendInfoResp proto.InternalMessageInfo -func (m *GetFriendInfoResp) GetErrorCode() int32 { +func (m *GetFriendInfoResp) GetErrCode() int32 { if m != nil { - return m.ErrorCode + return m.ErrCode } return 0 } -func (m *GetFriendInfoResp) GetErrorMsg() string { +func (m *GetFriendInfoResp) GetErrMsg() string { if m != nil { - return m.ErrorMsg + return m.ErrMsg } return "" } -func (m *GetFriendInfoResp) GetData() *GetFriendData { +func (m *GetFriendInfoResp) GetFriendInfoList() []*sdk_ws.FriendInfo { if m != nil { - return m.Data + return m.FriendInfoList } return nil } -type GetFriendData struct { - Uid string `protobuf:"bytes,1,opt,name=uid" json:"uid,omitempty"` - Icon string `protobuf:"bytes,2,opt,name=icon" json:"icon,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name" json:"name,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"` - Comment string `protobuf:"bytes,9,opt,name=comment" json:"comment,omitempty"` - IsFriend int32 `protobuf:"varint,10,opt,name=isFriend" json:"isFriend,omitempty"` - IsInBlackList int32 `protobuf:"varint,11,opt,name=isInBlackList" json:"isInBlackList,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetFriendData) Reset() { *m = GetFriendData{} } -func (m *GetFriendData) String() string { return proto.CompactTextString(m) } -func (*GetFriendData) ProtoMessage() {} -func (*GetFriendData) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_03bf5fbe59a174aa, []int{3} -} -func (m *GetFriendData) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetFriendData.Unmarshal(m, b) -} -func (m *GetFriendData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetFriendData.Marshal(b, m, deterministic) -} -func (dst *GetFriendData) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetFriendData.Merge(dst, src) -} -func (m *GetFriendData) XXX_Size() int { - return xxx_messageInfo_GetFriendData.Size(m) -} -func (m *GetFriendData) XXX_DiscardUnknown() { - xxx_messageInfo_GetFriendData.DiscardUnknown(m) -} - -var xxx_messageInfo_GetFriendData proto.InternalMessageInfo - -func (m *GetFriendData) GetUid() string { - if m != nil { - return m.Uid - } - return "" -} - -func (m *GetFriendData) GetIcon() string { - if m != nil { - return m.Icon - } - return "" -} - -func (m *GetFriendData) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *GetFriendData) GetGender() int32 { - if m != nil { - return m.Gender - } - return 0 -} - -func (m *GetFriendData) GetMobile() string { - if m != nil { - return m.Mobile - } - return "" -} - -func (m *GetFriendData) GetBirth() string { - if m != nil { - return m.Birth - } - return "" -} - -func (m *GetFriendData) GetEmail() string { - if m != nil { - return m.Email - } - return "" -} - -func (m *GetFriendData) GetEx() string { - if m != nil { - return m.Ex - } - return "" -} - -func (m *GetFriendData) GetComment() string { - if m != nil { - return m.Comment - } - return "" -} - -func (m *GetFriendData) GetIsFriend() int32 { - if m != nil { - return m.IsFriend - } - return 0 -} - -func (m *GetFriendData) GetIsInBlackList() int32 { - if m != nil { - return m.IsInBlackList - } - return 0 -} - type AddFriendReq struct { - Uid string `protobuf:"bytes,1,opt,name=uid" json:"uid,omitempty"` - OperationID string `protobuf:"bytes,2,opt,name=OperationID" json:"OperationID,omitempty"` - Token string `protobuf:"bytes,3,opt,name=Token" json:"Token,omitempty"` - ReqMessage string `protobuf:"bytes,4,opt,name=ReqMessage" json:"ReqMessage,omitempty"` + CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` + ReqMsg string `protobuf:"bytes,2,opt,name=ReqMsg" json:"ReqMsg,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -309,7 +236,7 @@ func (m *AddFriendReq) Reset() { *m = AddFriendReq{} } func (m *AddFriendReq) String() string { return proto.CompactTextString(m) } func (*AddFriendReq) ProtoMessage() {} func (*AddFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_03bf5fbe59a174aa, []int{4} + return fileDescriptor_friend_74b4824fb8c5de90, []int{4} } func (m *AddFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddFriendReq.Unmarshal(m, b) @@ -329,39 +256,63 @@ func (m *AddFriendReq) XXX_DiscardUnknown() { var xxx_messageInfo_AddFriendReq proto.InternalMessageInfo -func (m *AddFriendReq) GetUid() string { +func (m *AddFriendReq) GetCommID() *CommID { if m != nil { - return m.Uid + return m.CommID + } + return nil +} + +func (m *AddFriendReq) GetReqMsg() string { + if m != nil { + return m.ReqMsg } return "" } -func (m *AddFriendReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" +type AddFriendResp 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 *AddFriendReq) GetToken() string { - if m != nil { - return m.Token - } - return "" +func (m *AddFriendResp) Reset() { *m = AddFriendResp{} } +func (m *AddFriendResp) String() string { return proto.CompactTextString(m) } +func (*AddFriendResp) ProtoMessage() {} +func (*AddFriendResp) Descriptor() ([]byte, []int) { + return fileDescriptor_friend_74b4824fb8c5de90, []int{5} +} +func (m *AddFriendResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AddFriendResp.Unmarshal(m, b) +} +func (m *AddFriendResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AddFriendResp.Marshal(b, m, deterministic) +} +func (dst *AddFriendResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_AddFriendResp.Merge(dst, src) +} +func (m *AddFriendResp) XXX_Size() int { + return xxx_messageInfo_AddFriendResp.Size(m) +} +func (m *AddFriendResp) XXX_DiscardUnknown() { + xxx_messageInfo_AddFriendResp.DiscardUnknown(m) } -func (m *AddFriendReq) GetReqMessage() string { +var xxx_messageInfo_AddFriendResp proto.InternalMessageInfo + +func (m *AddFriendResp) GetCommonResp() *CommonResp { if m != nil { - return m.ReqMessage + return m.CommonResp } - return "" + return nil } type ImportFriendReq struct { - UidList []string `protobuf:"bytes,1,rep,name=uidList" json:"uidList,omitempty"` + FriendUserIDList []string `protobuf:"bytes,1,rep,name=FriendUserIDList" json:"FriendUserIDList,omitempty"` OperationID string `protobuf:"bytes,2,opt,name=OperationID" json:"OperationID,omitempty"` - Token string `protobuf:"bytes,3,opt,name=Token" json:"Token,omitempty"` - OwnerUid string `protobuf:"bytes,4,opt,name=OwnerUid" json:"OwnerUid,omitempty"` + FromUserID string `protobuf:"bytes,3,opt,name=FromUserID" json:"FromUserID,omitempty"` + OpUserID string `protobuf:"bytes,4,opt,name=OpUserID" json:"OpUserID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -371,7 +322,7 @@ func (m *ImportFriendReq) Reset() { *m = ImportFriendReq{} } func (m *ImportFriendReq) String() string { return proto.CompactTextString(m) } func (*ImportFriendReq) ProtoMessage() {} func (*ImportFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_03bf5fbe59a174aa, []int{5} + return fileDescriptor_friend_74b4824fb8c5de90, []int{6} } func (m *ImportFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ImportFriendReq.Unmarshal(m, b) @@ -391,9 +342,9 @@ func (m *ImportFriendReq) XXX_DiscardUnknown() { var xxx_messageInfo_ImportFriendReq proto.InternalMessageInfo -func (m *ImportFriendReq) GetUidList() []string { +func (m *ImportFriendReq) GetFriendUserIDList() []string { if m != nil { - return m.UidList + return m.FriendUserIDList } return nil } @@ -405,33 +356,79 @@ func (m *ImportFriendReq) GetOperationID() string { return "" } -func (m *ImportFriendReq) GetToken() string { +func (m *ImportFriendReq) GetFromUserID() string { if m != nil { - return m.Token + return m.FromUserID } return "" } -func (m *ImportFriendReq) GetOwnerUid() string { +func (m *ImportFriendReq) GetOpUserID() string { if m != nil { - return m.OwnerUid + return m.OpUserID } return "" } +type UserIDResult struct { + UserID string `protobuf:"bytes,1,opt,name=UserID" json:"UserID,omitempty"` + Result int32 `protobuf:"varint,2,opt,name=Result" json:"Result,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UserIDResult) Reset() { *m = UserIDResult{} } +func (m *UserIDResult) String() string { return proto.CompactTextString(m) } +func (*UserIDResult) ProtoMessage() {} +func (*UserIDResult) Descriptor() ([]byte, []int) { + return fileDescriptor_friend_74b4824fb8c5de90, []int{7} +} +func (m *UserIDResult) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UserIDResult.Unmarshal(m, b) +} +func (m *UserIDResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UserIDResult.Marshal(b, m, deterministic) +} +func (dst *UserIDResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_UserIDResult.Merge(dst, src) +} +func (m *UserIDResult) XXX_Size() int { + return xxx_messageInfo_UserIDResult.Size(m) +} +func (m *UserIDResult) XXX_DiscardUnknown() { + xxx_messageInfo_UserIDResult.DiscardUnknown(m) +} + +var xxx_messageInfo_UserIDResult proto.InternalMessageInfo + +func (m *UserIDResult) GetUserID() string { + if m != nil { + return m.UserID + } + return "" +} + +func (m *UserIDResult) GetResult() int32 { + if m != nil { + return m.Result + } + return 0 +} + type ImportFriendResp struct { - CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` - FailedUidList []string `protobuf:"bytes,2,rep,name=failedUidList" json:"failedUidList,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + CommonResp *CommonResp `protobuf:"bytes,1,opt,name=CommonResp" json:"CommonResp,omitempty"` + UserIDResultList []*UserIDResult `protobuf:"bytes,2,rep,name=UserIDResultList" json:"UserIDResultList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ImportFriendResp) Reset() { *m = ImportFriendResp{} } func (m *ImportFriendResp) String() string { return proto.CompactTextString(m) } func (*ImportFriendResp) ProtoMessage() {} func (*ImportFriendResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_03bf5fbe59a174aa, []int{6} + return fileDescriptor_friend_74b4824fb8c5de90, []int{8} } func (m *ImportFriendResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ImportFriendResp.Unmarshal(m, b) @@ -458,234 +455,107 @@ func (m *ImportFriendResp) GetCommonResp() *CommonResp { return nil } -func (m *ImportFriendResp) GetFailedUidList() []string { +func (m *ImportFriendResp) GetUserIDResultList() []*UserIDResult { if m != nil { - return m.FailedUidList + return m.UserIDResultList } return nil } -type GetFriendApplyReq struct { - OperationID string `protobuf:"bytes,1,opt,name=OperationID" json:"OperationID,omitempty"` - Token string `protobuf:"bytes,2,opt,name=Token" json:"Token,omitempty"` +type GetFriendApplyListReq struct { + CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *GetFriendApplyReq) Reset() { *m = GetFriendApplyReq{} } -func (m *GetFriendApplyReq) String() string { return proto.CompactTextString(m) } -func (*GetFriendApplyReq) ProtoMessage() {} -func (*GetFriendApplyReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_03bf5fbe59a174aa, []int{7} +func (m *GetFriendApplyListReq) Reset() { *m = GetFriendApplyListReq{} } +func (m *GetFriendApplyListReq) String() string { return proto.CompactTextString(m) } +func (*GetFriendApplyListReq) ProtoMessage() {} +func (*GetFriendApplyListReq) Descriptor() ([]byte, []int) { + return fileDescriptor_friend_74b4824fb8c5de90, []int{9} } -func (m *GetFriendApplyReq) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetFriendApplyReq.Unmarshal(m, b) +func (m *GetFriendApplyListReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetFriendApplyListReq.Unmarshal(m, b) } -func (m *GetFriendApplyReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetFriendApplyReq.Marshal(b, m, deterministic) +func (m *GetFriendApplyListReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetFriendApplyListReq.Marshal(b, m, deterministic) } -func (dst *GetFriendApplyReq) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetFriendApplyReq.Merge(dst, src) +func (dst *GetFriendApplyListReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetFriendApplyListReq.Merge(dst, src) } -func (m *GetFriendApplyReq) XXX_Size() int { - return xxx_messageInfo_GetFriendApplyReq.Size(m) +func (m *GetFriendApplyListReq) XXX_Size() int { + return xxx_messageInfo_GetFriendApplyListReq.Size(m) } -func (m *GetFriendApplyReq) XXX_DiscardUnknown() { - xxx_messageInfo_GetFriendApplyReq.DiscardUnknown(m) +func (m *GetFriendApplyListReq) XXX_DiscardUnknown() { + xxx_messageInfo_GetFriendApplyListReq.DiscardUnknown(m) } -var xxx_messageInfo_GetFriendApplyReq proto.InternalMessageInfo +var xxx_messageInfo_GetFriendApplyListReq proto.InternalMessageInfo -func (m *GetFriendApplyReq) GetOperationID() string { +func (m *GetFriendApplyListReq) GetCommID() *CommID { if m != nil { - return m.OperationID - } - return "" -} - -func (m *GetFriendApplyReq) GetToken() string { - if m != nil { - return m.Token - } - return "" -} - -type GetFriendApplyResp struct { - ErrorCode int32 `protobuf:"varint,1,opt,name=errorCode" json:"errorCode,omitempty"` - ErrorMsg string `protobuf:"bytes,2,opt,name=errorMsg" json:"errorMsg,omitempty"` - Data []*ApplyUserInfo `protobuf:"bytes,4,rep,name=data" json:"data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetFriendApplyResp) Reset() { *m = GetFriendApplyResp{} } -func (m *GetFriendApplyResp) String() string { return proto.CompactTextString(m) } -func (*GetFriendApplyResp) ProtoMessage() {} -func (*GetFriendApplyResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_03bf5fbe59a174aa, []int{8} -} -func (m *GetFriendApplyResp) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetFriendApplyResp.Unmarshal(m, b) -} -func (m *GetFriendApplyResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetFriendApplyResp.Marshal(b, m, deterministic) -} -func (dst *GetFriendApplyResp) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetFriendApplyResp.Merge(dst, src) -} -func (m *GetFriendApplyResp) XXX_Size() int { - return xxx_messageInfo_GetFriendApplyResp.Size(m) -} -func (m *GetFriendApplyResp) XXX_DiscardUnknown() { - xxx_messageInfo_GetFriendApplyResp.DiscardUnknown(m) -} - -var xxx_messageInfo_GetFriendApplyResp proto.InternalMessageInfo - -func (m *GetFriendApplyResp) GetErrorCode() int32 { - if m != nil { - return m.ErrorCode - } - return 0 -} - -func (m *GetFriendApplyResp) GetErrorMsg() string { - if m != nil { - return m.ErrorMsg - } - return "" -} - -func (m *GetFriendApplyResp) GetData() []*ApplyUserInfo { - if m != nil { - return m.Data + return m.CommID } return nil } -type ApplyUserInfo 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"` - Flag int32 `protobuf:"varint,9,opt,name=flag" json:"flag,omitempty"` - ApplyTime string `protobuf:"bytes,10,opt,name=applyTime" json:"applyTime,omitempty"` - ReqMessage string `protobuf:"bytes,11,opt,name=reqMessage" json:"reqMessage,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +type GetFriendApplyListResp struct { + ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"` + FriendRequestList []*sdk_ws.FriendRequest `protobuf:"bytes,3,rep,name=FriendRequestList" json:"FriendRequestList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *ApplyUserInfo) Reset() { *m = ApplyUserInfo{} } -func (m *ApplyUserInfo) String() string { return proto.CompactTextString(m) } -func (*ApplyUserInfo) ProtoMessage() {} -func (*ApplyUserInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_03bf5fbe59a174aa, []int{9} +func (m *GetFriendApplyListResp) Reset() { *m = GetFriendApplyListResp{} } +func (m *GetFriendApplyListResp) String() string { return proto.CompactTextString(m) } +func (*GetFriendApplyListResp) ProtoMessage() {} +func (*GetFriendApplyListResp) Descriptor() ([]byte, []int) { + return fileDescriptor_friend_74b4824fb8c5de90, []int{10} } -func (m *ApplyUserInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ApplyUserInfo.Unmarshal(m, b) +func (m *GetFriendApplyListResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetFriendApplyListResp.Unmarshal(m, b) } -func (m *ApplyUserInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ApplyUserInfo.Marshal(b, m, deterministic) +func (m *GetFriendApplyListResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetFriendApplyListResp.Marshal(b, m, deterministic) } -func (dst *ApplyUserInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_ApplyUserInfo.Merge(dst, src) +func (dst *GetFriendApplyListResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetFriendApplyListResp.Merge(dst, src) } -func (m *ApplyUserInfo) XXX_Size() int { - return xxx_messageInfo_ApplyUserInfo.Size(m) +func (m *GetFriendApplyListResp) XXX_Size() int { + return xxx_messageInfo_GetFriendApplyListResp.Size(m) } -func (m *ApplyUserInfo) XXX_DiscardUnknown() { - xxx_messageInfo_ApplyUserInfo.DiscardUnknown(m) +func (m *GetFriendApplyListResp) XXX_DiscardUnknown() { + xxx_messageInfo_GetFriendApplyListResp.DiscardUnknown(m) } -var xxx_messageInfo_ApplyUserInfo proto.InternalMessageInfo +var xxx_messageInfo_GetFriendApplyListResp proto.InternalMessageInfo -func (m *ApplyUserInfo) GetUid() string { +func (m *GetFriendApplyListResp) GetErrCode() int32 { if m != nil { - return m.Uid - } - return "" -} - -func (m *ApplyUserInfo) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *ApplyUserInfo) GetIcon() string { - if m != nil { - return m.Icon - } - return "" -} - -func (m *ApplyUserInfo) GetGender() int32 { - if m != nil { - return m.Gender + return m.ErrCode } return 0 } -func (m *ApplyUserInfo) GetMobile() string { +func (m *GetFriendApplyListResp) GetErrMsg() string { if m != nil { - return m.Mobile + return m.ErrMsg } return "" } -func (m *ApplyUserInfo) GetBirth() string { +func (m *GetFriendApplyListResp) GetFriendRequestList() []*sdk_ws.FriendRequest { if m != nil { - return m.Birth + return m.FriendRequestList } - return "" -} - -func (m *ApplyUserInfo) GetEmail() string { - if m != nil { - return m.Email - } - return "" -} - -func (m *ApplyUserInfo) GetEx() string { - if m != nil { - return m.Ex - } - return "" -} - -func (m *ApplyUserInfo) GetFlag() int32 { - if m != nil { - return m.Flag - } - return 0 -} - -func (m *ApplyUserInfo) GetApplyTime() string { - if m != nil { - return m.ApplyTime - } - return "" -} - -func (m *ApplyUserInfo) GetReqMessage() string { - if m != nil { - return m.ReqMessage - } - return "" + return nil } type GetFriendListReq struct { - OperationID string `protobuf:"bytes,1,opt,name=OperationID" json:"OperationID,omitempty"` - Token string `protobuf:"bytes,2,opt,name=Token" json:"Token,omitempty"` + CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -695,7 +565,7 @@ func (m *GetFriendListReq) Reset() { *m = GetFriendListReq{} } func (m *GetFriendListReq) String() string { return proto.CompactTextString(m) } func (*GetFriendListReq) ProtoMessage() {} func (*GetFriendListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_03bf5fbe59a174aa, []int{10} + return fileDescriptor_friend_74b4824fb8c5de90, []int{11} } func (m *GetFriendListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendListReq.Unmarshal(m, b) @@ -715,34 +585,27 @@ func (m *GetFriendListReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetFriendListReq proto.InternalMessageInfo -func (m *GetFriendListReq) GetOperationID() string { +func (m *GetFriendListReq) GetCommID() *CommID { if m != nil { - return m.OperationID + return m.CommID } - return "" -} - -func (m *GetFriendListReq) GetToken() string { - if m != nil { - return m.Token - } - return "" + return nil } type GetFriendListResp 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:"-"` + ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"` + FriendInfoList []*sdk_ws.FriendInfo `protobuf:"bytes,3,rep,name=FriendInfoList" json:"FriendInfoList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetFriendListResp) Reset() { *m = GetFriendListResp{} } func (m *GetFriendListResp) String() string { return proto.CompactTextString(m) } func (*GetFriendListResp) ProtoMessage() {} func (*GetFriendListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_03bf5fbe59a174aa, []int{11} + return fileDescriptor_friend_74b4824fb8c5de90, []int{12} } func (m *GetFriendListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendListResp.Unmarshal(m, b) @@ -762,142 +625,29 @@ func (m *GetFriendListResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetFriendListResp proto.InternalMessageInfo -func (m *GetFriendListResp) GetErrorCode() int32 { +func (m *GetFriendListResp) GetErrCode() int32 { if m != nil { - return m.ErrorCode + return m.ErrCode } return 0 } -func (m *GetFriendListResp) GetErrorMsg() string { +func (m *GetFriendListResp) GetErrMsg() string { if m != nil { - return m.ErrorMsg + return m.ErrMsg } return "" } -func (m *GetFriendListResp) GetData() []*UserInfo { +func (m *GetFriendListResp) GetFriendInfoList() []*sdk_ws.FriendInfo { if m != nil { - return m.Data + return m.FriendInfoList } return nil } -type UserInfo struct { - Uid string `protobuf:"bytes,1,opt,name=uid" json:"uid,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"` - Icon string `protobuf:"bytes,2,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"` - Comment string `protobuf:"bytes,9,opt,name=comment" json:"comment,omitempty"` - IsInBlackList int32 `protobuf:"varint,10,opt,name=isInBlackList" json:"isInBlackList,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_friend_03bf5fbe59a174aa, []int{12} -} -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 { - if m != nil { - return m.Uid - } - 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 "" -} - -func (m *UserInfo) GetComment() string { - if m != nil { - return m.Comment - } - return "" -} - -func (m *UserInfo) GetIsInBlackList() int32 { - if m != nil { - return m.IsInBlackList - } - return 0 -} - type AddBlacklistReq struct { - Uid string `protobuf:"bytes,1,opt,name=uid" json:"uid,omitempty"` - OperationID string `protobuf:"bytes,2,opt,name=OperationID" json:"OperationID,omitempty"` - Token string `protobuf:"bytes,3,opt,name=Token" json:"Token,omitempty"` - OwnerUid string `protobuf:"bytes,4,opt,name=OwnerUid" json:"OwnerUid,omitempty"` + CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -907,7 +657,7 @@ func (m *AddBlacklistReq) Reset() { *m = AddBlacklistReq{} } func (m *AddBlacklistReq) String() string { return proto.CompactTextString(m) } func (*AddBlacklistReq) ProtoMessage() {} func (*AddBlacklistReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_03bf5fbe59a174aa, []int{13} + return fileDescriptor_friend_74b4824fb8c5de90, []int{13} } func (m *AddBlacklistReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddBlacklistReq.Unmarshal(m, b) @@ -927,38 +677,53 @@ func (m *AddBlacklistReq) XXX_DiscardUnknown() { var xxx_messageInfo_AddBlacklistReq proto.InternalMessageInfo -func (m *AddBlacklistReq) GetUid() string { +func (m *AddBlacklistReq) GetCommID() *CommID { if m != nil { - return m.Uid + return m.CommID } - return "" + return nil } -func (m *AddBlacklistReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" +type AddBlacklistResp 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 *AddBlacklistReq) GetToken() string { - if m != nil { - return m.Token - } - return "" +func (m *AddBlacklistResp) Reset() { *m = AddBlacklistResp{} } +func (m *AddBlacklistResp) String() string { return proto.CompactTextString(m) } +func (*AddBlacklistResp) ProtoMessage() {} +func (*AddBlacklistResp) Descriptor() ([]byte, []int) { + return fileDescriptor_friend_74b4824fb8c5de90, []int{14} +} +func (m *AddBlacklistResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AddBlacklistResp.Unmarshal(m, b) +} +func (m *AddBlacklistResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AddBlacklistResp.Marshal(b, m, deterministic) +} +func (dst *AddBlacklistResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_AddBlacklistResp.Merge(dst, src) +} +func (m *AddBlacklistResp) XXX_Size() int { + return xxx_messageInfo_AddBlacklistResp.Size(m) +} +func (m *AddBlacklistResp) XXX_DiscardUnknown() { + xxx_messageInfo_AddBlacklistResp.DiscardUnknown(m) } -func (m *AddBlacklistReq) GetOwnerUid() string { +var xxx_messageInfo_AddBlacklistResp proto.InternalMessageInfo + +func (m *AddBlacklistResp) GetCommonResp() *CommonResp { if m != nil { - return m.OwnerUid + return m.CommonResp } - return "" + return nil } type RemoveBlacklistReq struct { - Uid string `protobuf:"bytes,1,opt,name=uid" json:"uid,omitempty"` - OperationID string `protobuf:"bytes,2,opt,name=OperationID" json:"OperationID,omitempty"` - Token string `protobuf:"bytes,3,opt,name=Token" json:"Token,omitempty"` + CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -968,7 +733,7 @@ func (m *RemoveBlacklistReq) Reset() { *m = RemoveBlacklistReq{} } func (m *RemoveBlacklistReq) String() string { return proto.CompactTextString(m) } func (*RemoveBlacklistReq) ProtoMessage() {} func (*RemoveBlacklistReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_03bf5fbe59a174aa, []int{14} + return fileDescriptor_friend_74b4824fb8c5de90, []int{15} } func (m *RemoveBlacklistReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RemoveBlacklistReq.Unmarshal(m, b) @@ -988,30 +753,53 @@ func (m *RemoveBlacklistReq) XXX_DiscardUnknown() { var xxx_messageInfo_RemoveBlacklistReq proto.InternalMessageInfo -func (m *RemoveBlacklistReq) GetUid() string { +func (m *RemoveBlacklistReq) GetCommID() *CommID { if m != nil { - return m.Uid + return m.CommID } - return "" + return nil } -func (m *RemoveBlacklistReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" +type RemoveBlacklistResp 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 *RemoveBlacklistReq) GetToken() string { +func (m *RemoveBlacklistResp) Reset() { *m = RemoveBlacklistResp{} } +func (m *RemoveBlacklistResp) String() string { return proto.CompactTextString(m) } +func (*RemoveBlacklistResp) ProtoMessage() {} +func (*RemoveBlacklistResp) Descriptor() ([]byte, []int) { + return fileDescriptor_friend_74b4824fb8c5de90, []int{16} +} +func (m *RemoveBlacklistResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RemoveBlacklistResp.Unmarshal(m, b) +} +func (m *RemoveBlacklistResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RemoveBlacklistResp.Marshal(b, m, deterministic) +} +func (dst *RemoveBlacklistResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_RemoveBlacklistResp.Merge(dst, src) +} +func (m *RemoveBlacklistResp) XXX_Size() int { + return xxx_messageInfo_RemoveBlacklistResp.Size(m) +} +func (m *RemoveBlacklistResp) XXX_DiscardUnknown() { + xxx_messageInfo_RemoveBlacklistResp.DiscardUnknown(m) +} + +var xxx_messageInfo_RemoveBlacklistResp proto.InternalMessageInfo + +func (m *RemoveBlacklistResp) GetCommonResp() *CommonResp { if m != nil { - return m.Token + return m.CommonResp } - return "" + return nil } type GetBlacklistReq struct { - OperationID string `protobuf:"bytes,1,opt,name=OperationID" json:"OperationID,omitempty"` - Token string `protobuf:"bytes,2,opt,name=token" json:"token,omitempty"` + CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1021,7 +809,7 @@ func (m *GetBlacklistReq) Reset() { *m = GetBlacklistReq{} } func (m *GetBlacklistReq) String() string { return proto.CompactTextString(m) } func (*GetBlacklistReq) ProtoMessage() {} func (*GetBlacklistReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_03bf5fbe59a174aa, []int{15} + return fileDescriptor_friend_74b4824fb8c5de90, []int{17} } func (m *GetBlacklistReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetBlacklistReq.Unmarshal(m, b) @@ -1041,34 +829,27 @@ func (m *GetBlacklistReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetBlacklistReq proto.InternalMessageInfo -func (m *GetBlacklistReq) GetOperationID() string { +func (m *GetBlacklistReq) GetCommID() *CommID { if m != nil { - return m.OperationID + return m.CommID } - return "" -} - -func (m *GetBlacklistReq) GetToken() string { - if m != nil { - return m.Token - } - return "" + return nil } type GetBlacklistResp 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:"-"` + ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"` + BlackUserInfoList []*sdk_ws.PublicUserInfo `protobuf:"bytes,3,rep,name=BlackUserInfoList" json:"BlackUserInfoList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetBlacklistResp) Reset() { *m = GetBlacklistResp{} } func (m *GetBlacklistResp) String() string { return proto.CompactTextString(m) } func (*GetBlacklistResp) ProtoMessage() {} func (*GetBlacklistResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_03bf5fbe59a174aa, []int{16} + return fileDescriptor_friend_74b4824fb8c5de90, []int{18} } func (m *GetBlacklistResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetBlacklistResp.Unmarshal(m, b) @@ -1088,31 +869,29 @@ func (m *GetBlacklistResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetBlacklistResp proto.InternalMessageInfo -func (m *GetBlacklistResp) GetErrorCode() int32 { +func (m *GetBlacklistResp) GetErrCode() int32 { if m != nil { - return m.ErrorCode + return m.ErrCode } return 0 } -func (m *GetBlacklistResp) GetErrorMsg() string { +func (m *GetBlacklistResp) GetErrMsg() string { if m != nil { - return m.ErrorMsg + return m.ErrMsg } return "" } -func (m *GetBlacklistResp) GetData() []*UserInfo { +func (m *GetBlacklistResp) GetBlackUserInfoList() []*sdk_ws.PublicUserInfo { if m != nil { - return m.Data + return m.BlackUserInfoList } return nil } type IsFriendReq struct { - Token string `protobuf:"bytes,1,opt,name=token" json:"token,omitempty"` - ReceiveUid string `protobuf:"bytes,2,opt,name=receiveUid" json:"receiveUid,omitempty"` - OperationID string `protobuf:"bytes,3,opt,name=OperationID" json:"OperationID,omitempty"` + CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1122,7 +901,7 @@ func (m *IsFriendReq) Reset() { *m = IsFriendReq{} } func (m *IsFriendReq) String() string { return proto.CompactTextString(m) } func (*IsFriendReq) ProtoMessage() {} func (*IsFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_03bf5fbe59a174aa, []int{17} + return fileDescriptor_friend_74b4824fb8c5de90, []int{19} } func (m *IsFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsFriendReq.Unmarshal(m, b) @@ -1142,31 +921,17 @@ func (m *IsFriendReq) XXX_DiscardUnknown() { var xxx_messageInfo_IsFriendReq proto.InternalMessageInfo -func (m *IsFriendReq) GetToken() string { +func (m *IsFriendReq) GetCommID() *CommID { if m != nil { - return m.Token + return m.CommID } - return "" -} - -func (m *IsFriendReq) GetReceiveUid() string { - if m != nil { - return m.ReceiveUid - } - return "" -} - -func (m *IsFriendReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" + return nil } type IsFriendResp struct { - ErrorCode int32 `protobuf:"varint,1,opt,name=errorCode" json:"errorCode,omitempty"` - ErrorMsg string `protobuf:"bytes,2,opt,name=errorMsg" json:"errorMsg,omitempty"` - ShipType int32 `protobuf:"varint,3,opt,name=shipType" json:"shipType,omitempty"` + ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"` + Response bool `protobuf:"varint,3,opt,name=Response" json:"Response,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1176,7 +941,7 @@ func (m *IsFriendResp) Reset() { *m = IsFriendResp{} } func (m *IsFriendResp) String() string { return proto.CompactTextString(m) } func (*IsFriendResp) ProtoMessage() {} func (*IsFriendResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_03bf5fbe59a174aa, []int{18} + return fileDescriptor_friend_74b4824fb8c5de90, []int{20} } func (m *IsFriendResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsFriendResp.Unmarshal(m, b) @@ -1196,31 +961,29 @@ func (m *IsFriendResp) XXX_DiscardUnknown() { var xxx_messageInfo_IsFriendResp proto.InternalMessageInfo -func (m *IsFriendResp) GetErrorCode() int32 { +func (m *IsFriendResp) GetErrCode() int32 { if m != nil { - return m.ErrorCode + return m.ErrCode } return 0 } -func (m *IsFriendResp) GetErrorMsg() string { +func (m *IsFriendResp) GetErrMsg() string { if m != nil { - return m.ErrorMsg + return m.ErrMsg } return "" } -func (m *IsFriendResp) GetShipType() int32 { +func (m *IsFriendResp) GetResponse() bool { if m != nil { - return m.ShipType + return m.Response } - return 0 + return false } type IsInBlackListReq struct { - SendUid string `protobuf:"bytes,1,opt,name=sendUid" json:"sendUid,omitempty"` - ReceiveUid string `protobuf:"bytes,2,opt,name=receiveUid" json:"receiveUid,omitempty"` - OperationID string `protobuf:"bytes,3,opt,name=OperationID" json:"OperationID,omitempty"` + CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1230,7 +993,7 @@ func (m *IsInBlackListReq) Reset() { *m = IsInBlackListReq{} } func (m *IsInBlackListReq) String() string { return proto.CompactTextString(m) } func (*IsInBlackListReq) ProtoMessage() {} func (*IsInBlackListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_03bf5fbe59a174aa, []int{19} + return fileDescriptor_friend_74b4824fb8c5de90, []int{21} } func (m *IsInBlackListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsInBlackListReq.Unmarshal(m, b) @@ -1250,31 +1013,17 @@ func (m *IsInBlackListReq) XXX_DiscardUnknown() { var xxx_messageInfo_IsInBlackListReq proto.InternalMessageInfo -func (m *IsInBlackListReq) GetSendUid() string { +func (m *IsInBlackListReq) GetCommID() *CommID { if m != nil { - return m.SendUid + return m.CommID } - return "" -} - -func (m *IsInBlackListReq) GetReceiveUid() string { - if m != nil { - return m.ReceiveUid - } - return "" -} - -func (m *IsInBlackListReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" + return nil } type IsInBlackListResp struct { - ErrorCode int32 `protobuf:"varint,1,opt,name=errorCode" json:"errorCode,omitempty"` - ErrorMsg string `protobuf:"bytes,2,opt,name=errorMsg" json:"errorMsg,omitempty"` - Response bool `protobuf:"varint,3,opt,name=response" json:"response,omitempty"` + ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"` + Response bool `protobuf:"varint,3,opt,name=Response" json:"Response,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1284,7 +1033,7 @@ func (m *IsInBlackListResp) Reset() { *m = IsInBlackListResp{} } func (m *IsInBlackListResp) String() string { return proto.CompactTextString(m) } func (*IsInBlackListResp) ProtoMessage() {} func (*IsInBlackListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_03bf5fbe59a174aa, []int{20} + return fileDescriptor_friend_74b4824fb8c5de90, []int{22} } func (m *IsInBlackListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsInBlackListResp.Unmarshal(m, b) @@ -1304,16 +1053,16 @@ func (m *IsInBlackListResp) XXX_DiscardUnknown() { var xxx_messageInfo_IsInBlackListResp proto.InternalMessageInfo -func (m *IsInBlackListResp) GetErrorCode() int32 { +func (m *IsInBlackListResp) GetErrCode() int32 { if m != nil { - return m.ErrorCode + return m.ErrCode } return 0 } -func (m *IsInBlackListResp) GetErrorMsg() string { +func (m *IsInBlackListResp) GetErrMsg() string { if m != nil { - return m.ErrorMsg + return m.ErrMsg } return "" } @@ -1326,9 +1075,7 @@ func (m *IsInBlackListResp) GetResponse() bool { } type DeleteFriendReq struct { - Uid string `protobuf:"bytes,1,opt,name=uid" json:"uid,omitempty"` - OperationID string `protobuf:"bytes,2,opt,name=OperationID" json:"OperationID,omitempty"` - Token string `protobuf:"bytes,3,opt,name=Token" json:"Token,omitempty"` + CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1338,7 +1085,7 @@ func (m *DeleteFriendReq) Reset() { *m = DeleteFriendReq{} } func (m *DeleteFriendReq) String() string { return proto.CompactTextString(m) } func (*DeleteFriendReq) ProtoMessage() {} func (*DeleteFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_03bf5fbe59a174aa, []int{21} + return fileDescriptor_friend_74b4824fb8c5de90, []int{23} } func (m *DeleteFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteFriendReq.Unmarshal(m, b) @@ -1358,32 +1105,56 @@ func (m *DeleteFriendReq) XXX_DiscardUnknown() { var xxx_messageInfo_DeleteFriendReq proto.InternalMessageInfo -func (m *DeleteFriendReq) GetUid() string { +func (m *DeleteFriendReq) GetCommID() *CommID { if m != nil { - return m.Uid + return m.CommID } - return "" + return nil } -func (m *DeleteFriendReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" +type DeleteFriendResp 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 *DeleteFriendReq) GetToken() string { - if m != nil { - return m.Token - } - return "" +func (m *DeleteFriendResp) Reset() { *m = DeleteFriendResp{} } +func (m *DeleteFriendResp) String() string { return proto.CompactTextString(m) } +func (*DeleteFriendResp) ProtoMessage() {} +func (*DeleteFriendResp) Descriptor() ([]byte, []int) { + return fileDescriptor_friend_74b4824fb8c5de90, []int{24} +} +func (m *DeleteFriendResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DeleteFriendResp.Unmarshal(m, b) +} +func (m *DeleteFriendResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DeleteFriendResp.Marshal(b, m, deterministic) +} +func (dst *DeleteFriendResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteFriendResp.Merge(dst, src) +} +func (m *DeleteFriendResp) XXX_Size() int { + return xxx_messageInfo_DeleteFriendResp.Size(m) +} +func (m *DeleteFriendResp) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteFriendResp.DiscardUnknown(m) } +var xxx_messageInfo_DeleteFriendResp proto.InternalMessageInfo + +func (m *DeleteFriendResp) GetCommonResp() *CommonResp { + if m != nil { + return m.CommonResp + } + return nil +} + +// process type AddFriendResponseReq struct { - Uid string `protobuf:"bytes,1,opt,name=uid" json:"uid,omitempty"` - Flag int32 `protobuf:"varint,2,opt,name=flag" json:"flag,omitempty"` - OperationID string `protobuf:"bytes,3,opt,name=OperationID" json:"OperationID,omitempty"` - Token string `protobuf:"bytes,4,opt,name=Token" json:"Token,omitempty"` + CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` + HandleResult int32 `protobuf:"varint,2,opt,name=handleResult" json:"handleResult,omitempty"` + HandleMsg string `protobuf:"bytes,3,opt,name=handleMsg" json:"handleMsg,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1393,7 +1164,7 @@ func (m *AddFriendResponseReq) Reset() { *m = AddFriendResponseReq{} } func (m *AddFriendResponseReq) String() string { return proto.CompactTextString(m) } func (*AddFriendResponseReq) ProtoMessage() {} func (*AddFriendResponseReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_03bf5fbe59a174aa, []int{22} + return fileDescriptor_friend_74b4824fb8c5de90, []int{25} } func (m *AddFriendResponseReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddFriendResponseReq.Unmarshal(m, b) @@ -1413,112 +1184,259 @@ func (m *AddFriendResponseReq) XXX_DiscardUnknown() { var xxx_messageInfo_AddFriendResponseReq proto.InternalMessageInfo -func (m *AddFriendResponseReq) GetUid() string { +func (m *AddFriendResponseReq) GetCommID() *CommID { if m != nil { - return m.Uid + return m.CommID } - return "" + return nil } -func (m *AddFriendResponseReq) GetFlag() int32 { +func (m *AddFriendResponseReq) GetHandleResult() int32 { if m != nil { - return m.Flag + return m.HandleResult } return 0 } -func (m *AddFriendResponseReq) GetOperationID() string { +func (m *AddFriendResponseReq) GetHandleMsg() string { if m != nil { - return m.OperationID + return m.HandleMsg } return "" } -func (m *AddFriendResponseReq) GetToken() string { - if m != nil { - return m.Token - } - return "" +type AddFriendResponseResp struct { + CommonResp *CommonResp `protobuf:"bytes,1,opt,name=CommonResp" json:"CommonResp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -type SetFriendCommentReq struct { - Uid string `protobuf:"bytes,1,opt,name=uid" json:"uid,omitempty"` - OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` - Comment string `protobuf:"bytes,3,opt,name=comment" json:"comment,omitempty"` - Token string `protobuf:"bytes,4,opt,name=token" json:"token,omitempty"` +func (m *AddFriendResponseResp) Reset() { *m = AddFriendResponseResp{} } +func (m *AddFriendResponseResp) String() string { return proto.CompactTextString(m) } +func (*AddFriendResponseResp) ProtoMessage() {} +func (*AddFriendResponseResp) Descriptor() ([]byte, []int) { + return fileDescriptor_friend_74b4824fb8c5de90, []int{26} +} +func (m *AddFriendResponseResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AddFriendResponseResp.Unmarshal(m, b) +} +func (m *AddFriendResponseResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AddFriendResponseResp.Marshal(b, m, deterministic) +} +func (dst *AddFriendResponseResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_AddFriendResponseResp.Merge(dst, src) +} +func (m *AddFriendResponseResp) XXX_Size() int { + return xxx_messageInfo_AddFriendResponseResp.Size(m) +} +func (m *AddFriendResponseResp) XXX_DiscardUnknown() { + xxx_messageInfo_AddFriendResponseResp.DiscardUnknown(m) +} + +var xxx_messageInfo_AddFriendResponseResp proto.InternalMessageInfo + +func (m *AddFriendResponseResp) GetCommonResp() *CommonResp { + if m != nil { + return m.CommonResp + } + return nil +} + +type SetFriendRemarkReq struct { + CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` + Remark string `protobuf:"bytes,2,opt,name=Remark" json:"Remark,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *SetFriendCommentReq) Reset() { *m = SetFriendCommentReq{} } -func (m *SetFriendCommentReq) String() string { return proto.CompactTextString(m) } -func (*SetFriendCommentReq) ProtoMessage() {} -func (*SetFriendCommentReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_03bf5fbe59a174aa, []int{23} +func (m *SetFriendRemarkReq) Reset() { *m = SetFriendRemarkReq{} } +func (m *SetFriendRemarkReq) String() string { return proto.CompactTextString(m) } +func (*SetFriendRemarkReq) ProtoMessage() {} +func (*SetFriendRemarkReq) Descriptor() ([]byte, []int) { + return fileDescriptor_friend_74b4824fb8c5de90, []int{27} } -func (m *SetFriendCommentReq) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SetFriendCommentReq.Unmarshal(m, b) +func (m *SetFriendRemarkReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SetFriendRemarkReq.Unmarshal(m, b) } -func (m *SetFriendCommentReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SetFriendCommentReq.Marshal(b, m, deterministic) +func (m *SetFriendRemarkReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SetFriendRemarkReq.Marshal(b, m, deterministic) } -func (dst *SetFriendCommentReq) XXX_Merge(src proto.Message) { - xxx_messageInfo_SetFriendCommentReq.Merge(dst, src) +func (dst *SetFriendRemarkReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetFriendRemarkReq.Merge(dst, src) } -func (m *SetFriendCommentReq) XXX_Size() int { - return xxx_messageInfo_SetFriendCommentReq.Size(m) +func (m *SetFriendRemarkReq) XXX_Size() int { + return xxx_messageInfo_SetFriendRemarkReq.Size(m) } -func (m *SetFriendCommentReq) XXX_DiscardUnknown() { - xxx_messageInfo_SetFriendCommentReq.DiscardUnknown(m) +func (m *SetFriendRemarkReq) XXX_DiscardUnknown() { + xxx_messageInfo_SetFriendRemarkReq.DiscardUnknown(m) } -var xxx_messageInfo_SetFriendCommentReq proto.InternalMessageInfo +var xxx_messageInfo_SetFriendRemarkReq proto.InternalMessageInfo -func (m *SetFriendCommentReq) GetUid() string { +func (m *SetFriendRemarkReq) GetCommID() *CommID { if m != nil { - return m.Uid + return m.CommID + } + return nil +} + +func (m *SetFriendRemarkReq) GetRemark() string { + if m != nil { + return m.Remark } return "" } -func (m *SetFriendCommentReq) GetOperationID() string { +type SetFriendRemarkResp 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 *SetFriendRemarkResp) Reset() { *m = SetFriendRemarkResp{} } +func (m *SetFriendRemarkResp) String() string { return proto.CompactTextString(m) } +func (*SetFriendRemarkResp) ProtoMessage() {} +func (*SetFriendRemarkResp) Descriptor() ([]byte, []int) { + return fileDescriptor_friend_74b4824fb8c5de90, []int{28} +} +func (m *SetFriendRemarkResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SetFriendRemarkResp.Unmarshal(m, b) +} +func (m *SetFriendRemarkResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SetFriendRemarkResp.Marshal(b, m, deterministic) +} +func (dst *SetFriendRemarkResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetFriendRemarkResp.Merge(dst, src) +} +func (m *SetFriendRemarkResp) XXX_Size() int { + return xxx_messageInfo_SetFriendRemarkResp.Size(m) +} +func (m *SetFriendRemarkResp) XXX_DiscardUnknown() { + xxx_messageInfo_SetFriendRemarkResp.DiscardUnknown(m) +} + +var xxx_messageInfo_SetFriendRemarkResp proto.InternalMessageInfo + +func (m *SetFriendRemarkResp) GetCommonResp() *CommonResp { if m != nil { - return m.OperationID + return m.CommonResp + } + return nil +} + +type GetSelfApplyListReq struct { + CommID *CommID `protobuf:"bytes,1,opt,name=CommID" json:"CommID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetSelfApplyListReq) Reset() { *m = GetSelfApplyListReq{} } +func (m *GetSelfApplyListReq) String() string { return proto.CompactTextString(m) } +func (*GetSelfApplyListReq) ProtoMessage() {} +func (*GetSelfApplyListReq) Descriptor() ([]byte, []int) { + return fileDescriptor_friend_74b4824fb8c5de90, []int{29} +} +func (m *GetSelfApplyListReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetSelfApplyListReq.Unmarshal(m, b) +} +func (m *GetSelfApplyListReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetSelfApplyListReq.Marshal(b, m, deterministic) +} +func (dst *GetSelfApplyListReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetSelfApplyListReq.Merge(dst, src) +} +func (m *GetSelfApplyListReq) XXX_Size() int { + return xxx_messageInfo_GetSelfApplyListReq.Size(m) +} +func (m *GetSelfApplyListReq) XXX_DiscardUnknown() { + xxx_messageInfo_GetSelfApplyListReq.DiscardUnknown(m) +} + +var xxx_messageInfo_GetSelfApplyListReq proto.InternalMessageInfo + +func (m *GetSelfApplyListReq) GetCommID() *CommID { + if m != nil { + return m.CommID + } + return nil +} + +type GetSelfApplyListResp struct { + ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"` + FriendRequestList []*sdk_ws.FriendRequest `protobuf:"bytes,3,rep,name=FriendRequestList" json:"FriendRequestList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetSelfApplyListResp) Reset() { *m = GetSelfApplyListResp{} } +func (m *GetSelfApplyListResp) String() string { return proto.CompactTextString(m) } +func (*GetSelfApplyListResp) ProtoMessage() {} +func (*GetSelfApplyListResp) Descriptor() ([]byte, []int) { + return fileDescriptor_friend_74b4824fb8c5de90, []int{30} +} +func (m *GetSelfApplyListResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetSelfApplyListResp.Unmarshal(m, b) +} +func (m *GetSelfApplyListResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetSelfApplyListResp.Marshal(b, m, deterministic) +} +func (dst *GetSelfApplyListResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetSelfApplyListResp.Merge(dst, src) +} +func (m *GetSelfApplyListResp) XXX_Size() int { + return xxx_messageInfo_GetSelfApplyListResp.Size(m) +} +func (m *GetSelfApplyListResp) XXX_DiscardUnknown() { + xxx_messageInfo_GetSelfApplyListResp.DiscardUnknown(m) +} + +var xxx_messageInfo_GetSelfApplyListResp proto.InternalMessageInfo + +func (m *GetSelfApplyListResp) GetErrCode() int32 { + if m != nil { + return m.ErrCode + } + return 0 +} + +func (m *GetSelfApplyListResp) GetErrMsg() string { + if m != nil { + return m.ErrMsg } return "" } -func (m *SetFriendCommentReq) GetComment() string { +func (m *GetSelfApplyListResp) GetFriendRequestList() []*sdk_ws.FriendRequest { if m != nil { - return m.Comment + return m.FriendRequestList } - return "" -} - -func (m *SetFriendCommentReq) GetToken() string { - if m != nil { - return m.Token - } - return "" + return nil } func init() { proto.RegisterType((*CommonResp)(nil), "friend.CommonResp") + proto.RegisterType((*CommID)(nil), "friend.CommID") proto.RegisterType((*GetFriendsInfoReq)(nil), "friend.GetFriendsInfoReq") proto.RegisterType((*GetFriendInfoResp)(nil), "friend.GetFriendInfoResp") - proto.RegisterType((*GetFriendData)(nil), "friend.GetFriendData") proto.RegisterType((*AddFriendReq)(nil), "friend.AddFriendReq") + proto.RegisterType((*AddFriendResp)(nil), "friend.AddFriendResp") proto.RegisterType((*ImportFriendReq)(nil), "friend.ImportFriendReq") + proto.RegisterType((*UserIDResult)(nil), "friend.UserIDResult") proto.RegisterType((*ImportFriendResp)(nil), "friend.ImportFriendResp") - proto.RegisterType((*GetFriendApplyReq)(nil), "friend.GetFriendApplyReq") - proto.RegisterType((*GetFriendApplyResp)(nil), "friend.GetFriendApplyResp") - proto.RegisterType((*ApplyUserInfo)(nil), "friend.ApplyUserInfo") - proto.RegisterType((*GetFriendListReq)(nil), "friend.getFriendListReq") - proto.RegisterType((*GetFriendListResp)(nil), "friend.getFriendListResp") - proto.RegisterType((*UserInfo)(nil), "friend.UserInfo") + proto.RegisterType((*GetFriendApplyListReq)(nil), "friend.GetFriendApplyListReq") + proto.RegisterType((*GetFriendApplyListResp)(nil), "friend.GetFriendApplyListResp") + proto.RegisterType((*GetFriendListReq)(nil), "friend.GetFriendListReq") + proto.RegisterType((*GetFriendListResp)(nil), "friend.GetFriendListResp") proto.RegisterType((*AddBlacklistReq)(nil), "friend.AddBlacklistReq") + proto.RegisterType((*AddBlacklistResp)(nil), "friend.AddBlacklistResp") proto.RegisterType((*RemoveBlacklistReq)(nil), "friend.RemoveBlacklistReq") + proto.RegisterType((*RemoveBlacklistResp)(nil), "friend.RemoveBlacklistResp") proto.RegisterType((*GetBlacklistReq)(nil), "friend.GetBlacklistReq") proto.RegisterType((*GetBlacklistResp)(nil), "friend.GetBlacklistResp") proto.RegisterType((*IsFriendReq)(nil), "friend.IsFriendReq") @@ -1526,8 +1444,13 @@ func init() { proto.RegisterType((*IsInBlackListReq)(nil), "friend.IsInBlackListReq") proto.RegisterType((*IsInBlackListResp)(nil), "friend.IsInBlackListResp") proto.RegisterType((*DeleteFriendReq)(nil), "friend.DeleteFriendReq") + proto.RegisterType((*DeleteFriendResp)(nil), "friend.DeleteFriendResp") proto.RegisterType((*AddFriendResponseReq)(nil), "friend.AddFriendResponseReq") - proto.RegisterType((*SetFriendCommentReq)(nil), "friend.SetFriendCommentReq") + proto.RegisterType((*AddFriendResponseResp)(nil), "friend.AddFriendResponseResp") + proto.RegisterType((*SetFriendRemarkReq)(nil), "friend.SetFriendRemarkReq") + proto.RegisterType((*SetFriendRemarkResp)(nil), "friend.SetFriendRemarkResp") + proto.RegisterType((*GetSelfApplyListReq)(nil), "friend.GetSelfApplyListReq") + proto.RegisterType((*GetSelfApplyListResp)(nil), "friend.GetSelfApplyListResp") } // Reference imports to suppress errors if they are not otherwise used. @@ -1541,19 +1464,19 @@ const _ = grpc.SupportPackageIsVersion4 // Client API for Friend service type FriendClient interface { - GetFriendsInfo(ctx context.Context, in *GetFriendsInfoReq, opts ...grpc.CallOption) (*GetFriendInfoResp, error) - AddFriend(ctx context.Context, in *AddFriendReq, opts ...grpc.CallOption) (*CommonResp, error) - GetFriendApplyList(ctx context.Context, in *GetFriendApplyReq, opts ...grpc.CallOption) (*GetFriendApplyResp, error) - GetSelfApplyList(ctx context.Context, in *GetFriendApplyReq, opts ...grpc.CallOption) (*GetFriendApplyResp, error) + // rpc getFriendsInfo(GetFriendsInfoReq) returns(GetFriendInfoResp); + AddFriend(ctx context.Context, in *AddFriendReq, opts ...grpc.CallOption) (*AddFriendResp, error) + GetFriendApplyList(ctx context.Context, in *GetFriendApplyListReq, opts ...grpc.CallOption) (*GetFriendApplyListResp, error) + GetSelfApplyList(ctx context.Context, in *GetSelfApplyListReq, opts ...grpc.CallOption) (*GetSelfApplyListResp, error) GetFriendList(ctx context.Context, in *GetFriendListReq, opts ...grpc.CallOption) (*GetFriendListResp, error) - AddBlacklist(ctx context.Context, in *AddBlacklistReq, opts ...grpc.CallOption) (*CommonResp, error) - RemoveBlacklist(ctx context.Context, in *RemoveBlacklistReq, opts ...grpc.CallOption) (*CommonResp, error) + AddBlacklist(ctx context.Context, in *AddBlacklistReq, opts ...grpc.CallOption) (*AddBlacklistResp, error) + RemoveBlacklist(ctx context.Context, in *RemoveBlacklistReq, opts ...grpc.CallOption) (*RemoveBlacklistResp, error) IsFriend(ctx context.Context, in *IsFriendReq, opts ...grpc.CallOption) (*IsFriendResp, error) IsInBlackList(ctx context.Context, in *IsInBlackListReq, opts ...grpc.CallOption) (*IsInBlackListResp, error) GetBlacklist(ctx context.Context, in *GetBlacklistReq, opts ...grpc.CallOption) (*GetBlacklistResp, error) - DeleteFriend(ctx context.Context, in *DeleteFriendReq, opts ...grpc.CallOption) (*CommonResp, error) - AddFriendResponse(ctx context.Context, in *AddFriendResponseReq, opts ...grpc.CallOption) (*CommonResp, error) - SetFriendComment(ctx context.Context, in *SetFriendCommentReq, opts ...grpc.CallOption) (*CommonResp, error) + DeleteFriend(ctx context.Context, in *DeleteFriendReq, opts ...grpc.CallOption) (*DeleteFriendResp, error) + AddFriendResponse(ctx context.Context, in *AddFriendResponseReq, opts ...grpc.CallOption) (*AddFriendResponseResp, error) + SetFriendRemark(ctx context.Context, in *SetFriendRemarkReq, opts ...grpc.CallOption) (*SetFriendRemarkResp, error) ImportFriend(ctx context.Context, in *ImportFriendReq, opts ...grpc.CallOption) (*ImportFriendResp, error) } @@ -1565,17 +1488,8 @@ func NewFriendClient(cc *grpc.ClientConn) FriendClient { return &friendClient{cc} } -func (c *friendClient) GetFriendsInfo(ctx context.Context, in *GetFriendsInfoReq, opts ...grpc.CallOption) (*GetFriendInfoResp, error) { - out := new(GetFriendInfoResp) - err := grpc.Invoke(ctx, "/friend.friend/getFriendsInfo", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *friendClient) AddFriend(ctx context.Context, in *AddFriendReq, opts ...grpc.CallOption) (*CommonResp, error) { - out := new(CommonResp) +func (c *friendClient) AddFriend(ctx context.Context, in *AddFriendReq, opts ...grpc.CallOption) (*AddFriendResp, error) { + out := new(AddFriendResp) err := grpc.Invoke(ctx, "/friend.friend/addFriend", in, out, c.cc, opts...) if err != nil { return nil, err @@ -1583,8 +1497,8 @@ func (c *friendClient) AddFriend(ctx context.Context, in *AddFriendReq, opts ... return out, nil } -func (c *friendClient) GetFriendApplyList(ctx context.Context, in *GetFriendApplyReq, opts ...grpc.CallOption) (*GetFriendApplyResp, error) { - out := new(GetFriendApplyResp) +func (c *friendClient) GetFriendApplyList(ctx context.Context, in *GetFriendApplyListReq, opts ...grpc.CallOption) (*GetFriendApplyListResp, error) { + out := new(GetFriendApplyListResp) err := grpc.Invoke(ctx, "/friend.friend/getFriendApplyList", in, out, c.cc, opts...) if err != nil { return nil, err @@ -1592,8 +1506,8 @@ func (c *friendClient) GetFriendApplyList(ctx context.Context, in *GetFriendAppl return out, nil } -func (c *friendClient) GetSelfApplyList(ctx context.Context, in *GetFriendApplyReq, opts ...grpc.CallOption) (*GetFriendApplyResp, error) { - out := new(GetFriendApplyResp) +func (c *friendClient) GetSelfApplyList(ctx context.Context, in *GetSelfApplyListReq, opts ...grpc.CallOption) (*GetSelfApplyListResp, error) { + out := new(GetSelfApplyListResp) err := grpc.Invoke(ctx, "/friend.friend/getSelfApplyList", in, out, c.cc, opts...) if err != nil { return nil, err @@ -1610,8 +1524,8 @@ func (c *friendClient) GetFriendList(ctx context.Context, in *GetFriendListReq, return out, nil } -func (c *friendClient) AddBlacklist(ctx context.Context, in *AddBlacklistReq, opts ...grpc.CallOption) (*CommonResp, error) { - out := new(CommonResp) +func (c *friendClient) AddBlacklist(ctx context.Context, in *AddBlacklistReq, opts ...grpc.CallOption) (*AddBlacklistResp, error) { + out := new(AddBlacklistResp) err := grpc.Invoke(ctx, "/friend.friend/addBlacklist", in, out, c.cc, opts...) if err != nil { return nil, err @@ -1619,8 +1533,8 @@ func (c *friendClient) AddBlacklist(ctx context.Context, in *AddBlacklistReq, op return out, nil } -func (c *friendClient) RemoveBlacklist(ctx context.Context, in *RemoveBlacklistReq, opts ...grpc.CallOption) (*CommonResp, error) { - out := new(CommonResp) +func (c *friendClient) RemoveBlacklist(ctx context.Context, in *RemoveBlacklistReq, opts ...grpc.CallOption) (*RemoveBlacklistResp, error) { + out := new(RemoveBlacklistResp) err := grpc.Invoke(ctx, "/friend.friend/removeBlacklist", in, out, c.cc, opts...) if err != nil { return nil, err @@ -1655,8 +1569,8 @@ func (c *friendClient) GetBlacklist(ctx context.Context, in *GetBlacklistReq, op return out, nil } -func (c *friendClient) DeleteFriend(ctx context.Context, in *DeleteFriendReq, opts ...grpc.CallOption) (*CommonResp, error) { - out := new(CommonResp) +func (c *friendClient) DeleteFriend(ctx context.Context, in *DeleteFriendReq, opts ...grpc.CallOption) (*DeleteFriendResp, error) { + out := new(DeleteFriendResp) err := grpc.Invoke(ctx, "/friend.friend/deleteFriend", in, out, c.cc, opts...) if err != nil { return nil, err @@ -1664,8 +1578,8 @@ func (c *friendClient) DeleteFriend(ctx context.Context, in *DeleteFriendReq, op return out, nil } -func (c *friendClient) AddFriendResponse(ctx context.Context, in *AddFriendResponseReq, opts ...grpc.CallOption) (*CommonResp, error) { - out := new(CommonResp) +func (c *friendClient) AddFriendResponse(ctx context.Context, in *AddFriendResponseReq, opts ...grpc.CallOption) (*AddFriendResponseResp, error) { + out := new(AddFriendResponseResp) err := grpc.Invoke(ctx, "/friend.friend/addFriendResponse", in, out, c.cc, opts...) if err != nil { return nil, err @@ -1673,9 +1587,9 @@ func (c *friendClient) AddFriendResponse(ctx context.Context, in *AddFriendRespo return out, nil } -func (c *friendClient) SetFriendComment(ctx context.Context, in *SetFriendCommentReq, opts ...grpc.CallOption) (*CommonResp, error) { - out := new(CommonResp) - err := grpc.Invoke(ctx, "/friend.friend/setFriendComment", in, out, c.cc, opts...) +func (c *friendClient) SetFriendRemark(ctx context.Context, in *SetFriendRemarkReq, opts ...grpc.CallOption) (*SetFriendRemarkResp, error) { + out := new(SetFriendRemarkResp) + err := grpc.Invoke(ctx, "/friend.friend/setFriendRemark", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -1684,7 +1598,7 @@ func (c *friendClient) SetFriendComment(ctx context.Context, in *SetFriendCommen func (c *friendClient) ImportFriend(ctx context.Context, in *ImportFriendReq, opts ...grpc.CallOption) (*ImportFriendResp, error) { out := new(ImportFriendResp) - err := grpc.Invoke(ctx, "/friend.friend/ImportFriend", in, out, c.cc, opts...) + err := grpc.Invoke(ctx, "/friend.friend/importFriend", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -1694,19 +1608,19 @@ func (c *friendClient) ImportFriend(ctx context.Context, in *ImportFriendReq, op // Server API for Friend service type FriendServer interface { - GetFriendsInfo(context.Context, *GetFriendsInfoReq) (*GetFriendInfoResp, error) - AddFriend(context.Context, *AddFriendReq) (*CommonResp, error) - GetFriendApplyList(context.Context, *GetFriendApplyReq) (*GetFriendApplyResp, error) - GetSelfApplyList(context.Context, *GetFriendApplyReq) (*GetFriendApplyResp, error) + // rpc getFriendsInfo(GetFriendsInfoReq) returns(GetFriendInfoResp); + AddFriend(context.Context, *AddFriendReq) (*AddFriendResp, error) + GetFriendApplyList(context.Context, *GetFriendApplyListReq) (*GetFriendApplyListResp, error) + GetSelfApplyList(context.Context, *GetSelfApplyListReq) (*GetSelfApplyListResp, error) GetFriendList(context.Context, *GetFriendListReq) (*GetFriendListResp, error) - AddBlacklist(context.Context, *AddBlacklistReq) (*CommonResp, error) - RemoveBlacklist(context.Context, *RemoveBlacklistReq) (*CommonResp, error) + AddBlacklist(context.Context, *AddBlacklistReq) (*AddBlacklistResp, error) + RemoveBlacklist(context.Context, *RemoveBlacklistReq) (*RemoveBlacklistResp, error) IsFriend(context.Context, *IsFriendReq) (*IsFriendResp, error) IsInBlackList(context.Context, *IsInBlackListReq) (*IsInBlackListResp, error) GetBlacklist(context.Context, *GetBlacklistReq) (*GetBlacklistResp, error) - DeleteFriend(context.Context, *DeleteFriendReq) (*CommonResp, error) - AddFriendResponse(context.Context, *AddFriendResponseReq) (*CommonResp, error) - SetFriendComment(context.Context, *SetFriendCommentReq) (*CommonResp, error) + DeleteFriend(context.Context, *DeleteFriendReq) (*DeleteFriendResp, error) + AddFriendResponse(context.Context, *AddFriendResponseReq) (*AddFriendResponseResp, error) + SetFriendRemark(context.Context, *SetFriendRemarkReq) (*SetFriendRemarkResp, error) ImportFriend(context.Context, *ImportFriendReq) (*ImportFriendResp, error) } @@ -1714,24 +1628,6 @@ func RegisterFriendServer(s *grpc.Server, srv FriendServer) { s.RegisterService(&_Friend_serviceDesc, srv) } -func _Friend_GetFriendsInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetFriendsInfoReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FriendServer).GetFriendsInfo(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/friend.friend/GetFriendsInfo", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FriendServer).GetFriendsInfo(ctx, req.(*GetFriendsInfoReq)) - } - return interceptor(ctx, in, info, handler) -} - func _Friend_AddFriend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(AddFriendReq) if err := dec(in); err != nil { @@ -1751,7 +1647,7 @@ func _Friend_AddFriend_Handler(srv interface{}, ctx context.Context, dec func(in } func _Friend_GetFriendApplyList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetFriendApplyReq) + in := new(GetFriendApplyListReq) if err := dec(in); err != nil { return nil, err } @@ -1763,13 +1659,13 @@ func _Friend_GetFriendApplyList_Handler(srv interface{}, ctx context.Context, de FullMethod: "/friend.friend/GetFriendApplyList", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FriendServer).GetFriendApplyList(ctx, req.(*GetFriendApplyReq)) + return srv.(FriendServer).GetFriendApplyList(ctx, req.(*GetFriendApplyListReq)) } return interceptor(ctx, in, info, handler) } func _Friend_GetSelfApplyList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetFriendApplyReq) + in := new(GetSelfApplyListReq) if err := dec(in); err != nil { return nil, err } @@ -1781,7 +1677,7 @@ func _Friend_GetSelfApplyList_Handler(srv interface{}, ctx context.Context, dec FullMethod: "/friend.friend/GetSelfApplyList", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FriendServer).GetSelfApplyList(ctx, req.(*GetFriendApplyReq)) + return srv.(FriendServer).GetSelfApplyList(ctx, req.(*GetSelfApplyListReq)) } return interceptor(ctx, in, info, handler) } @@ -1930,20 +1826,20 @@ func _Friend_AddFriendResponse_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } -func _Friend_SetFriendComment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SetFriendCommentReq) +func _Friend_SetFriendRemark_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetFriendRemarkReq) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(FriendServer).SetFriendComment(ctx, in) + return srv.(FriendServer).SetFriendRemark(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/friend.friend/SetFriendComment", + FullMethod: "/friend.friend/SetFriendRemark", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FriendServer).SetFriendComment(ctx, req.(*SetFriendCommentReq)) + return srv.(FriendServer).SetFriendRemark(ctx, req.(*SetFriendRemarkReq)) } return interceptor(ctx, in, info, handler) } @@ -1970,10 +1866,6 @@ var _Friend_serviceDesc = grpc.ServiceDesc{ ServiceName: "friend.friend", HandlerType: (*FriendServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "getFriendsInfo", - Handler: _Friend_GetFriendsInfo_Handler, - }, { MethodName: "addFriend", Handler: _Friend_AddFriend_Handler, @@ -2019,11 +1911,11 @@ var _Friend_serviceDesc = grpc.ServiceDesc{ Handler: _Friend_AddFriendResponse_Handler, }, { - MethodName: "setFriendComment", - Handler: _Friend_SetFriendComment_Handler, + MethodName: "setFriendRemark", + Handler: _Friend_SetFriendRemark_Handler, }, { - MethodName: "ImportFriend", + MethodName: "importFriend", Handler: _Friend_ImportFriend_Handler, }, }, @@ -2031,72 +1923,68 @@ var _Friend_serviceDesc = grpc.ServiceDesc{ Metadata: "friend/friend.proto", } -func init() { proto.RegisterFile("friend/friend.proto", fileDescriptor_friend_03bf5fbe59a174aa) } +func init() { proto.RegisterFile("friend/friend.proto", fileDescriptor_friend_74b4824fb8c5de90) } -var fileDescriptor_friend_03bf5fbe59a174aa = []byte{ - // 1013 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xcd, 0x6e, 0xdb, 0x46, - 0x10, 0x86, 0x48, 0xc9, 0x96, 0x46, 0x72, 0x24, 0xad, 0xdd, 0x96, 0x65, 0x83, 0x42, 0x20, 0x72, - 0x48, 0x2f, 0x2e, 0xe0, 0x22, 0xa7, 0x9c, 0x14, 0xbb, 0x0e, 0xd4, 0x34, 0x08, 0xc0, 0xd8, 0x97, - 0x16, 0x2d, 0x40, 0x8b, 0x23, 0x66, 0x11, 0xfe, 0x85, 0xcb, 0x24, 0xf6, 0xa9, 0xc7, 0x9e, 0xfb, - 0x28, 0x7d, 0xb3, 0x3e, 0x42, 0xb1, 0xbb, 0x24, 0x77, 0xf9, 0xa3, 0x34, 0xa8, 0x1c, 0xe7, 0x24, - 0xce, 0x70, 0x35, 0x3b, 0xdf, 0xcc, 0x7c, 0x33, 0x43, 0x38, 0xdc, 0x64, 0x14, 0x63, 0xff, 0x7b, - 0xf9, 0x73, 0x9c, 0x66, 0x49, 0x9e, 0x90, 0x3d, 0x29, 0x39, 0xe7, 0x00, 0xa7, 0x49, 0x14, 0x25, - 0xb1, 0x8b, 0x2c, 0x25, 0xf7, 0x61, 0x84, 0x59, 0x96, 0x64, 0xa7, 0x89, 0x8f, 0x56, 0x6f, 0xd1, - 0x7b, 0x38, 0x70, 0x95, 0x82, 0xd8, 0x30, 0x14, 0xc2, 0x73, 0x16, 0x58, 0xc6, 0xa2, 0xf7, 0x70, - 0xe4, 0x56, 0xb2, 0xf3, 0x1b, 0xcc, 0x9f, 0x62, 0x7e, 0x2e, 0x8c, 0xb2, 0x55, 0xbc, 0x49, 0x5c, - 0x7c, 0x43, 0x66, 0x60, 0xbe, 0xa5, 0xbe, 0x30, 0x34, 0x72, 0xf9, 0x23, 0x59, 0xc0, 0xf8, 0x45, - 0x8a, 0x99, 0x97, 0xd3, 0x24, 0x5e, 0x9d, 0x15, 0x56, 0x74, 0x15, 0x39, 0x82, 0xc1, 0x45, 0xf2, - 0x1a, 0x63, 0xcb, 0x14, 0xef, 0xa4, 0xe0, 0x5c, 0x6b, 0xe6, 0xa5, 0xf5, 0x5d, 0xbc, 0x25, 0xdf, - 0x41, 0xff, 0xcc, 0xcb, 0x3d, 0x71, 0xc7, 0xf8, 0xe4, 0x8b, 0xe3, 0x22, 0x34, 0xd5, 0x15, 0xfc, - 0xa5, 0x2b, 0x8e, 0x38, 0x7f, 0x19, 0x70, 0x50, 0xd3, 0x77, 0xa0, 0x22, 0xd0, 0xa7, 0xeb, 0x24, - 0x2e, 0xae, 0x11, 0xcf, 0x5c, 0x17, 0x7b, 0x11, 0x16, 0x30, 0xc4, 0x33, 0xf9, 0x12, 0xf6, 0x02, - 0x8c, 0x7d, 0xcc, 0xac, 0xbe, 0xf0, 0xb6, 0x90, 0xb8, 0x3e, 0x4a, 0xae, 0x68, 0x88, 0xd6, 0x40, - 0x9c, 0x2e, 0x24, 0x1e, 0x8b, 0x2b, 0x9a, 0xe5, 0xaf, 0xac, 0x3d, 0x19, 0x0b, 0x21, 0x70, 0x2d, - 0x46, 0x1e, 0x0d, 0xad, 0x7d, 0xa9, 0x15, 0x02, 0xb9, 0x07, 0x06, 0x5e, 0x5b, 0x43, 0xa1, 0x32, - 0xf0, 0x9a, 0x58, 0xb0, 0xbf, 0x4e, 0xa2, 0x08, 0xe3, 0xdc, 0x1a, 0x09, 0x65, 0x29, 0xf2, 0xc0, - 0x50, 0x26, 0xf1, 0x58, 0x20, 0xfc, 0xa8, 0x64, 0xf2, 0x00, 0x0e, 0x28, 0x5b, 0xc5, 0x4f, 0x42, - 0x6f, 0xfd, 0xfa, 0x67, 0xca, 0x72, 0x6b, 0x2c, 0x0e, 0xd4, 0x95, 0xce, 0x35, 0x4c, 0x96, 0xbe, - 0x2f, 0xff, 0x72, 0xab, 0x79, 0x26, 0xdf, 0x02, 0xb8, 0xf8, 0xe6, 0x39, 0x32, 0xe6, 0x05, 0x28, - 0xa2, 0x34, 0x72, 0x35, 0x8d, 0xf3, 0x07, 0x4c, 0x57, 0x51, 0x9a, 0x64, 0xb9, 0xba, 0xdc, 0x82, - 0xfd, 0xb7, 0xd4, 0x17, 0xce, 0xf6, 0x16, 0x26, 0x07, 0x5a, 0x88, 0xff, 0xdb, 0x09, 0x1b, 0x86, - 0x2f, 0xde, 0xc7, 0x98, 0x5d, 0x52, 0xbf, 0x70, 0xa1, 0x92, 0x9d, 0x10, 0x66, 0x75, 0x07, 0x58, - 0x4a, 0x4e, 0x00, 0xd6, 0x15, 0x87, 0x44, 0x14, 0xc6, 0x27, 0xa4, 0xac, 0x29, 0xc5, 0x2e, 0x57, - 0x3b, 0xc5, 0x03, 0xbd, 0xf1, 0x68, 0x88, 0xfe, 0x65, 0xe1, 0xbb, 0x21, 0x7c, 0xaf, 0x2b, 0x9d, - 0x67, 0x5a, 0xd9, 0x2f, 0xd3, 0x34, 0xbc, 0xe1, 0x80, 0x1b, 0xb0, 0x7a, 0x1f, 0x80, 0x65, 0xe8, - 0x1c, 0xba, 0x01, 0xd2, 0x34, 0xb6, 0x2b, 0x89, 0x7c, 0x4e, 0xa2, 0xfe, 0xc2, 0xd4, 0x49, 0x24, - 0x4c, 0x5f, 0x32, 0xcc, 0x04, 0x4f, 0xc5, 0x11, 0xe7, 0x4f, 0x03, 0x0e, 0x6a, 0xfa, 0x6e, 0x12, - 0x09, 0xc2, 0x18, 0x1a, 0x61, 0x4a, 0x62, 0x99, 0x1a, 0xb1, 0xee, 0x92, 0x44, 0x04, 0xfa, 0x9b, - 0xd0, 0x0b, 0x04, 0x83, 0x06, 0xae, 0x78, 0xe6, 0x01, 0xf3, 0x38, 0x94, 0x0b, 0x1a, 0xa1, 0xe0, - 0xcf, 0xc8, 0x55, 0x0a, 0x5e, 0xc0, 0x99, 0x2a, 0xe0, 0xb1, 0x2c, 0x60, 0xa5, 0x71, 0x7e, 0x82, - 0x59, 0x50, 0x26, 0x81, 0xa7, 0x78, 0x97, 0x84, 0x32, 0x98, 0x37, 0x6c, 0xed, 0x94, 0xcf, 0x07, - 0x45, 0x3e, 0x4d, 0x91, 0xcf, 0x59, 0x99, 0xcf, 0x46, 0x2a, 0xff, 0xe9, 0xc1, 0xf0, 0x23, 0xb2, - 0x68, 0x76, 0x64, 0xd1, 0xf8, 0x4c, 0x59, 0xdc, 0xde, 0x0a, 0x5b, 0xed, 0x0e, 0xba, 0xda, 0xdd, - 0x7b, 0x98, 0x2e, 0x7d, 0x5f, 0xc8, 0x61, 0x91, 0xb2, 0xdb, 0xeb, 0x78, 0x1f, 0x6a, 0x36, 0xbf, - 0x03, 0x71, 0x31, 0x4a, 0xde, 0xe1, 0xa7, 0xb9, 0xdb, 0x59, 0xc1, 0xf4, 0x29, 0xe6, 0x35, 0xe3, - 0x1f, 0x55, 0x8b, 0xb9, 0x5e, 0x8b, 0x42, 0x70, 0x32, 0x98, 0xd5, 0x4d, 0xdd, 0x41, 0x29, 0x22, - 0x8c, 0x57, 0x4c, 0x0d, 0x82, 0xca, 0xb1, 0x9e, 0xe6, 0x98, 0x24, 0xe4, 0x1a, 0xe9, 0x3b, 0xe4, - 0x11, 0x36, 0x4a, 0x42, 0x96, 0x9a, 0x26, 0x60, 0xb3, 0x05, 0xd8, 0xf1, 0x61, 0xa2, 0xae, 0xd9, - 0x09, 0x96, 0x0d, 0x43, 0xf6, 0x8a, 0xa6, 0x17, 0x37, 0xa9, 0x24, 0xc8, 0xc0, 0xad, 0x64, 0x27, - 0x86, 0xd9, 0x4a, 0xaf, 0xba, 0x62, 0xb4, 0x31, 0x8c, 0xf9, 0x34, 0x28, 0x30, 0x95, 0xe2, 0x2d, - 0xa0, 0xa2, 0x30, 0x6f, 0xdc, 0xb7, 0x2b, 0xb4, 0x0c, 0x59, 0x9a, 0xc4, 0x4c, 0x42, 0x1b, 0xba, - 0x95, 0xec, 0xfc, 0x0a, 0xd3, 0x33, 0x0c, 0x31, 0xc7, 0x4f, 0xb0, 0x31, 0x38, 0x39, 0x1c, 0x69, - 0xbb, 0x88, 0xbc, 0xb1, 0xfb, 0x86, 0xb2, 0x99, 0x1b, 0x5a, 0x33, 0xff, 0xcf, 0x38, 0xa9, 0x5b, - 0xfb, 0xf5, 0x59, 0x7a, 0xf8, 0xb2, 0x6c, 0xbd, 0xa7, 0xb2, 0x99, 0x6c, 0x85, 0x95, 0xb4, 0x61, - 0x69, 0x2a, 0xbd, 0x3b, 0x99, 0xf5, 0xee, 0x54, 0x15, 0x74, 0x5f, 0x2b, 0xe8, 0x93, 0xbf, 0xf7, - 0xa1, 0x58, 0xde, 0xc9, 0x39, 0xdc, 0x0b, 0x6a, 0x4b, 0x37, 0xf9, 0xba, 0xb5, 0xca, 0x96, 0xcb, - 0xb8, 0xdd, 0x7e, 0x55, 0x2d, 0xd2, 0x8f, 0x60, 0xe4, 0x95, 0x31, 0x24, 0x47, 0xd5, 0x20, 0xd7, - 0x56, 0x3c, 0xbb, 0x63, 0x9f, 0x21, 0xcf, 0x80, 0x04, 0xb5, 0x85, 0x42, 0x6c, 0x5d, 0xed, 0x7b, - 0xca, 0xcd, 0xc5, 0xb6, 0xb7, 0xbd, 0x62, 0x29, 0x59, 0x89, 0xc1, 0xf8, 0x12, 0xc3, 0xcd, 0xce, - 0xa6, 0xce, 0xe0, 0xa0, 0x36, 0x17, 0x89, 0x55, 0x1e, 0x6e, 0x8e, 0x5e, 0x15, 0x94, 0xf6, 0x20, - 0x7d, 0x0c, 0x13, 0x4f, 0xeb, 0xfa, 0xe4, 0x2b, 0x2d, 0x2e, 0x7a, 0xcb, 0xec, 0x0c, 0xcd, 0x12, - 0xa6, 0x59, 0xbd, 0x73, 0x93, 0xca, 0xe3, 0x76, 0x4b, 0xef, 0x34, 0xf1, 0x48, 0xad, 0xe9, 0xe4, - 0xb0, 0x7c, 0xaf, 0xf5, 0x3b, 0xfb, 0xa8, 0xad, 0x94, 0xe0, 0x6b, 0xd3, 0x4b, 0x81, 0x6f, 0xb6, - 0x17, 0x05, 0xbe, 0xdd, 0x08, 0x96, 0x30, 0x09, 0xb4, 0x76, 0xae, 0xc0, 0x37, 0xe6, 0x85, 0x6d, - 0x75, 0xbf, 0x90, 0xf1, 0xf3, 0x35, 0xd6, 0x2b, 0x13, 0x8d, 0x5e, 0xd0, 0x09, 0xfe, 0x47, 0x98, - 0x7b, 0x4d, 0x56, 0x93, 0xfb, 0x1d, 0x95, 0x59, 0x11, 0xbe, 0xd3, 0xcc, 0x29, 0xcc, 0x58, 0x83, - 0xa6, 0xe4, 0x9b, 0xf2, 0x5c, 0x07, 0x81, 0xb7, 0xe4, 0x72, 0xa2, 0xaf, 0xfc, 0x0a, 0x48, 0xe3, - 0x4b, 0x44, 0xc5, 0xa2, 0xf9, 0x85, 0xf0, 0x64, 0xfe, 0xcb, 0xf4, 0xb8, 0xf8, 0xfe, 0x7e, 0x2c, - 0x7f, 0xae, 0xf6, 0xc4, 0x77, 0xf8, 0x0f, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x6e, 0xf2, 0x29, - 0xc4, 0x9e, 0x0f, 0x00, 0x00, +var fileDescriptor_friend_74b4824fb8c5de90 = []byte{ + // 950 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xcf, 0x8f, 0xdb, 0x44, + 0x14, 0x96, 0x9b, 0x6e, 0x9a, 0xbc, 0xa4, 0x4d, 0x32, 0xc9, 0x96, 0xe0, 0xee, 0x56, 0xa9, 0x0f, + 0x28, 0xe2, 0x90, 0x48, 0x41, 0x95, 0x58, 0x0a, 0x85, 0x74, 0x93, 0xac, 0x0c, 0x6c, 0x53, 0xcd, + 0x96, 0x0b, 0x42, 0x8a, 0xdc, 0x7a, 0x36, 0x58, 0x71, 0xec, 0xa9, 0xc7, 0xdb, 0x15, 0x37, 0xc4, + 0x89, 0x03, 0x57, 0x24, 0x04, 0x07, 0xfe, 0x55, 0x64, 0x8f, 0x1d, 0xcf, 0xd8, 0xce, 0x0a, 0x9b, + 0x3d, 0x70, 0xda, 0x7d, 0xef, 0xcd, 0xf7, 0xf2, 0x7e, 0xcd, 0xfb, 0xc6, 0xd0, 0xbd, 0xf4, 0x2c, + 0xe2, 0x98, 0x63, 0xfe, 0x67, 0x44, 0x3d, 0xd7, 0x77, 0x51, 0x95, 0x4b, 0xea, 0x93, 0x25, 0x25, + 0xce, 0x4a, 0x3f, 0x1f, 0xd3, 0xcd, 0x7a, 0x1c, 0x9a, 0xc6, 0xcc, 0xdc, 0xac, 0xae, 0xd9, 0xf8, + 0x9a, 0xf1, 0xa3, 0xda, 0x73, 0x80, 0x53, 0x77, 0xbb, 0x75, 0x1d, 0x4c, 0x18, 0x45, 0x7d, 0xb8, + 0x47, 0x3c, 0xef, 0xd4, 0x35, 0x49, 0x5f, 0x19, 0x28, 0xc3, 0x03, 0x1c, 0x8b, 0xe8, 0x21, 0x54, + 0x89, 0xe7, 0x9d, 0xb3, 0x75, 0xff, 0xce, 0x40, 0x19, 0xd6, 0x71, 0x24, 0x69, 0xbf, 0x28, 0x50, + 0x0d, 0x1c, 0xe8, 0x33, 0xa4, 0x42, 0x6d, 0x49, 0xbf, 0x63, 0xc4, 0xd3, 0x67, 0x21, 0xba, 0x8e, + 0x77, 0x32, 0x1a, 0x40, 0x63, 0x49, 0x89, 0x67, 0xf8, 0x96, 0xeb, 0xe8, 0xb3, 0xc8, 0x87, 0xa8, + 0x0a, 0xd0, 0xaf, 0xdd, 0x08, 0x7d, 0x97, 0xa3, 0x63, 0x19, 0x3d, 0x06, 0x58, 0x78, 0xee, 0x36, + 0xb2, 0x1e, 0x84, 0x56, 0x41, 0xa3, 0x3d, 0x83, 0xce, 0x19, 0xf1, 0x17, 0x61, 0xd2, 0x4c, 0x77, + 0x2e, 0x5d, 0x4c, 0xde, 0xa1, 0x8f, 0xe2, 0xc0, 0xc2, 0x60, 0x1a, 0x93, 0x07, 0xa3, 0xa8, 0x46, + 0x5c, 0x8b, 0x23, 0xab, 0xf6, 0x9b, 0x22, 0xa0, 0x39, 0x98, 0x57, 0x62, 0x2e, 0x57, 0x62, 0x9e, + 0x54, 0x62, 0x2e, 0x55, 0x82, 0x4b, 0x68, 0x0e, 0x0f, 0x12, 0x1f, 0xdf, 0x5a, 0xcc, 0xef, 0x57, + 0x06, 0x95, 0x61, 0x63, 0x72, 0x3c, 0x62, 0xc4, 0x7b, 0x4f, 0xbc, 0x95, 0x41, 0xad, 0x15, 0x35, + 0x3c, 0x63, 0xcb, 0x46, 0xc2, 0x8f, 0xa5, 0x40, 0xda, 0x4b, 0x68, 0x4e, 0x4d, 0x93, 0x2b, 0x0b, + 0xa4, 0x11, 0x84, 0x85, 0xc9, 0x3b, 0x21, 0x2c, 0x2e, 0x69, 0xa7, 0x70, 0x5f, 0xf0, 0xc7, 0x28, + 0x9a, 0x88, 0x1d, 0x8f, 0x9c, 0x22, 0xd1, 0x29, 0xb7, 0x60, 0xe1, 0x94, 0xf6, 0x97, 0x02, 0x2d, + 0x7d, 0x4b, 0x5d, 0xcf, 0x4f, 0x02, 0xfb, 0x18, 0xda, 0x5c, 0xe0, 0x4d, 0x08, 0x33, 0x56, 0x06, + 0x95, 0x61, 0x1d, 0x67, 0xf4, 0xff, 0xa2, 0xfd, 0x72, 0x8b, 0x2b, 0xe9, 0x16, 0x4b, 0xc3, 0x75, + 0x57, 0x1e, 0x2e, 0xed, 0x39, 0x34, 0xf9, 0x7f, 0x98, 0xb0, 0x2b, 0xdb, 0x0f, 0x4a, 0x21, 0x8d, + 0x61, 0x24, 0xf1, 0x12, 0x05, 0x27, 0xc2, 0x00, 0x0e, 0x70, 0x24, 0x69, 0xbf, 0x2a, 0xd0, 0x96, + 0xb3, 0x2b, 0x57, 0x26, 0xf4, 0x15, 0xb4, 0xc5, 0x40, 0xc2, 0x92, 0xdc, 0x09, 0x87, 0xa0, 0x17, + 0x23, 0x45, 0x3b, 0xce, 0x9c, 0xd6, 0xbe, 0x84, 0xc3, 0xdd, 0x2c, 0x4e, 0x29, 0xb5, 0x7f, 0x0a, + 0xb4, 0x45, 0xa6, 0xf9, 0x4f, 0x05, 0x1e, 0xe6, 0x79, 0x28, 0x35, 0xd2, 0x2f, 0xa1, 0xb3, 0xeb, + 0xf7, 0x15, 0x61, 0xbe, 0x30, 0xd5, 0x83, 0xbd, 0x53, 0x1d, 0x9d, 0xc5, 0x59, 0xa8, 0xf6, 0x19, + 0xb4, 0x77, 0xb1, 0x15, 0x4d, 0x4c, 0xba, 0xa6, 0xff, 0x21, 0xa7, 0x5b, 0xba, 0xa6, 0x27, 0xd0, + 0x9a, 0x9a, 0xe6, 0x0b, 0xdb, 0x78, 0xbb, 0xb1, 0x0b, 0x66, 0xb2, 0x80, 0xb6, 0x0c, 0x2d, 0x79, + 0x29, 0x3f, 0x07, 0x84, 0xc9, 0xd6, 0x7d, 0x4f, 0x4a, 0x45, 0xa1, 0x43, 0x37, 0x83, 0x2e, 0x19, + 0xc8, 0x09, 0xb4, 0xce, 0x88, 0x5f, 0x2a, 0x8a, 0xdf, 0x95, 0x70, 0x24, 0xe4, 0x18, 0x8a, 0x37, + 0x75, 0x09, 0x9d, 0xd0, 0x45, 0x78, 0x9f, 0xe4, 0xbe, 0x3e, 0xc9, 0xe9, 0xeb, 0xab, 0xab, 0x37, + 0xb6, 0xf5, 0x36, 0x3e, 0x8c, 0xb3, 0x58, 0xed, 0x29, 0x34, 0x74, 0x56, 0x78, 0x09, 0x6b, 0x3f, + 0x40, 0x33, 0x81, 0x95, 0xca, 0x44, 0x85, 0x5a, 0x80, 0x74, 0x1d, 0x46, 0xc2, 0x2d, 0x58, 0xc3, + 0x3b, 0x39, 0xb8, 0x3e, 0x3a, 0xd3, 0x9d, 0x30, 0xda, 0xa2, 0xd7, 0xc7, 0x80, 0x4e, 0x0a, 0x7b, + 0xeb, 0xe1, 0x9d, 0x40, 0x6b, 0x46, 0x6c, 0xe2, 0x93, 0xe2, 0x75, 0x5b, 0x40, 0x5b, 0x86, 0x96, + 0x9c, 0xc4, 0x9f, 0x15, 0xe8, 0x49, 0x6c, 0x17, 0x04, 0x56, 0x84, 0x45, 0x35, 0x68, 0xfe, 0x68, + 0x38, 0xa6, 0x4d, 0x24, 0xa2, 0x90, 0x74, 0xe8, 0x08, 0xea, 0x5c, 0x0e, 0xca, 0xc3, 0x99, 0x2a, + 0x51, 0x68, 0xdf, 0xc0, 0x61, 0x4e, 0x04, 0x25, 0xf3, 0x79, 0x0d, 0xe8, 0x82, 0xec, 0x58, 0x69, + 0x6b, 0x78, 0x9b, 0xc2, 0x4f, 0x82, 0x00, 0x94, 0x3c, 0x09, 0x02, 0x29, 0xb8, 0xfa, 0x19, 0xaf, + 0x25, 0x03, 0xfc, 0x02, 0xba, 0x67, 0xc4, 0xbf, 0x20, 0xf6, 0x65, 0x29, 0xb6, 0xfa, 0x43, 0x81, + 0x5e, 0x16, 0xff, 0x7f, 0xe0, 0xaa, 0xc9, 0xdf, 0xf7, 0x20, 0x7a, 0x46, 0xa3, 0x4f, 0xa1, 0x6e, + 0xc4, 0x2d, 0x45, 0x3b, 0x26, 0x17, 0x5f, 0x69, 0xea, 0x61, 0x8e, 0x96, 0x51, 0x74, 0x01, 0x68, + 0x9d, 0x21, 0x63, 0x74, 0x1c, 0x1f, 0xce, 0xa5, 0x7a, 0xf5, 0xf1, 0x4d, 0x66, 0x46, 0xd1, 0x39, + 0xb4, 0xd7, 0xa9, 0x9a, 0xa1, 0x47, 0x02, 0x26, 0xdd, 0x0d, 0xf5, 0x68, 0xbf, 0x91, 0x51, 0x34, + 0x83, 0xfb, 0x6b, 0x91, 0x57, 0x51, 0x3f, 0xf3, 0xfb, 0xb1, 0xa3, 0x0f, 0xf7, 0x58, 0x18, 0x45, + 0x53, 0x68, 0x1a, 0x02, 0xa9, 0xa1, 0x0f, 0x84, 0x82, 0x88, 0xcc, 0xa0, 0xf6, 0xf3, 0x0d, 0x8c, + 0xa2, 0xaf, 0xa1, 0xe5, 0xc9, 0x8c, 0x84, 0xd4, 0xf8, 0x70, 0x96, 0xe8, 0xd4, 0x47, 0x7b, 0x6d, + 0x8c, 0xa2, 0xa7, 0x50, 0xb3, 0xa2, 0x45, 0x8c, 0xba, 0xf1, 0x41, 0x61, 0xa3, 0xab, 0xbd, 0xac, + 0x92, 0xd7, 0xc2, 0x12, 0xb7, 0x64, 0x52, 0x8b, 0xf4, 0xe2, 0x4d, 0x6a, 0x91, 0x5d, 0xab, 0x53, + 0x68, 0xae, 0x05, 0x4e, 0x4b, 0x6a, 0x91, 0x62, 0x49, 0xb5, 0x9f, 0x6f, 0xe0, 0x2e, 0x4c, 0x61, + 0x21, 0x26, 0x2e, 0x52, 0x1b, 0x36, 0x71, 0x91, 0xd9, 0x9f, 0xaf, 0xa0, 0x63, 0xa4, 0x17, 0x11, + 0x3a, 0xca, 0x9d, 0xd3, 0x68, 0x4b, 0xaa, 0xc7, 0x37, 0x58, 0x79, 0x83, 0x98, 0xbc, 0x37, 0x92, + 0x06, 0x65, 0xd7, 0x54, 0xd2, 0xa0, 0xbc, 0x65, 0x33, 0x85, 0xa6, 0x25, 0x3c, 0xb9, 0x93, 0x04, + 0x53, 0x9f, 0x19, 0x49, 0x82, 0xe9, 0x17, 0xfa, 0x8b, 0xce, 0xf7, 0xad, 0x51, 0xf4, 0xdd, 0xfb, + 0x8c, 0xff, 0x79, 0x53, 0x0d, 0x3f, 0x6a, 0x3f, 0xf9, 0x27, 0x00, 0x00, 0xff, 0xff, 0x26, 0xd5, + 0xdf, 0x90, 0x16, 0x0f, 0x00, 0x00, } diff --git a/pkg/proto/friend/friend.proto b/pkg/proto/friend/friend.proto index 52b50d277..0050582d1 100644 --- a/pkg/proto/friend/friend.proto +++ b/pkg/proto/friend/friend.proto @@ -1,183 +1,169 @@ syntax = "proto3"; +import "Open_IM/pkg/proto/sdk_ws/ws.proto"; option go_package = "./friend;friend"; package friend; message CommonResp{ - int32 errorCode = 1; - string errorMsg = 2; + int32 errCode = 1; + string errMsg = 2; } +message CommID{ + string OpUserID = 1; + string OperationID = 2; + string ToUserID = 4; + string FromUserID = 5; +} + + message GetFriendsInfoReq{ - string uid = 1; - string OperationID = 2; - string Token = 3; + CommID CommID = 1; } message GetFriendInfoResp{ - int32 errorCode = 1; - string errorMsg = 2; - GetFriendData Data = 3; + int32 ErrCode = 1; + string ErrMsg = 2; + repeated server_api_params.FriendInfo FriendInfoList = 3; +// int32 IsBlack = 4; } -message GetFriendData{ - string uid = 1; - string icon = 2; - string name = 3; - int32 gender = 4; - string mobile = 5; - string birth = 6; - string email = 7; - string ex = 8; - string comment = 9; - int32 isFriend = 10; - int32 isInBlackList = 11; -} message AddFriendReq{ - string uid = 1; - string OperationID = 2; - string Token = 3; - string ReqMessage = 4; + CommID CommID = 1; + string ReqMsg = 2; +} +message AddFriendResp{ + CommonResp CommonResp = 1; } message ImportFriendReq{ - repeated string uidList = 1; + repeated string FriendUserIDList = 1; string OperationID = 2; - string Token = 3; - string OwnerUid = 4; + string FromUserID = 3; + string OpUserID = 4; +} +message UserIDResult{ + string UserID = 1; + int32 Result = 2; } message ImportFriendResp{ - CommonResp commonResp = 1; - repeated string failedUidList = 2; -} - -message GetFriendApplyReq{ - string OperationID = 1; - string Token = 2; -} -message GetFriendApplyResp{ - int32 errorCode = 1; - string errorMsg = 2; - repeated ApplyUserInfo data = 4; -} - -message ApplyUserInfo{ - string uid = 1; - string name = 2; - string icon = 3; - int32 gender = 4; - string mobile = 5; - string birth = 6; - string email = 7; - string ex = 8; - int32 flag = 9; - string applyTime = 10; - string reqMessage = 11; + CommonResp CommonResp = 1; + repeated UserIDResult UserIDResultList = 2; } -message getFriendListReq{ - string OperationID = 1; - string Token = 2; +message GetFriendApplyListReq{ + CommID CommID = 1; } -message getFriendListResp{ - int32 errorCode = 1; - string errorMsg = 2; - repeated UserInfo data = 3; +message GetFriendApplyListResp{ + int32 ErrCode = 1; + string ErrMsg = 2; + repeated server_api_params.FriendRequest FriendRequestList = 3; } -message UserInfo{ - string uid = 1; - string name = 3; - string icon = 2; - int32 gender = 4; - string mobile = 5; - string birth = 6; - string email = 7; - string ex = 8; - string comment = 9; - int32 isInBlackList = 10; + + +message GetFriendListReq{ + CommID CommID = 1; } +message GetFriendListResp{ + int32 ErrCode = 1; + string ErrMsg = 2; + repeated server_api_params.FriendInfo FriendInfoList = 3; +} + message AddBlacklistReq{ - string uid = 1; - string OperationID = 2; - string Token = 3; - string OwnerUid = 4; + CommID CommID = 1; +} +message AddBlacklistResp{ + CommonResp CommonResp = 1; } message RemoveBlacklistReq{ - string uid = 1; - string OperationID = 2; - string Token = 3; + CommID CommID = 1; +} +message RemoveBlacklistResp{ + CommonResp CommonResp = 1; } - message GetBlacklistReq{ - string OperationID = 1; - string token = 2; + CommID CommID = 1; } message GetBlacklistResp{ - int32 errorCode = 1; - string errorMsg = 2; - repeated UserInfo data = 3; + int32 ErrCode = 1; + string ErrMsg = 2; + repeated server_api_params.PublicUserInfo BlackUserInfoList = 3; } + message IsFriendReq{ - string token = 1; - string receiveUid = 2; - string OperationID = 3; + CommID CommID = 1; } message IsFriendResp{ - int32 errorCode = 1; - string errorMsg = 2; - int32 shipType = 3; + int32 ErrCode = 1; + string ErrMsg = 2; + bool Response = 3; } + + message IsInBlackListReq{ - string sendUid = 1; - string receiveUid = 2; - string OperationID = 3; + CommID CommID = 1; } message IsInBlackListResp{ - int32 errorCode = 1; - string errorMsg = 2; - bool response = 3; + int32 ErrCode = 1; + string ErrMsg = 2; + bool Response = 3; } + message DeleteFriendReq{ - string uid = 1; - string OperationID = 2; - string Token = 3; + CommID CommID = 1; +} +message DeleteFriendResp{ + CommonResp CommonResp = 1; } - +//process message AddFriendResponseReq{ - string uid = 1; - int32 flag = 2; - string OperationID = 3; - string Token = 4; + CommID CommID = 1; + int32 handleResult = 2; + string handleMsg = 3; +} +message AddFriendResponseResp{ + CommonResp CommonResp = 1; } -message SetFriendCommentReq{ - string uid = 1; - string operationID = 2; - string comment = 3; - string token = 4; +message SetFriendRemarkReq{ + CommID CommID = 1; + string Remark = 2; +} +message SetFriendRemarkResp{ + CommonResp CommonResp = 1; +} + +message GetSelfApplyListReq{ + CommID CommID = 1; +} +message GetSelfApplyListResp{ + int32 ErrCode = 1; + string ErrMsg = 2; + repeated server_api_params.FriendRequest FriendRequestList = 3; } service friend{ - rpc getFriendsInfo(GetFriendsInfoReq) returns(GetFriendInfoResp); - rpc addFriend(AddFriendReq) returns(CommonResp); - rpc getFriendApplyList(GetFriendApplyReq) returns(GetFriendApplyResp); - rpc getSelfApplyList(GetFriendApplyReq) returns(GetFriendApplyResp); - rpc getFriendList(getFriendListReq) returns(getFriendListResp); - rpc addBlacklist(AddBlacklistReq) returns(CommonResp); - rpc removeBlacklist(RemoveBlacklistReq) returns(CommonResp); + // rpc getFriendsInfo(GetFriendsInfoReq) returns(GetFriendInfoResp); + rpc addFriend(AddFriendReq) returns(AddFriendResp); + rpc getFriendApplyList(GetFriendApplyListReq) returns(GetFriendApplyListResp); + rpc getSelfApplyList(GetSelfApplyListReq) returns(GetSelfApplyListResp); + rpc getFriendList(GetFriendListReq) returns(GetFriendListResp); + rpc addBlacklist(AddBlacklistReq) returns(AddBlacklistResp); + rpc removeBlacklist(RemoveBlacklistReq) returns(RemoveBlacklistResp); rpc isFriend(IsFriendReq) returns(IsFriendResp); rpc isInBlackList(IsInBlackListReq) returns(IsInBlackListResp); rpc getBlacklist(GetBlacklistReq) returns(GetBlacklistResp); - rpc deleteFriend(DeleteFriendReq) returns(CommonResp); - rpc addFriendResponse(AddFriendResponseReq) returns(CommonResp); - rpc setFriendComment(SetFriendCommentReq) returns(CommonResp); - rpc ImportFriend(ImportFriendReq) returns(ImportFriendResp); + rpc deleteFriend(DeleteFriendReq) returns(DeleteFriendResp); + rpc addFriendResponse(AddFriendResponseReq) returns(AddFriendResponseResp); + rpc setFriendRemark(SetFriendRemarkReq) returns(SetFriendRemarkResp); + rpc importFriend(ImportFriendReq) returns(ImportFriendResp); } \ No newline at end of file diff --git a/pkg/proto/group/group.pb.go b/pkg/proto/group/group.pb.go index fae312019..15741944a 100644 --- a/pkg/proto/group/group.pb.go +++ b/pkg/proto/group/group.pb.go @@ -6,6 +6,7 @@ package group // import "./group" 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_group_ed07d0078ff66bfe, []int{0} + return fileDescriptor_group_a130b5186d308ee6, []int{0} } func (m *CommonResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CommonResp.Unmarshal(m, b) @@ -55,117 +56,23 @@ 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 "" -} - -type CreateGroupReq struct { - MemberList []*GroupAddMemberInfo `protobuf:"bytes,1,rep,name=memberList" json:"memberList,omitempty"` - GroupName string `protobuf:"bytes,2,opt,name=groupName" json:"groupName,omitempty"` - Introduction string `protobuf:"bytes,3,opt,name=introduction" json:"introduction,omitempty"` - Notification string `protobuf:"bytes,4,opt,name=notification" json:"notification,omitempty"` - FaceUrl string `protobuf:"bytes,5,opt,name=faceUrl" json:"faceUrl,omitempty"` - Token string `protobuf:"bytes,6,opt,name=token" json:"token,omitempty"` - OperationID string `protobuf:"bytes,7,opt,name=operationID" json:"operationID,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 *CreateGroupReq) Reset() { *m = CreateGroupReq{} } -func (m *CreateGroupReq) String() string { return proto.CompactTextString(m) } -func (*CreateGroupReq) ProtoMessage() {} -func (*CreateGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{1} -} -func (m *CreateGroupReq) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateGroupReq.Unmarshal(m, b) -} -func (m *CreateGroupReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateGroupReq.Marshal(b, m, deterministic) -} -func (dst *CreateGroupReq) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateGroupReq.Merge(dst, src) -} -func (m *CreateGroupReq) XXX_Size() int { - return xxx_messageInfo_CreateGroupReq.Size(m) -} -func (m *CreateGroupReq) XXX_DiscardUnknown() { - xxx_messageInfo_CreateGroupReq.DiscardUnknown(m) -} - -var xxx_messageInfo_CreateGroupReq proto.InternalMessageInfo - -func (m *CreateGroupReq) GetMemberList() []*GroupAddMemberInfo { - if m != nil { - return m.MemberList - } - return nil -} - -func (m *CreateGroupReq) GetGroupName() string { - if m != nil { - return m.GroupName - } - return "" -} - -func (m *CreateGroupReq) GetIntroduction() string { - if m != nil { - return m.Introduction - } - return "" -} - -func (m *CreateGroupReq) GetNotification() string { - if m != nil { - return m.Notification - } - return "" -} - -func (m *CreateGroupReq) GetFaceUrl() string { - if m != nil { - return m.FaceUrl - } - return "" -} - -func (m *CreateGroupReq) GetToken() string { - if m != nil { - return m.Token - } - return "" -} - -func (m *CreateGroupReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - -func (m *CreateGroupReq) GetEx() string { - if m != nil { - return m.Ex + return m.ErrMsg } return "" } type GroupAddMemberInfo struct { - Uid string `protobuf:"bytes,1,opt,name=uid" json:"uid,omitempty"` - SetRole int32 `protobuf:"varint,2,opt,name=setRole" json:"setRole,omitempty"` + UserID string `protobuf:"bytes,1,opt,name=UserID" json:"UserID,omitempty"` + RoleLevel int32 `protobuf:"varint,2,opt,name=RoleLevel" json:"RoleLevel,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -175,7 +82,7 @@ func (m *GroupAddMemberInfo) Reset() { *m = GroupAddMemberInfo{} } func (m *GroupAddMemberInfo) String() string { return proto.CompactTextString(m) } func (*GroupAddMemberInfo) ProtoMessage() {} func (*GroupAddMemberInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{2} + return fileDescriptor_group_a130b5186d308ee6, []int{1} } func (m *GroupAddMemberInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupAddMemberInfo.Unmarshal(m, b) @@ -195,34 +102,104 @@ func (m *GroupAddMemberInfo) XXX_DiscardUnknown() { var xxx_messageInfo_GroupAddMemberInfo proto.InternalMessageInfo -func (m *GroupAddMemberInfo) GetUid() string { +func (m *GroupAddMemberInfo) GetUserID() string { if m != nil { - return m.Uid + return m.UserID } return "" } -func (m *GroupAddMemberInfo) GetSetRole() int32 { +func (m *GroupAddMemberInfo) GetRoleLevel() int32 { if m != nil { - return m.SetRole + return m.RoleLevel } return 0 } +type CreateGroupReq struct { + InitMemberList []*GroupAddMemberInfo `protobuf:"bytes,1,rep,name=InitMemberList" json:"InitMemberList,omitempty"` + GroupInfo *sdk_ws.GroupInfo `protobuf:"bytes,2,opt,name=GroupInfo" json:"GroupInfo,omitempty"` + OperationID string `protobuf:"bytes,3,opt,name=OperationID" json:"OperationID,omitempty"` + OpUserID string `protobuf:"bytes,4,opt,name=OpUserID" json:"OpUserID,omitempty"` + OwnerUserID string `protobuf:"bytes,5,opt,name=OwnerUserID" json:"OwnerUserID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateGroupReq) Reset() { *m = CreateGroupReq{} } +func (m *CreateGroupReq) String() string { return proto.CompactTextString(m) } +func (*CreateGroupReq) ProtoMessage() {} +func (*CreateGroupReq) Descriptor() ([]byte, []int) { + return fileDescriptor_group_a130b5186d308ee6, []int{2} +} +func (m *CreateGroupReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CreateGroupReq.Unmarshal(m, b) +} +func (m *CreateGroupReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CreateGroupReq.Marshal(b, m, deterministic) +} +func (dst *CreateGroupReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateGroupReq.Merge(dst, src) +} +func (m *CreateGroupReq) XXX_Size() int { + return xxx_messageInfo_CreateGroupReq.Size(m) +} +func (m *CreateGroupReq) XXX_DiscardUnknown() { + xxx_messageInfo_CreateGroupReq.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateGroupReq proto.InternalMessageInfo + +func (m *CreateGroupReq) GetInitMemberList() []*GroupAddMemberInfo { + if m != nil { + return m.InitMemberList + } + return nil +} + +func (m *CreateGroupReq) GetGroupInfo() *sdk_ws.GroupInfo { + if m != nil { + return m.GroupInfo + } + return nil +} + +func (m *CreateGroupReq) GetOperationID() string { + if m != nil { + return m.OperationID + } + return "" +} + +func (m *CreateGroupReq) GetOpUserID() string { + if m != nil { + return m.OpUserID + } + return "" +} + +func (m *CreateGroupReq) GetOwnerUserID() string { + if m != nil { + return m.OwnerUserID + } + return "" +} + type CreateGroupResp struct { - ErrorCode int32 `protobuf:"varint,1,opt,name=ErrorCode" json:"ErrorCode,omitempty"` - ErrorMsg string `protobuf:"bytes,2,opt,name=ErrorMsg" json:"ErrorMsg,omitempty"` - GroupID string `protobuf:"bytes,3,opt,name=groupID" json:"groupID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"` + GroupInfo *sdk_ws.GroupInfo `protobuf:"bytes,3,opt,name=GroupInfo" json:"GroupInfo,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *CreateGroupResp) Reset() { *m = CreateGroupResp{} } func (m *CreateGroupResp) String() string { return proto.CompactTextString(m) } func (*CreateGroupResp) ProtoMessage() {} func (*CreateGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{3} + return fileDescriptor_group_a130b5186d308ee6, []int{3} } func (m *CreateGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateGroupResp.Unmarshal(m, b) @@ -242,31 +219,31 @@ func (m *CreateGroupResp) XXX_DiscardUnknown() { var xxx_messageInfo_CreateGroupResp proto.InternalMessageInfo -func (m *CreateGroupResp) GetErrorCode() int32 { +func (m *CreateGroupResp) GetErrCode() int32 { if m != nil { - return m.ErrorCode + return m.ErrCode } return 0 } -func (m *CreateGroupResp) GetErrorMsg() string { +func (m *CreateGroupResp) GetErrMsg() string { if m != nil { - return m.ErrorMsg + return m.ErrMsg } return "" } -func (m *CreateGroupResp) GetGroupID() string { +func (m *CreateGroupResp) GetGroupInfo() *sdk_ws.GroupInfo { if m != nil { - return m.GroupID + return m.GroupInfo } - return "" + return nil } type GetGroupsInfoReq struct { - GroupIDList []string `protobuf:"bytes,1,rep,name=groupIDList" json:"groupIDList,omitempty"` - Token string `protobuf:"bytes,2,opt,name=token" json:"token,omitempty"` - OperationID string `protobuf:"bytes,3,opt,name=operationID" json:"operationID,omitempty"` + GroupIDList []string `protobuf:"bytes,1,rep,name=GroupIDList" json:"GroupIDList,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:"-"` @@ -276,7 +253,7 @@ func (m *GetGroupsInfoReq) Reset() { *m = GetGroupsInfoReq{} } func (m *GetGroupsInfoReq) String() string { return proto.CompactTextString(m) } func (*GetGroupsInfoReq) ProtoMessage() {} func (*GetGroupsInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{4} + return fileDescriptor_group_a130b5186d308ee6, []int{4} } func (m *GetGroupsInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupsInfoReq.Unmarshal(m, b) @@ -303,13 +280,6 @@ func (m *GetGroupsInfoReq) GetGroupIDList() []string { return nil } -func (m *GetGroupsInfoReq) GetToken() string { - if m != nil { - return m.Token - } - return "" -} - func (m *GetGroupsInfoReq) GetOperationID() string { if m != nil { return m.OperationID @@ -317,20 +287,27 @@ func (m *GetGroupsInfoReq) GetOperationID() string { return "" } +func (m *GetGroupsInfoReq) GetOpUserID() string { + if m != nil { + return m.OpUserID + } + return "" +} + type GetGroupsInfoResp struct { - ErrorCode int32 `protobuf:"varint,1,opt,name=ErrorCode" json:"ErrorCode,omitempty"` - ErrorMsg string `protobuf:"bytes,2,opt,name=ErrorMsg" json:"ErrorMsg,omitempty"` - Data []*GroupInfo `protobuf:"bytes,3,rep,name=data" json:"data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"` + GroupInfoList []*sdk_ws.GroupInfo `protobuf:"bytes,3,rep,name=GroupInfoList" json:"GroupInfoList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetGroupsInfoResp) Reset() { *m = GetGroupsInfoResp{} } func (m *GetGroupsInfoResp) String() string { return proto.CompactTextString(m) } func (*GetGroupsInfoResp) ProtoMessage() {} func (*GetGroupsInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{5} + return fileDescriptor_group_a130b5186d308ee6, []int{5} } func (m *GetGroupsInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupsInfoResp.Unmarshal(m, b) @@ -350,45 +327,41 @@ func (m *GetGroupsInfoResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetGroupsInfoResp proto.InternalMessageInfo -func (m *GetGroupsInfoResp) GetErrorCode() int32 { +func (m *GetGroupsInfoResp) GetErrCode() int32 { if m != nil { - return m.ErrorCode + return m.ErrCode } return 0 } -func (m *GetGroupsInfoResp) GetErrorMsg() string { +func (m *GetGroupsInfoResp) GetErrMsg() string { if m != nil { - return m.ErrorMsg + return m.ErrMsg } return "" } -func (m *GetGroupsInfoResp) GetData() []*GroupInfo { +func (m *GetGroupsInfoResp) GetGroupInfoList() []*sdk_ws.GroupInfo { if m != nil { - return m.Data + return m.GroupInfoList } return nil } type SetGroupInfoReq struct { - GroupID string `protobuf:"bytes,1,opt,name=groupID" json:"groupID,omitempty"` - GroupName string `protobuf:"bytes,2,opt,name=groupName" json:"groupName,omitempty"` - Notification string `protobuf:"bytes,3,opt,name=notification" json:"notification,omitempty"` - Introduction string `protobuf:"bytes,4,opt,name=introduction" json:"introduction,omitempty"` - FaceUrl string `protobuf:"bytes,5,opt,name=faceUrl" json:"faceUrl,omitempty"` - Token string `protobuf:"bytes,6,opt,name=token" json:"token,omitempty"` - OperationID string `protobuf:"bytes,7,opt,name=operationID" json:"operationID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + GroupInfo *sdk_ws.GroupInfo `protobuf:"bytes,1,opt,name=GroupInfo" json:"GroupInfo,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 *SetGroupInfoReq) Reset() { *m = SetGroupInfoReq{} } func (m *SetGroupInfoReq) String() string { return proto.CompactTextString(m) } func (*SetGroupInfoReq) ProtoMessage() {} func (*SetGroupInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{6} + return fileDescriptor_group_a130b5186d308ee6, []int{6} } func (m *SetGroupInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetGroupInfoReq.Unmarshal(m, b) @@ -408,44 +381,16 @@ func (m *SetGroupInfoReq) XXX_DiscardUnknown() { var xxx_messageInfo_SetGroupInfoReq proto.InternalMessageInfo -func (m *SetGroupInfoReq) GetGroupID() string { +func (m *SetGroupInfoReq) GetGroupInfo() *sdk_ws.GroupInfo { if m != nil { - return m.GroupID + return m.GroupInfo } - return "" + return nil } -func (m *SetGroupInfoReq) GetGroupName() string { +func (m *SetGroupInfoReq) GetOpUserID() string { if m != nil { - return m.GroupName - } - return "" -} - -func (m *SetGroupInfoReq) GetNotification() string { - if m != nil { - return m.Notification - } - return "" -} - -func (m *SetGroupInfoReq) GetIntroduction() string { - if m != nil { - return m.Introduction - } - return "" -} - -func (m *SetGroupInfoReq) GetFaceUrl() string { - if m != nil { - return m.FaceUrl - } - return "" -} - -func (m *SetGroupInfoReq) GetToken() string { - if m != nil { - return m.Token + return m.OpUserID } return "" } @@ -457,9 +402,48 @@ func (m *SetGroupInfoReq) GetOperationID() string { return "" } +type SetGroupInfoResp 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 *SetGroupInfoResp) Reset() { *m = SetGroupInfoResp{} } +func (m *SetGroupInfoResp) String() string { return proto.CompactTextString(m) } +func (*SetGroupInfoResp) ProtoMessage() {} +func (*SetGroupInfoResp) Descriptor() ([]byte, []int) { + return fileDescriptor_group_a130b5186d308ee6, []int{7} +} +func (m *SetGroupInfoResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SetGroupInfoResp.Unmarshal(m, b) +} +func (m *SetGroupInfoResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SetGroupInfoResp.Marshal(b, m, deterministic) +} +func (dst *SetGroupInfoResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetGroupInfoResp.Merge(dst, src) +} +func (m *SetGroupInfoResp) XXX_Size() int { + return xxx_messageInfo_SetGroupInfoResp.Size(m) +} +func (m *SetGroupInfoResp) XXX_DiscardUnknown() { + xxx_messageInfo_SetGroupInfoResp.DiscardUnknown(m) +} + +var xxx_messageInfo_SetGroupInfoResp proto.InternalMessageInfo + +func (m *SetGroupInfoResp) GetCommonResp() *CommonResp { + if m != nil { + return m.CommonResp + } + return nil +} + type GetGroupApplicationListReq struct { - UID string `protobuf:"bytes,1,opt,name=UID" json:"UID,omitempty"` + OpUserID string `protobuf:"bytes,1,opt,name=OpUserID" json:"OpUserID,omitempty"` OperationID string `protobuf:"bytes,2,opt,name=OperationID" json:"OperationID,omitempty"` + FromUserID string `protobuf:"bytes,3,opt,name=FromUserID" json:"FromUserID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -469,7 +453,7 @@ func (m *GetGroupApplicationListReq) Reset() { *m = GetGroupApplicationL func (m *GetGroupApplicationListReq) String() string { return proto.CompactTextString(m) } func (*GetGroupApplicationListReq) ProtoMessage() {} func (*GetGroupApplicationListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{7} + return fileDescriptor_group_a130b5186d308ee6, []int{8} } func (m *GetGroupApplicationListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupApplicationListReq.Unmarshal(m, b) @@ -489,9 +473,9 @@ func (m *GetGroupApplicationListReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetGroupApplicationListReq proto.InternalMessageInfo -func (m *GetGroupApplicationListReq) GetUID() string { +func (m *GetGroupApplicationListReq) GetOpUserID() string { if m != nil { - return m.UID + return m.OpUserID } return "" } @@ -503,224 +487,27 @@ func (m *GetGroupApplicationListReq) GetOperationID() string { return "" } -type GetGroupApplicationList_Data_User struct { - ID string `protobuf:"bytes,1,opt,name=ID" json:"ID,omitempty"` - GroupID string `protobuf:"bytes,2,opt,name=GroupID" json:"GroupID,omitempty"` - FromUserID string `protobuf:"bytes,3,opt,name=FromUserID" json:"FromUserID,omitempty"` - ToUserID string `protobuf:"bytes,4,opt,name=ToUserID" json:"ToUserID,omitempty"` - Flag int32 `protobuf:"varint,5,opt,name=Flag" json:"Flag,omitempty"` - RequestMsg string `protobuf:"bytes,6,opt,name=RequestMsg" json:"RequestMsg,omitempty"` - HandledMsg string `protobuf:"bytes,7,opt,name=HandledMsg" json:"HandledMsg,omitempty"` - AddTime int64 `protobuf:"varint,8,opt,name=AddTime" json:"AddTime,omitempty"` - FromUserNickname string `protobuf:"bytes,9,opt,name=FromUserNickname" json:"FromUserNickname,omitempty"` - ToUserNickname string `protobuf:"bytes,10,opt,name=ToUserNickname" json:"ToUserNickname,omitempty"` - FromUserFaceUrl string `protobuf:"bytes,11,opt,name=FromUserFaceUrl" json:"FromUserFaceUrl,omitempty"` - ToUserFaceUrl string `protobuf:"bytes,12,opt,name=ToUserFaceUrl" json:"ToUserFaceUrl,omitempty"` - HandledUser string `protobuf:"bytes,13,opt,name=HandledUser" json:"HandledUser,omitempty"` - Type int32 `protobuf:"varint,14,opt,name=Type" json:"Type,omitempty"` - HandleStatus int32 `protobuf:"varint,15,opt,name=HandleStatus" json:"HandleStatus,omitempty"` - HandleResult int32 `protobuf:"varint,16,opt,name=HandleResult" json:"HandleResult,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetGroupApplicationList_Data_User) Reset() { *m = GetGroupApplicationList_Data_User{} } -func (m *GetGroupApplicationList_Data_User) String() string { return proto.CompactTextString(m) } -func (*GetGroupApplicationList_Data_User) ProtoMessage() {} -func (*GetGroupApplicationList_Data_User) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{8} -} -func (m *GetGroupApplicationList_Data_User) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetGroupApplicationList_Data_User.Unmarshal(m, b) -} -func (m *GetGroupApplicationList_Data_User) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetGroupApplicationList_Data_User.Marshal(b, m, deterministic) -} -func (dst *GetGroupApplicationList_Data_User) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetGroupApplicationList_Data_User.Merge(dst, src) -} -func (m *GetGroupApplicationList_Data_User) XXX_Size() int { - return xxx_messageInfo_GetGroupApplicationList_Data_User.Size(m) -} -func (m *GetGroupApplicationList_Data_User) XXX_DiscardUnknown() { - xxx_messageInfo_GetGroupApplicationList_Data_User.DiscardUnknown(m) -} - -var xxx_messageInfo_GetGroupApplicationList_Data_User proto.InternalMessageInfo - -func (m *GetGroupApplicationList_Data_User) GetID() string { - if m != nil { - return m.ID - } - return "" -} - -func (m *GetGroupApplicationList_Data_User) GetGroupID() string { - if m != nil { - return m.GroupID - } - return "" -} - -func (m *GetGroupApplicationList_Data_User) GetFromUserID() string { +func (m *GetGroupApplicationListReq) GetFromUserID() string { if m != nil { return m.FromUserID } return "" } -func (m *GetGroupApplicationList_Data_User) GetToUserID() string { - if m != nil { - return m.ToUserID - } - return "" -} - -func (m *GetGroupApplicationList_Data_User) GetFlag() int32 { - if m != nil { - return m.Flag - } - return 0 -} - -func (m *GetGroupApplicationList_Data_User) GetRequestMsg() string { - if m != nil { - return m.RequestMsg - } - return "" -} - -func (m *GetGroupApplicationList_Data_User) GetHandledMsg() string { - if m != nil { - return m.HandledMsg - } - return "" -} - -func (m *GetGroupApplicationList_Data_User) GetAddTime() int64 { - if m != nil { - return m.AddTime - } - return 0 -} - -func (m *GetGroupApplicationList_Data_User) GetFromUserNickname() string { - if m != nil { - return m.FromUserNickname - } - return "" -} - -func (m *GetGroupApplicationList_Data_User) GetToUserNickname() string { - if m != nil { - return m.ToUserNickname - } - return "" -} - -func (m *GetGroupApplicationList_Data_User) GetFromUserFaceUrl() string { - if m != nil { - return m.FromUserFaceUrl - } - return "" -} - -func (m *GetGroupApplicationList_Data_User) GetToUserFaceUrl() string { - if m != nil { - return m.ToUserFaceUrl - } - return "" -} - -func (m *GetGroupApplicationList_Data_User) GetHandledUser() string { - if m != nil { - return m.HandledUser - } - return "" -} - -func (m *GetGroupApplicationList_Data_User) GetType() int32 { - if m != nil { - return m.Type - } - return 0 -} - -func (m *GetGroupApplicationList_Data_User) GetHandleStatus() int32 { - if m != nil { - return m.HandleStatus - } - return 0 -} - -func (m *GetGroupApplicationList_Data_User) GetHandleResult() int32 { - if m != nil { - return m.HandleResult - } - return 0 -} - -type GetGroupApplicationListData struct { - Count int32 `protobuf:"varint,1,opt,name=Count" json:"Count,omitempty"` - User []*GetGroupApplicationList_Data_User `protobuf:"bytes,2,rep,name=User" json:"User,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetGroupApplicationListData) Reset() { *m = GetGroupApplicationListData{} } -func (m *GetGroupApplicationListData) String() string { return proto.CompactTextString(m) } -func (*GetGroupApplicationListData) ProtoMessage() {} -func (*GetGroupApplicationListData) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{9} -} -func (m *GetGroupApplicationListData) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetGroupApplicationListData.Unmarshal(m, b) -} -func (m *GetGroupApplicationListData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetGroupApplicationListData.Marshal(b, m, deterministic) -} -func (dst *GetGroupApplicationListData) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetGroupApplicationListData.Merge(dst, src) -} -func (m *GetGroupApplicationListData) XXX_Size() int { - return xxx_messageInfo_GetGroupApplicationListData.Size(m) -} -func (m *GetGroupApplicationListData) XXX_DiscardUnknown() { - xxx_messageInfo_GetGroupApplicationListData.DiscardUnknown(m) -} - -var xxx_messageInfo_GetGroupApplicationListData proto.InternalMessageInfo - -func (m *GetGroupApplicationListData) GetCount() int32 { - if m != nil { - return m.Count - } - return 0 -} - -func (m *GetGroupApplicationListData) GetUser() []*GetGroupApplicationList_Data_User { - if m != nil { - return m.User - } - return nil -} - type GetGroupApplicationListResp struct { - ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"` - ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"` - Data *GetGroupApplicationListData `protobuf:"bytes,3,opt,name=Data" json:"Data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"` + GroupRequestList []*sdk_ws.GroupRequest `protobuf:"bytes,3,rep,name=GroupRequestList" json:"GroupRequestList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetGroupApplicationListResp) Reset() { *m = GetGroupApplicationListResp{} } func (m *GetGroupApplicationListResp) String() string { return proto.CompactTextString(m) } func (*GetGroupApplicationListResp) ProtoMessage() {} func (*GetGroupApplicationListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{10} + return fileDescriptor_group_a130b5186d308ee6, []int{9} } func (m *GetGroupApplicationListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupApplicationListResp.Unmarshal(m, b) @@ -754,18 +541,19 @@ func (m *GetGroupApplicationListResp) GetErrMsg() string { return "" } -func (m *GetGroupApplicationListResp) GetData() *GetGroupApplicationListData { +func (m *GetGroupApplicationListResp) GetGroupRequestList() []*sdk_ws.GroupRequest { if m != nil { - return m.Data + return m.GroupRequestList } return nil } type TransferGroupOwnerReq struct { GroupID string `protobuf:"bytes,1,opt,name=GroupID" json:"GroupID,omitempty"` - OldOwner string `protobuf:"bytes,2,opt,name=OldOwner" json:"OldOwner,omitempty"` - NewOwner string `protobuf:"bytes,3,opt,name=NewOwner" json:"NewOwner,omitempty"` + OldOwnerUserID string `protobuf:"bytes,2,opt,name=OldOwnerUserID" json:"OldOwnerUserID,omitempty"` + NewOwnerUserID string `protobuf:"bytes,3,opt,name=NewOwnerUserID" json:"NewOwnerUserID,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:"-"` @@ -775,7 +563,7 @@ func (m *TransferGroupOwnerReq) Reset() { *m = TransferGroupOwnerReq{} } func (m *TransferGroupOwnerReq) String() string { return proto.CompactTextString(m) } func (*TransferGroupOwnerReq) ProtoMessage() {} func (*TransferGroupOwnerReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{11} + return fileDescriptor_group_a130b5186d308ee6, []int{10} } func (m *TransferGroupOwnerReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_TransferGroupOwnerReq.Unmarshal(m, b) @@ -802,16 +590,16 @@ func (m *TransferGroupOwnerReq) GetGroupID() string { return "" } -func (m *TransferGroupOwnerReq) GetOldOwner() string { +func (m *TransferGroupOwnerReq) GetOldOwnerUserID() string { if m != nil { - return m.OldOwner + return m.OldOwnerUserID } return "" } -func (m *TransferGroupOwnerReq) GetNewOwner() string { +func (m *TransferGroupOwnerReq) GetNewOwnerUserID() string { if m != nil { - return m.NewOwner + return m.NewOwnerUserID } return "" } @@ -823,19 +611,25 @@ func (m *TransferGroupOwnerReq) GetOperationID() string { return "" } +func (m *TransferGroupOwnerReq) GetOpUserID() string { + if m != nil { + return m.OpUserID + } + return "" +} + type TransferGroupOwnerResp 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:"-"` + 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 *TransferGroupOwnerResp) Reset() { *m = TransferGroupOwnerResp{} } func (m *TransferGroupOwnerResp) String() string { return proto.CompactTextString(m) } func (*TransferGroupOwnerResp) ProtoMessage() {} func (*TransferGroupOwnerResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{12} + return fileDescriptor_group_a130b5186d308ee6, []int{11} } func (m *TransferGroupOwnerResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_TransferGroupOwnerResp.Unmarshal(m, b) @@ -855,24 +649,17 @@ func (m *TransferGroupOwnerResp) XXX_DiscardUnknown() { var xxx_messageInfo_TransferGroupOwnerResp proto.InternalMessageInfo -func (m *TransferGroupOwnerResp) GetErrCode() int32 { +func (m *TransferGroupOwnerResp) GetCommonResp() *CommonResp { if m != nil { - return m.ErrCode + return m.CommonResp } - return 0 -} - -func (m *TransferGroupOwnerResp) GetErrMsg() string { - if m != nil { - return m.ErrMsg - } - return "" + return nil } type JoinGroupReq struct { - GroupID string `protobuf:"bytes,1,opt,name=groupID" json:"groupID,omitempty"` - Message string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"` - Token string `protobuf:"bytes,3,opt,name=token" json:"token,omitempty"` + GroupID string `protobuf:"bytes,1,opt,name=GroupID" json:"GroupID,omitempty"` + ReqMessage string `protobuf:"bytes,2,opt,name=ReqMessage" json:"ReqMessage,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:"-"` @@ -883,7 +670,7 @@ func (m *JoinGroupReq) Reset() { *m = JoinGroupReq{} } func (m *JoinGroupReq) String() string { return proto.CompactTextString(m) } func (*JoinGroupReq) ProtoMessage() {} func (*JoinGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{13} + return fileDescriptor_group_a130b5186d308ee6, []int{12} } func (m *JoinGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_JoinGroupReq.Unmarshal(m, b) @@ -910,16 +697,16 @@ func (m *JoinGroupReq) GetGroupID() string { return "" } -func (m *JoinGroupReq) GetMessage() string { +func (m *JoinGroupReq) GetReqMessage() string { if m != nil { - return m.Message + return m.ReqMessage } return "" } -func (m *JoinGroupReq) GetToken() string { +func (m *JoinGroupReq) GetOpUserID() string { if m != nil { - return m.Token + return m.OpUserID } return "" } @@ -931,22 +718,51 @@ func (m *JoinGroupReq) GetOperationID() string { return "" } +type JoinGroupResp 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 *JoinGroupResp) Reset() { *m = JoinGroupResp{} } +func (m *JoinGroupResp) String() string { return proto.CompactTextString(m) } +func (*JoinGroupResp) ProtoMessage() {} +func (*JoinGroupResp) Descriptor() ([]byte, []int) { + return fileDescriptor_group_a130b5186d308ee6, []int{13} +} +func (m *JoinGroupResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_JoinGroupResp.Unmarshal(m, b) +} +func (m *JoinGroupResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_JoinGroupResp.Marshal(b, m, deterministic) +} +func (dst *JoinGroupResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_JoinGroupResp.Merge(dst, src) +} +func (m *JoinGroupResp) XXX_Size() int { + return xxx_messageInfo_JoinGroupResp.Size(m) +} +func (m *JoinGroupResp) XXX_DiscardUnknown() { + xxx_messageInfo_JoinGroupResp.DiscardUnknown(m) +} + +var xxx_messageInfo_JoinGroupResp proto.InternalMessageInfo + +func (m *JoinGroupResp) GetCommonResp() *CommonResp { + if m != nil { + return m.CommonResp + } + return nil +} + type GroupApplicationResponseReq struct { OperationID string `protobuf:"bytes,1,opt,name=OperationID" json:"OperationID,omitempty"` - OwnerID string `protobuf:"bytes,2,opt,name=OwnerID" json:"OwnerID,omitempty"` + OpUserID string `protobuf:"bytes,2,opt,name=OpUserID" json:"OpUserID,omitempty"` GroupID string `protobuf:"bytes,3,opt,name=GroupID" json:"GroupID,omitempty"` FromUserID string `protobuf:"bytes,4,opt,name=FromUserID" json:"FromUserID,omitempty"` - FromUserNickName string `protobuf:"bytes,5,opt,name=FromUserNickName" json:"FromUserNickName,omitempty"` - FromUserFaceUrl string `protobuf:"bytes,6,opt,name=FromUserFaceUrl" json:"FromUserFaceUrl,omitempty"` - ToUserID string `protobuf:"bytes,7,opt,name=ToUserID" json:"ToUserID,omitempty"` - ToUserNickName string `protobuf:"bytes,8,opt,name=ToUserNickName" json:"ToUserNickName,omitempty"` - ToUserFaceUrl string `protobuf:"bytes,9,opt,name=ToUserFaceUrl" json:"ToUserFaceUrl,omitempty"` - AddTime int64 `protobuf:"varint,10,opt,name=AddTime" json:"AddTime,omitempty"` - RequestMsg string `protobuf:"bytes,11,opt,name=RequestMsg" json:"RequestMsg,omitempty"` - HandledMsg string `protobuf:"bytes,12,opt,name=HandledMsg" json:"HandledMsg,omitempty"` - Type int32 `protobuf:"varint,13,opt,name=Type" json:"Type,omitempty"` - HandleStatus int32 `protobuf:"varint,14,opt,name=HandleStatus" json:"HandleStatus,omitempty"` - HandleResult int32 `protobuf:"varint,15,opt,name=HandleResult" json:"HandleResult,omitempty"` + HandledMsg string `protobuf:"bytes,5,opt,name=HandledMsg" json:"HandledMsg,omitempty"` + HandleResult int32 `protobuf:"varint,6,opt,name=HandleResult" json:"HandleResult,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -956,7 +772,7 @@ func (m *GroupApplicationResponseReq) Reset() { *m = GroupApplicationRes func (m *GroupApplicationResponseReq) String() string { return proto.CompactTextString(m) } func (*GroupApplicationResponseReq) ProtoMessage() {} func (*GroupApplicationResponseReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{14} + return fileDescriptor_group_a130b5186d308ee6, []int{14} } func (m *GroupApplicationResponseReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupApplicationResponseReq.Unmarshal(m, b) @@ -983,9 +799,9 @@ func (m *GroupApplicationResponseReq) GetOperationID() string { return "" } -func (m *GroupApplicationResponseReq) GetOwnerID() string { +func (m *GroupApplicationResponseReq) GetOpUserID() string { if m != nil { - return m.OwnerID + return m.OpUserID } return "" } @@ -1004,55 +820,6 @@ func (m *GroupApplicationResponseReq) GetFromUserID() string { return "" } -func (m *GroupApplicationResponseReq) GetFromUserNickName() string { - if m != nil { - return m.FromUserNickName - } - return "" -} - -func (m *GroupApplicationResponseReq) GetFromUserFaceUrl() string { - if m != nil { - return m.FromUserFaceUrl - } - return "" -} - -func (m *GroupApplicationResponseReq) GetToUserID() string { - if m != nil { - return m.ToUserID - } - return "" -} - -func (m *GroupApplicationResponseReq) GetToUserNickName() string { - if m != nil { - return m.ToUserNickName - } - return "" -} - -func (m *GroupApplicationResponseReq) GetToUserFaceUrl() string { - if m != nil { - return m.ToUserFaceUrl - } - return "" -} - -func (m *GroupApplicationResponseReq) GetAddTime() int64 { - if m != nil { - return m.AddTime - } - return 0 -} - -func (m *GroupApplicationResponseReq) GetRequestMsg() string { - if m != nil { - return m.RequestMsg - } - return "" -} - func (m *GroupApplicationResponseReq) GetHandledMsg() string { if m != nil { return m.HandledMsg @@ -1060,20 +827,6 @@ func (m *GroupApplicationResponseReq) GetHandledMsg() string { return "" } -func (m *GroupApplicationResponseReq) GetType() int32 { - if m != nil { - return m.Type - } - return 0 -} - -func (m *GroupApplicationResponseReq) GetHandleStatus() int32 { - if m != nil { - return m.HandleStatus - } - return 0 -} - func (m *GroupApplicationResponseReq) GetHandleResult() int32 { if m != nil { return m.HandleResult @@ -1082,18 +835,17 @@ func (m *GroupApplicationResponseReq) GetHandleResult() int32 { } type GroupApplicationResponseResp 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:"-"` + 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 *GroupApplicationResponseResp) Reset() { *m = GroupApplicationResponseResp{} } func (m *GroupApplicationResponseResp) String() string { return proto.CompactTextString(m) } func (*GroupApplicationResponseResp) ProtoMessage() {} func (*GroupApplicationResponseResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{15} + return fileDescriptor_group_a130b5186d308ee6, []int{15} } func (m *GroupApplicationResponseResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupApplicationResponseResp.Unmarshal(m, b) @@ -1113,86 +865,17 @@ func (m *GroupApplicationResponseResp) XXX_DiscardUnknown() { var xxx_messageInfo_GroupApplicationResponseResp proto.InternalMessageInfo -func (m *GroupApplicationResponseResp) GetErrCode() int32 { +func (m *GroupApplicationResponseResp) GetCommonResp() *CommonResp { if m != nil { - return m.ErrCode + return m.CommonResp } - return 0 -} - -func (m *GroupApplicationResponseResp) GetErrMsg() string { - if m != nil { - return m.ErrMsg - } - return "" -} - -type SetOwnerGroupNickNameReq struct { - GroupID string `protobuf:"bytes,1,opt,name=groupID" json:"groupID,omitempty"` - NickName string `protobuf:"bytes,2,opt,name=nickName" json:"nickName,omitempty"` - OperationID string `protobuf:"bytes,3,opt,name=OperationID" json:"OperationID,omitempty"` - Token string `protobuf:"bytes,4,opt,name=token" json:"token,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SetOwnerGroupNickNameReq) Reset() { *m = SetOwnerGroupNickNameReq{} } -func (m *SetOwnerGroupNickNameReq) String() string { return proto.CompactTextString(m) } -func (*SetOwnerGroupNickNameReq) ProtoMessage() {} -func (*SetOwnerGroupNickNameReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{16} -} -func (m *SetOwnerGroupNickNameReq) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SetOwnerGroupNickNameReq.Unmarshal(m, b) -} -func (m *SetOwnerGroupNickNameReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SetOwnerGroupNickNameReq.Marshal(b, m, deterministic) -} -func (dst *SetOwnerGroupNickNameReq) XXX_Merge(src proto.Message) { - xxx_messageInfo_SetOwnerGroupNickNameReq.Merge(dst, src) -} -func (m *SetOwnerGroupNickNameReq) XXX_Size() int { - return xxx_messageInfo_SetOwnerGroupNickNameReq.Size(m) -} -func (m *SetOwnerGroupNickNameReq) XXX_DiscardUnknown() { - xxx_messageInfo_SetOwnerGroupNickNameReq.DiscardUnknown(m) -} - -var xxx_messageInfo_SetOwnerGroupNickNameReq proto.InternalMessageInfo - -func (m *SetOwnerGroupNickNameReq) GetGroupID() string { - if m != nil { - return m.GroupID - } - return "" -} - -func (m *SetOwnerGroupNickNameReq) GetNickName() string { - if m != nil { - return m.NickName - } - return "" -} - -func (m *SetOwnerGroupNickNameReq) GetOperationID() string { - if m != nil { - return m.OperationID - } - return "" -} - -func (m *SetOwnerGroupNickNameReq) GetToken() string { - if m != nil { - return m.Token - } - return "" + return nil } type QuitGroupReq struct { - GroupID string `protobuf:"bytes,1,opt,name=groupID" json:"groupID,omitempty"` - OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` - Token string `protobuf:"bytes,3,opt,name=token" json:"token,omitempty"` + GroupID string `protobuf:"bytes,1,opt,name=GroupID" json:"GroupID,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:"-"` @@ -1202,7 +885,7 @@ func (m *QuitGroupReq) Reset() { *m = QuitGroupReq{} } func (m *QuitGroupReq) String() string { return proto.CompactTextString(m) } func (*QuitGroupReq) ProtoMessage() {} func (*QuitGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{17} + return fileDescriptor_group_a130b5186d308ee6, []int{16} } func (m *QuitGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_QuitGroupReq.Unmarshal(m, b) @@ -1236,191 +919,57 @@ func (m *QuitGroupReq) GetOperationID() string { return "" } -func (m *QuitGroupReq) GetToken() string { +func (m *QuitGroupReq) GetOpUserID() string { if m != nil { - return m.Token + return m.OpUserID } return "" } -type GroupApplicationUserInfo struct { - GroupID string `protobuf:"bytes,1,opt,name=groupID" json:"groupID,omitempty"` - Uid string `protobuf:"bytes,2,opt,name=uid" json:"uid,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"` - Icon string `protobuf:"bytes,4,opt,name=icon" json:"icon,omitempty"` - ReqMsg string `protobuf:"bytes,5,opt,name=reqMsg" json:"reqMsg,omitempty"` - ApplicationTime int64 `protobuf:"varint,6,opt,name=applicationTime" json:"applicationTime,omitempty"` - Flag int32 `protobuf:"varint,7,opt,name=flag" json:"flag,omitempty"` - OperatorID string `protobuf:"bytes,8,opt,name=operatorID" json:"operatorID,omitempty"` - HandledMsg string `protobuf:"bytes,9,opt,name=handledMsg" json:"handledMsg,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +type QuitGroupResp 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 *GroupApplicationUserInfo) Reset() { *m = GroupApplicationUserInfo{} } -func (m *GroupApplicationUserInfo) String() string { return proto.CompactTextString(m) } -func (*GroupApplicationUserInfo) ProtoMessage() {} -func (*GroupApplicationUserInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{18} +func (m *QuitGroupResp) Reset() { *m = QuitGroupResp{} } +func (m *QuitGroupResp) String() string { return proto.CompactTextString(m) } +func (*QuitGroupResp) ProtoMessage() {} +func (*QuitGroupResp) Descriptor() ([]byte, []int) { + return fileDescriptor_group_a130b5186d308ee6, []int{17} } -func (m *GroupApplicationUserInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GroupApplicationUserInfo.Unmarshal(m, b) +func (m *QuitGroupResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_QuitGroupResp.Unmarshal(m, b) } -func (m *GroupApplicationUserInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GroupApplicationUserInfo.Marshal(b, m, deterministic) +func (m *QuitGroupResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_QuitGroupResp.Marshal(b, m, deterministic) } -func (dst *GroupApplicationUserInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_GroupApplicationUserInfo.Merge(dst, src) +func (dst *QuitGroupResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuitGroupResp.Merge(dst, src) } -func (m *GroupApplicationUserInfo) XXX_Size() int { - return xxx_messageInfo_GroupApplicationUserInfo.Size(m) +func (m *QuitGroupResp) XXX_Size() int { + return xxx_messageInfo_QuitGroupResp.Size(m) } -func (m *GroupApplicationUserInfo) XXX_DiscardUnknown() { - xxx_messageInfo_GroupApplicationUserInfo.DiscardUnknown(m) +func (m *QuitGroupResp) XXX_DiscardUnknown() { + xxx_messageInfo_QuitGroupResp.DiscardUnknown(m) } -var xxx_messageInfo_GroupApplicationUserInfo proto.InternalMessageInfo +var xxx_messageInfo_QuitGroupResp proto.InternalMessageInfo -func (m *GroupApplicationUserInfo) GetGroupID() string { +func (m *QuitGroupResp) GetCommonResp() *CommonResp { if m != nil { - return m.GroupID + return m.CommonResp } - return "" -} - -func (m *GroupApplicationUserInfo) GetUid() string { - if m != nil { - return m.Uid - } - return "" -} - -func (m *GroupApplicationUserInfo) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *GroupApplicationUserInfo) GetIcon() string { - if m != nil { - return m.Icon - } - return "" -} - -func (m *GroupApplicationUserInfo) GetReqMsg() string { - if m != nil { - return m.ReqMsg - } - return "" -} - -func (m *GroupApplicationUserInfo) GetApplicationTime() int64 { - if m != nil { - return m.ApplicationTime - } - return 0 -} - -func (m *GroupApplicationUserInfo) GetFlag() int32 { - if m != nil { - return m.Flag - } - return 0 -} - -func (m *GroupApplicationUserInfo) GetOperatorID() string { - if m != nil { - return m.OperatorID - } - return "" -} - -func (m *GroupApplicationUserInfo) GetHandledMsg() string { - if m != nil { - return m.HandledMsg - } - return "" -} - -type GroupMemberFullInfo struct { - UserId string `protobuf:"bytes,1,opt,name=userId" json:"userId,omitempty"` - Role int32 `protobuf:"varint,2,opt,name=role" json:"role,omitempty"` - JoinTime uint64 `protobuf:"varint,3,opt,name=joinTime" json:"joinTime,omitempty"` - NickName string `protobuf:"bytes,4,opt,name=nickName" json:"nickName,omitempty"` - FaceUrl string `protobuf:"bytes,5,opt,name=faceUrl" json:"faceUrl,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GroupMemberFullInfo) Reset() { *m = GroupMemberFullInfo{} } -func (m *GroupMemberFullInfo) String() string { return proto.CompactTextString(m) } -func (*GroupMemberFullInfo) ProtoMessage() {} -func (*GroupMemberFullInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{19} -} -func (m *GroupMemberFullInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GroupMemberFullInfo.Unmarshal(m, b) -} -func (m *GroupMemberFullInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GroupMemberFullInfo.Marshal(b, m, deterministic) -} -func (dst *GroupMemberFullInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_GroupMemberFullInfo.Merge(dst, src) -} -func (m *GroupMemberFullInfo) XXX_Size() int { - return xxx_messageInfo_GroupMemberFullInfo.Size(m) -} -func (m *GroupMemberFullInfo) XXX_DiscardUnknown() { - xxx_messageInfo_GroupMemberFullInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_GroupMemberFullInfo proto.InternalMessageInfo - -func (m *GroupMemberFullInfo) GetUserId() string { - if m != nil { - return m.UserId - } - return "" -} - -func (m *GroupMemberFullInfo) GetRole() int32 { - if m != nil { - return m.Role - } - return 0 -} - -func (m *GroupMemberFullInfo) GetJoinTime() uint64 { - if m != nil { - return m.JoinTime - } - return 0 -} - -func (m *GroupMemberFullInfo) GetNickName() string { - if m != nil { - return m.NickName - } - return "" -} - -func (m *GroupMemberFullInfo) GetFaceUrl() string { - if m != nil { - return m.FaceUrl - } - return "" + return nil } type GetGroupMemberListReq struct { - GroupID string `protobuf:"bytes,1,opt,name=groupID" json:"groupID,omitempty"` - Token string `protobuf:"bytes,2,opt,name=token" json:"token,omitempty"` - OperationID string `protobuf:"bytes,3,opt,name=operationID" json:"operationID,omitempty"` - Filter int32 `protobuf:"varint,4,opt,name=filter" json:"filter,omitempty"` - NextSeq int32 `protobuf:"varint,5,opt,name=nextSeq" json:"nextSeq,omitempty"` + GroupID string `protobuf:"bytes,1,opt,name=GroupID" json:"GroupID,omitempty"` + OpUserID string `protobuf:"bytes,2,opt,name=OpUserID" json:"OpUserID,omitempty"` + OperationID string `protobuf:"bytes,3,opt,name=OperationID" json:"OperationID,omitempty"` + Filter int32 `protobuf:"varint,4,opt,name=Filter" json:"Filter,omitempty"` + NextSeq int32 `protobuf:"varint,5,opt,name=NextSeq" json:"NextSeq,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1430,7 +979,7 @@ func (m *GetGroupMemberListReq) Reset() { *m = GetGroupMemberListReq{} } func (m *GetGroupMemberListReq) String() string { return proto.CompactTextString(m) } func (*GetGroupMemberListReq) ProtoMessage() {} func (*GetGroupMemberListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{20} + return fileDescriptor_group_a130b5186d308ee6, []int{18} } func (m *GetGroupMemberListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMemberListReq.Unmarshal(m, b) @@ -1457,9 +1006,9 @@ func (m *GetGroupMemberListReq) GetGroupID() string { return "" } -func (m *GetGroupMemberListReq) GetToken() string { +func (m *GetGroupMemberListReq) GetOpUserID() string { if m != nil { - return m.Token + return m.OpUserID } return "" } @@ -1486,20 +1035,20 @@ func (m *GetGroupMemberListReq) GetNextSeq() int32 { } type GetGroupMemberListResp struct { - ErrorCode int32 `protobuf:"varint,1,opt,name=errorCode" json:"errorCode,omitempty"` - ErrorMsg string `protobuf:"bytes,2,opt,name=errorMsg" json:"errorMsg,omitempty"` - MemberList []*GroupMemberFullInfo `protobuf:"bytes,3,rep,name=memberList" json:"memberList,omitempty"` - NextSeq int32 `protobuf:"varint,4,opt,name=nextSeq" json:"nextSeq,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"` + MemberList []*sdk_ws.GroupMemberFullInfo `protobuf:"bytes,3,rep,name=memberList" json:"memberList,omitempty"` + NextSeq int32 `protobuf:"varint,4,opt,name=nextSeq" json:"nextSeq,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetGroupMemberListResp) Reset() { *m = GetGroupMemberListResp{} } func (m *GetGroupMemberListResp) String() string { return proto.CompactTextString(m) } func (*GetGroupMemberListResp) ProtoMessage() {} func (*GetGroupMemberListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{21} + return fileDescriptor_group_a130b5186d308ee6, []int{19} } func (m *GetGroupMemberListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMemberListResp.Unmarshal(m, b) @@ -1519,21 +1068,21 @@ func (m *GetGroupMemberListResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetGroupMemberListResp proto.InternalMessageInfo -func (m *GetGroupMemberListResp) GetErrorCode() int32 { +func (m *GetGroupMemberListResp) GetErrCode() int32 { if m != nil { - return m.ErrorCode + return m.ErrCode } return 0 } -func (m *GetGroupMemberListResp) GetErrorMsg() string { +func (m *GetGroupMemberListResp) GetErrMsg() string { if m != nil { - return m.ErrorMsg + return m.ErrMsg } return "" } -func (m *GetGroupMemberListResp) GetMemberList() []*GroupMemberFullInfo { +func (m *GetGroupMemberListResp) GetMemberList() []*sdk_ws.GroupMemberFullInfo { if m != nil { return m.MemberList } @@ -1548,10 +1097,10 @@ func (m *GetGroupMemberListResp) GetNextSeq() int32 { } type GetGroupMembersInfoReq struct { - GroupID string `protobuf:"bytes,1,opt,name=groupID" json:"groupID,omitempty"` + GroupID string `protobuf:"bytes,1,opt,name=GroupID" json:"GroupID,omitempty"` MemberList []string `protobuf:"bytes,2,rep,name=memberList" json:"memberList,omitempty"` - Token string `protobuf:"bytes,3,opt,name=token" json:"token,omitempty"` - OperationID string `protobuf:"bytes,4,opt,name=operationID" json:"operationID,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:"-"` @@ -1561,7 +1110,7 @@ func (m *GetGroupMembersInfoReq) Reset() { *m = GetGroupMembersInfoReq{} func (m *GetGroupMembersInfoReq) String() string { return proto.CompactTextString(m) } func (*GetGroupMembersInfoReq) ProtoMessage() {} func (*GetGroupMembersInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{22} + return fileDescriptor_group_a130b5186d308ee6, []int{20} } func (m *GetGroupMembersInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMembersInfoReq.Unmarshal(m, b) @@ -1595,9 +1144,9 @@ func (m *GetGroupMembersInfoReq) GetMemberList() []string { return nil } -func (m *GetGroupMembersInfoReq) GetToken() string { +func (m *GetGroupMembersInfoReq) GetOpUserID() string { if m != nil { - return m.Token + return m.OpUserID } return "" } @@ -1610,19 +1159,19 @@ func (m *GetGroupMembersInfoReq) GetOperationID() string { } type GetGroupMembersInfoResp struct { - ErrorCode int32 `protobuf:"varint,1,opt,name=errorCode" json:"errorCode,omitempty"` - ErrorMsg string `protobuf:"bytes,2,opt,name=errorMsg" json:"errorMsg,omitempty"` - MemberList []*GroupMemberFullInfo `protobuf:"bytes,3,rep,name=memberList" json:"memberList,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"` + MemberList []*sdk_ws.GroupMemberFullInfo `protobuf:"bytes,3,rep,name=memberList" json:"memberList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetGroupMembersInfoResp) Reset() { *m = GetGroupMembersInfoResp{} } func (m *GetGroupMembersInfoResp) String() string { return proto.CompactTextString(m) } func (*GetGroupMembersInfoResp) ProtoMessage() {} func (*GetGroupMembersInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{23} + return fileDescriptor_group_a130b5186d308ee6, []int{21} } func (m *GetGroupMembersInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupMembersInfoResp.Unmarshal(m, b) @@ -1642,21 +1191,21 @@ func (m *GetGroupMembersInfoResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetGroupMembersInfoResp proto.InternalMessageInfo -func (m *GetGroupMembersInfoResp) GetErrorCode() int32 { +func (m *GetGroupMembersInfoResp) GetErrCode() int32 { if m != nil { - return m.ErrorCode + return m.ErrCode } return 0 } -func (m *GetGroupMembersInfoResp) GetErrorMsg() string { +func (m *GetGroupMembersInfoResp) GetErrMsg() string { if m != nil { - return m.ErrorMsg + return m.ErrMsg } return "" } -func (m *GetGroupMembersInfoResp) GetMemberList() []*GroupMemberFullInfo { +func (m *GetGroupMembersInfoResp) GetMemberList() []*sdk_ws.GroupMemberFullInfo { if m != nil { return m.MemberList } @@ -1664,21 +1213,21 @@ func (m *GetGroupMembersInfoResp) GetMemberList() []*GroupMemberFullInfo { } type KickGroupMemberReq struct { - GroupID string `protobuf:"bytes,1,opt,name=groupID" json:"groupID,omitempty"` - UidListInfo []*GroupMemberFullInfo `protobuf:"bytes,2,rep,name=uidListInfo" json:"uidListInfo,omitempty"` - Reason string `protobuf:"bytes,3,opt,name=reason" json:"reason,omitempty"` - Token string `protobuf:"bytes,4,opt,name=token" json:"token,omitempty"` - OperationID string `protobuf:"bytes,5,opt,name=operationID" json:"operationID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + GroupID string `protobuf:"bytes,1,opt,name=GroupID" json:"GroupID,omitempty"` + KickedUserIDList []string `protobuf:"bytes,2,rep,name=KickedUserIDList" json:"KickedUserIDList,omitempty"` + Reason string `protobuf:"bytes,3,opt,name=Reason" json:"Reason,omitempty"` + OperationID string `protobuf:"bytes,5,opt,name=OperationID" json:"OperationID,omitempty"` + OpUserID string `protobuf:"bytes,6,opt,name=OpUserID" json:"OpUserID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *KickGroupMemberReq) Reset() { *m = KickGroupMemberReq{} } func (m *KickGroupMemberReq) String() string { return proto.CompactTextString(m) } func (*KickGroupMemberReq) ProtoMessage() {} func (*KickGroupMemberReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{24} + return fileDescriptor_group_a130b5186d308ee6, []int{22} } func (m *KickGroupMemberReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_KickGroupMemberReq.Unmarshal(m, b) @@ -1705,9 +1254,9 @@ func (m *KickGroupMemberReq) GetGroupID() string { return "" } -func (m *KickGroupMemberReq) GetUidListInfo() []*GroupMemberFullInfo { +func (m *KickGroupMemberReq) GetKickedUserIDList() []string { if m != nil { - return m.UidListInfo + return m.KickedUserIDList } return nil } @@ -1719,13 +1268,6 @@ func (m *KickGroupMemberReq) GetReason() string { return "" } -func (m *KickGroupMemberReq) GetToken() string { - if m != nil { - return m.Token - } - return "" -} - func (m *KickGroupMemberReq) GetOperationID() string { if m != nil { return m.OperationID @@ -1733,9 +1275,16 @@ func (m *KickGroupMemberReq) GetOperationID() string { return "" } +func (m *KickGroupMemberReq) GetOpUserID() string { + if m != nil { + return m.OpUserID + } + return "" +} + type Id2Result struct { - UId string `protobuf:"bytes,1,opt,name=uId" json:"uId,omitempty"` - Result int32 `protobuf:"varint,2,opt,name=result" json:"result,omitempty"` + UserID string `protobuf:"bytes,1,opt,name=UserID" json:"UserID,omitempty"` + Result int32 `protobuf:"varint,2,opt,name=Result" json:"Result,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1745,7 +1294,7 @@ func (m *Id2Result) Reset() { *m = Id2Result{} } func (m *Id2Result) String() string { return proto.CompactTextString(m) } func (*Id2Result) ProtoMessage() {} func (*Id2Result) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{25} + return fileDescriptor_group_a130b5186d308ee6, []int{23} } func (m *Id2Result) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Id2Result.Unmarshal(m, b) @@ -1765,9 +1314,9 @@ func (m *Id2Result) XXX_DiscardUnknown() { var xxx_messageInfo_Id2Result proto.InternalMessageInfo -func (m *Id2Result) GetUId() string { +func (m *Id2Result) GetUserID() string { if m != nil { - return m.UId + return m.UserID } return "" } @@ -1780,9 +1329,9 @@ func (m *Id2Result) GetResult() int32 { } type KickGroupMemberResp struct { - ErrorCode int32 `protobuf:"varint,1,opt,name=errorCode" json:"errorCode,omitempty"` - ErrorMsg string `protobuf:"bytes,2,opt,name=errorMsg" json:"errorMsg,omitempty"` - Id2Result []*Id2Result `protobuf:"bytes,3,rep,name=id2result" json:"id2result,omitempty"` + ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"` + Id2ResultList []*Id2Result `protobuf:"bytes,3,rep,name=Id2ResultList" json:"Id2ResultList,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1792,7 +1341,7 @@ func (m *KickGroupMemberResp) Reset() { *m = KickGroupMemberResp{} } func (m *KickGroupMemberResp) String() string { return proto.CompactTextString(m) } func (*KickGroupMemberResp) ProtoMessage() {} func (*KickGroupMemberResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{26} + return fileDescriptor_group_a130b5186d308ee6, []int{24} } func (m *KickGroupMemberResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_KickGroupMemberResp.Unmarshal(m, b) @@ -1812,30 +1361,31 @@ func (m *KickGroupMemberResp) XXX_DiscardUnknown() { var xxx_messageInfo_KickGroupMemberResp proto.InternalMessageInfo -func (m *KickGroupMemberResp) GetErrorCode() int32 { +func (m *KickGroupMemberResp) GetErrCode() int32 { if m != nil { - return m.ErrorCode + return m.ErrCode } return 0 } -func (m *KickGroupMemberResp) GetErrorMsg() string { +func (m *KickGroupMemberResp) GetErrMsg() string { if m != nil { - return m.ErrorMsg + return m.ErrMsg } return "" } -func (m *KickGroupMemberResp) GetId2Result() []*Id2Result { +func (m *KickGroupMemberResp) GetId2ResultList() []*Id2Result { if m != nil { - return m.Id2Result + return m.Id2ResultList } return nil } type GetJoinedGroupListReq struct { - Token string `protobuf:"bytes,1,opt,name=token" json:"token,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:"-"` @@ -1845,7 +1395,7 @@ func (m *GetJoinedGroupListReq) Reset() { *m = GetJoinedGroupListReq{} } func (m *GetJoinedGroupListReq) String() string { return proto.CompactTextString(m) } func (*GetJoinedGroupListReq) ProtoMessage() {} func (*GetJoinedGroupListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{27} + return fileDescriptor_group_a130b5186d308ee6, []int{25} } func (m *GetJoinedGroupListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetJoinedGroupListReq.Unmarshal(m, b) @@ -1865,9 +1415,9 @@ func (m *GetJoinedGroupListReq) XXX_DiscardUnknown() { var xxx_messageInfo_GetJoinedGroupListReq proto.InternalMessageInfo -func (m *GetJoinedGroupListReq) GetToken() string { +func (m *GetJoinedGroupListReq) GetFromUserID() string { if m != nil { - return m.Token + return m.FromUserID } return "" } @@ -1879,114 +1429,27 @@ func (m *GetJoinedGroupListReq) GetOperationID() string { return "" } -type GroupInfo struct { - GroupId string `protobuf:"bytes,1,opt,name=groupId" json:"groupId,omitempty"` - GroupName string `protobuf:"bytes,2,opt,name=groupName" json:"groupName,omitempty"` - Notification string `protobuf:"bytes,3,opt,name=notification" json:"notification,omitempty"` - Introduction string `protobuf:"bytes,4,opt,name=introduction" json:"introduction,omitempty"` - FaceUrl string `protobuf:"bytes,5,opt,name=faceUrl" json:"faceUrl,omitempty"` - CreateTime uint64 `protobuf:"varint,6,opt,name=createTime" json:"createTime,omitempty"` - OwnerId string `protobuf:"bytes,7,opt,name=ownerId" json:"ownerId,omitempty"` - MemberCount uint32 `protobuf:"varint,8,opt,name=memberCount" json:"memberCount,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GroupInfo) Reset() { *m = GroupInfo{} } -func (m *GroupInfo) String() string { return proto.CompactTextString(m) } -func (*GroupInfo) ProtoMessage() {} -func (*GroupInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{28} -} -func (m *GroupInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GroupInfo.Unmarshal(m, b) -} -func (m *GroupInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GroupInfo.Marshal(b, m, deterministic) -} -func (dst *GroupInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_GroupInfo.Merge(dst, src) -} -func (m *GroupInfo) XXX_Size() int { - return xxx_messageInfo_GroupInfo.Size(m) -} -func (m *GroupInfo) XXX_DiscardUnknown() { - xxx_messageInfo_GroupInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_GroupInfo proto.InternalMessageInfo - -func (m *GroupInfo) GetGroupId() string { +func (m *GetJoinedGroupListReq) GetOpUserID() string { if m != nil { - return m.GroupId + return m.OpUserID } return "" } -func (m *GroupInfo) GetGroupName() string { - if m != nil { - return m.GroupName - } - return "" -} - -func (m *GroupInfo) GetNotification() string { - if m != nil { - return m.Notification - } - return "" -} - -func (m *GroupInfo) GetIntroduction() string { - if m != nil { - return m.Introduction - } - return "" -} - -func (m *GroupInfo) GetFaceUrl() string { - if m != nil { - return m.FaceUrl - } - return "" -} - -func (m *GroupInfo) GetCreateTime() uint64 { - if m != nil { - return m.CreateTime - } - return 0 -} - -func (m *GroupInfo) GetOwnerId() string { - if m != nil { - return m.OwnerId - } - return "" -} - -func (m *GroupInfo) GetMemberCount() uint32 { - if m != nil { - return m.MemberCount - } - return 0 -} - type GetJoinedGroupListResp struct { - ErrorCode int32 `protobuf:"varint,1,opt,name=errorCode" json:"errorCode,omitempty"` - ErrorMsg string `protobuf:"bytes,2,opt,name=errorMsg" json:"errorMsg,omitempty"` - GroupList []*GroupInfo `protobuf:"bytes,3,rep,name=groupList" json:"groupList,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"` + GroupList []*sdk_ws.GroupInfo `protobuf:"bytes,3,rep,name=GroupList" json:"GroupList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetJoinedGroupListResp) Reset() { *m = GetJoinedGroupListResp{} } func (m *GetJoinedGroupListResp) String() string { return proto.CompactTextString(m) } func (*GetJoinedGroupListResp) ProtoMessage() {} func (*GetJoinedGroupListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{29} + return fileDescriptor_group_a130b5186d308ee6, []int{26} } func (m *GetJoinedGroupListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetJoinedGroupListResp.Unmarshal(m, b) @@ -2006,21 +1469,21 @@ func (m *GetJoinedGroupListResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetJoinedGroupListResp proto.InternalMessageInfo -func (m *GetJoinedGroupListResp) GetErrorCode() int32 { +func (m *GetJoinedGroupListResp) GetErrCode() int32 { if m != nil { - return m.ErrorCode + return m.ErrCode } return 0 } -func (m *GetJoinedGroupListResp) GetErrorMsg() string { +func (m *GetJoinedGroupListResp) GetErrMsg() string { if m != nil { - return m.ErrorMsg + return m.ErrMsg } return "" } -func (m *GetJoinedGroupListResp) GetGroupList() []*GroupInfo { +func (m *GetJoinedGroupListResp) GetGroupList() []*sdk_ws.GroupInfo { if m != nil { return m.GroupList } @@ -2028,11 +1491,11 @@ func (m *GetJoinedGroupListResp) GetGroupList() []*GroupInfo { } type InviteUserToGroupReq struct { - Token string `protobuf:"bytes,1,opt,name=token" json:"token,omitempty"` - OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` - GroupID string `protobuf:"bytes,3,opt,name=groupID" json:"groupID,omitempty"` - Reason string `protobuf:"bytes,4,opt,name=reason" json:"reason,omitempty"` - UidList []string `protobuf:"bytes,5,rep,name=uidList" json:"uidList,omitempty"` + OperationID string `protobuf:"bytes,2,opt,name=OperationID" json:"OperationID,omitempty"` + GroupID string `protobuf:"bytes,3,opt,name=GroupID" json:"GroupID,omitempty"` + Reason string `protobuf:"bytes,4,opt,name=Reason" json:"Reason,omitempty"` + InvitedUserIDList []string `protobuf:"bytes,5,rep,name=InvitedUserIDList" json:"InvitedUserIDList,omitempty"` + OpUserID string `protobuf:"bytes,6,opt,name=OpUserID" json:"OpUserID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -2042,7 +1505,7 @@ func (m *InviteUserToGroupReq) Reset() { *m = InviteUserToGroupReq{} } func (m *InviteUserToGroupReq) String() string { return proto.CompactTextString(m) } func (*InviteUserToGroupReq) ProtoMessage() {} func (*InviteUserToGroupReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{30} + return fileDescriptor_group_a130b5186d308ee6, []int{27} } func (m *InviteUserToGroupReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_InviteUserToGroupReq.Unmarshal(m, b) @@ -2062,13 +1525,6 @@ func (m *InviteUserToGroupReq) XXX_DiscardUnknown() { var xxx_messageInfo_InviteUserToGroupReq proto.InternalMessageInfo -func (m *InviteUserToGroupReq) GetToken() string { - if m != nil { - return m.Token - } - return "" -} - func (m *InviteUserToGroupReq) GetOperationID() string { if m != nil { return m.OperationID @@ -2090,17 +1546,24 @@ func (m *InviteUserToGroupReq) GetReason() string { return "" } -func (m *InviteUserToGroupReq) GetUidList() []string { +func (m *InviteUserToGroupReq) GetInvitedUserIDList() []string { if m != nil { - return m.UidList + return m.InvitedUserIDList } return nil } +func (m *InviteUserToGroupReq) GetOpUserID() string { + if m != nil { + return m.OpUserID + } + return "" +} + type InviteUserToGroupResp struct { - ErrorCode int32 `protobuf:"varint,1,opt,name=errorCode" json:"errorCode,omitempty"` - ErrorMsg string `protobuf:"bytes,2,opt,name=errorMsg" json:"errorMsg,omitempty"` - Id2Result []*Id2Result `protobuf:"bytes,3,rep,name=id2result" json:"id2result,omitempty"` + ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"` + Id2ResultList []*Id2Result `protobuf:"bytes,3,rep,name=Id2ResultList" json:"Id2ResultList,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -2110,7 +1573,7 @@ func (m *InviteUserToGroupResp) Reset() { *m = InviteUserToGroupResp{} } func (m *InviteUserToGroupResp) String() string { return proto.CompactTextString(m) } func (*InviteUserToGroupResp) ProtoMessage() {} func (*InviteUserToGroupResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{31} + return fileDescriptor_group_a130b5186d308ee6, []int{28} } func (m *InviteUserToGroupResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_InviteUserToGroupResp.Unmarshal(m, b) @@ -2130,31 +1593,31 @@ func (m *InviteUserToGroupResp) XXX_DiscardUnknown() { var xxx_messageInfo_InviteUserToGroupResp proto.InternalMessageInfo -func (m *InviteUserToGroupResp) GetErrorCode() int32 { +func (m *InviteUserToGroupResp) GetErrCode() int32 { if m != nil { - return m.ErrorCode + return m.ErrCode } return 0 } -func (m *InviteUserToGroupResp) GetErrorMsg() string { +func (m *InviteUserToGroupResp) GetErrMsg() string { if m != nil { - return m.ErrorMsg + return m.ErrMsg } return "" } -func (m *InviteUserToGroupResp) GetId2Result() []*Id2Result { +func (m *InviteUserToGroupResp) GetId2ResultList() []*Id2Result { if m != nil { - return m.Id2Result + return m.Id2ResultList } return nil } type GetGroupAllMemberReq struct { - GroupID string `protobuf:"bytes,1,opt,name=groupID" json:"groupID,omitempty"` - Token string `protobuf:"bytes,2,opt,name=token" json:"token,omitempty"` - OperationID string `protobuf:"bytes,3,opt,name=operationID" json:"operationID,omitempty"` + GroupID string `protobuf:"bytes,1,opt,name=GroupID" json:"GroupID,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:"-"` @@ -2164,7 +1627,7 @@ func (m *GetGroupAllMemberReq) Reset() { *m = GetGroupAllMemberReq{} } func (m *GetGroupAllMemberReq) String() string { return proto.CompactTextString(m) } func (*GetGroupAllMemberReq) ProtoMessage() {} func (*GetGroupAllMemberReq) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{32} + return fileDescriptor_group_a130b5186d308ee6, []int{29} } func (m *GetGroupAllMemberReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupAllMemberReq.Unmarshal(m, b) @@ -2191,9 +1654,9 @@ func (m *GetGroupAllMemberReq) GetGroupID() string { return "" } -func (m *GetGroupAllMemberReq) GetToken() string { +func (m *GetGroupAllMemberReq) GetOpUserID() string { if m != nil { - return m.Token + return m.OpUserID } return "" } @@ -2206,19 +1669,19 @@ func (m *GetGroupAllMemberReq) GetOperationID() string { } type GetGroupAllMemberResp struct { - ErrorCode int32 `protobuf:"varint,1,opt,name=errorCode" json:"errorCode,omitempty"` - ErrorMsg string `protobuf:"bytes,2,opt,name=errorMsg" json:"errorMsg,omitempty"` - MemberList []*GroupMemberFullInfo `protobuf:"bytes,3,rep,name=memberList" json:"memberList,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ErrCode int32 `protobuf:"varint,1,opt,name=ErrCode" json:"ErrCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=ErrMsg" json:"ErrMsg,omitempty"` + MemberList []*sdk_ws.GroupMemberFullInfo `protobuf:"bytes,3,rep,name=memberList" json:"memberList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetGroupAllMemberResp) Reset() { *m = GetGroupAllMemberResp{} } func (m *GetGroupAllMemberResp) String() string { return proto.CompactTextString(m) } func (*GetGroupAllMemberResp) ProtoMessage() {} func (*GetGroupAllMemberResp) Descriptor() ([]byte, []int) { - return fileDescriptor_group_ed07d0078ff66bfe, []int{33} + return fileDescriptor_group_a130b5186d308ee6, []int{30} } func (m *GetGroupAllMemberResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetGroupAllMemberResp.Unmarshal(m, b) @@ -2238,21 +1701,21 @@ func (m *GetGroupAllMemberResp) XXX_DiscardUnknown() { var xxx_messageInfo_GetGroupAllMemberResp proto.InternalMessageInfo -func (m *GetGroupAllMemberResp) GetErrorCode() int32 { +func (m *GetGroupAllMemberResp) GetErrCode() int32 { if m != nil { - return m.ErrorCode + return m.ErrCode } return 0 } -func (m *GetGroupAllMemberResp) GetErrorMsg() string { +func (m *GetGroupAllMemberResp) GetErrMsg() string { if m != nil { - return m.ErrorMsg + return m.ErrMsg } return "" } -func (m *GetGroupAllMemberResp) GetMemberList() []*GroupMemberFullInfo { +func (m *GetGroupAllMemberResp) GetMemberList() []*sdk_ws.GroupMemberFullInfo { if m != nil { return m.MemberList } @@ -2261,25 +1724,23 @@ func (m *GetGroupAllMemberResp) GetMemberList() []*GroupMemberFullInfo { func init() { proto.RegisterType((*CommonResp)(nil), "group.CommonResp") - proto.RegisterType((*CreateGroupReq)(nil), "group.CreateGroupReq") proto.RegisterType((*GroupAddMemberInfo)(nil), "group.GroupAddMemberInfo") + proto.RegisterType((*CreateGroupReq)(nil), "group.CreateGroupReq") proto.RegisterType((*CreateGroupResp)(nil), "group.CreateGroupResp") proto.RegisterType((*GetGroupsInfoReq)(nil), "group.GetGroupsInfoReq") proto.RegisterType((*GetGroupsInfoResp)(nil), "group.GetGroupsInfoResp") proto.RegisterType((*SetGroupInfoReq)(nil), "group.SetGroupInfoReq") + proto.RegisterType((*SetGroupInfoResp)(nil), "group.SetGroupInfoResp") proto.RegisterType((*GetGroupApplicationListReq)(nil), "group.GetGroupApplicationListReq") - proto.RegisterType((*GetGroupApplicationList_Data_User)(nil), "group.GetGroupApplicationList_Data_User") - proto.RegisterType((*GetGroupApplicationListData)(nil), "group.GetGroupApplicationListData") proto.RegisterType((*GetGroupApplicationListResp)(nil), "group.GetGroupApplicationListResp") proto.RegisterType((*TransferGroupOwnerReq)(nil), "group.TransferGroupOwnerReq") proto.RegisterType((*TransferGroupOwnerResp)(nil), "group.TransferGroupOwnerResp") proto.RegisterType((*JoinGroupReq)(nil), "group.JoinGroupReq") + proto.RegisterType((*JoinGroupResp)(nil), "group.JoinGroupResp") proto.RegisterType((*GroupApplicationResponseReq)(nil), "group.GroupApplicationResponseReq") proto.RegisterType((*GroupApplicationResponseResp)(nil), "group.GroupApplicationResponseResp") - proto.RegisterType((*SetOwnerGroupNickNameReq)(nil), "group.SetOwnerGroupNickNameReq") proto.RegisterType((*QuitGroupReq)(nil), "group.QuitGroupReq") - proto.RegisterType((*GroupApplicationUserInfo)(nil), "group.GroupApplicationUserInfo") - proto.RegisterType((*GroupMemberFullInfo)(nil), "group.GroupMemberFullInfo") + proto.RegisterType((*QuitGroupResp)(nil), "group.QuitGroupResp") proto.RegisterType((*GetGroupMemberListReq)(nil), "group.GetGroupMemberListReq") proto.RegisterType((*GetGroupMemberListResp)(nil), "group.GetGroupMemberListResp") proto.RegisterType((*GetGroupMembersInfoReq)(nil), "group.GetGroupMembersInfoReq") @@ -2287,11 +1748,10 @@ func init() { proto.RegisterType((*KickGroupMemberReq)(nil), "group.KickGroupMemberReq") proto.RegisterType((*Id2Result)(nil), "group.Id2Result") proto.RegisterType((*KickGroupMemberResp)(nil), "group.KickGroupMemberResp") - proto.RegisterType((*GetJoinedGroupListReq)(nil), "group.getJoinedGroupListReq") - proto.RegisterType((*GroupInfo)(nil), "group.GroupInfo") - proto.RegisterType((*GetJoinedGroupListResp)(nil), "group.getJoinedGroupListResp") - proto.RegisterType((*InviteUserToGroupReq)(nil), "group.inviteUserToGroupReq") - proto.RegisterType((*InviteUserToGroupResp)(nil), "group.inviteUserToGroupResp") + proto.RegisterType((*GetJoinedGroupListReq)(nil), "group.GetJoinedGroupListReq") + proto.RegisterType((*GetJoinedGroupListResp)(nil), "group.GetJoinedGroupListResp") + proto.RegisterType((*InviteUserToGroupReq)(nil), "group.InviteUserToGroupReq") + proto.RegisterType((*InviteUserToGroupResp)(nil), "group.InviteUserToGroupResp") proto.RegisterType((*GetGroupAllMemberReq)(nil), "group.GetGroupAllMemberReq") proto.RegisterType((*GetGroupAllMemberResp)(nil), "group.GetGroupAllMemberResp") } @@ -2308,14 +1768,13 @@ const _ = grpc.SupportPackageIsVersion4 type GroupClient interface { CreateGroup(ctx context.Context, in *CreateGroupReq, opts ...grpc.CallOption) (*CreateGroupResp, error) - JoinGroup(ctx context.Context, in *JoinGroupReq, opts ...grpc.CallOption) (*CommonResp, error) - QuitGroup(ctx context.Context, in *QuitGroupReq, opts ...grpc.CallOption) (*CommonResp, error) + JoinGroup(ctx context.Context, in *JoinGroupReq, opts ...grpc.CallOption) (*JoinGroupResp, error) + QuitGroup(ctx context.Context, in *QuitGroupReq, opts ...grpc.CallOption) (*QuitGroupResp, error) GetGroupsInfo(ctx context.Context, in *GetGroupsInfoReq, opts ...grpc.CallOption) (*GetGroupsInfoResp, error) - SetGroupInfo(ctx context.Context, in *SetGroupInfoReq, opts ...grpc.CallOption) (*CommonResp, error) + SetGroupInfo(ctx context.Context, in *SetGroupInfoReq, opts ...grpc.CallOption) (*SetGroupInfoResp, error) GetGroupApplicationList(ctx context.Context, in *GetGroupApplicationListReq, opts ...grpc.CallOption) (*GetGroupApplicationListResp, error) TransferGroupOwner(ctx context.Context, in *TransferGroupOwnerReq, opts ...grpc.CallOption) (*TransferGroupOwnerResp, error) GroupApplicationResponse(ctx context.Context, in *GroupApplicationResponseReq, opts ...grpc.CallOption) (*GroupApplicationResponseResp, error) - // rpc setOwnerGroupNickName(SetOwnerGroupNickNameReq) returns(CommonResp); GetGroupMemberList(ctx context.Context, in *GetGroupMemberListReq, opts ...grpc.CallOption) (*GetGroupMemberListResp, error) GetGroupMembersInfo(ctx context.Context, in *GetGroupMembersInfoReq, opts ...grpc.CallOption) (*GetGroupMembersInfoResp, error) KickGroupMember(ctx context.Context, in *KickGroupMemberReq, opts ...grpc.CallOption) (*KickGroupMemberResp, error) @@ -2341,8 +1800,8 @@ func (c *groupClient) CreateGroup(ctx context.Context, in *CreateGroupReq, opts return out, nil } -func (c *groupClient) JoinGroup(ctx context.Context, in *JoinGroupReq, opts ...grpc.CallOption) (*CommonResp, error) { - out := new(CommonResp) +func (c *groupClient) JoinGroup(ctx context.Context, in *JoinGroupReq, opts ...grpc.CallOption) (*JoinGroupResp, error) { + out := new(JoinGroupResp) err := grpc.Invoke(ctx, "/group.group/joinGroup", in, out, c.cc, opts...) if err != nil { return nil, err @@ -2350,8 +1809,8 @@ func (c *groupClient) JoinGroup(ctx context.Context, in *JoinGroupReq, opts ...g return out, nil } -func (c *groupClient) QuitGroup(ctx context.Context, in *QuitGroupReq, opts ...grpc.CallOption) (*CommonResp, error) { - out := new(CommonResp) +func (c *groupClient) QuitGroup(ctx context.Context, in *QuitGroupReq, opts ...grpc.CallOption) (*QuitGroupResp, error) { + out := new(QuitGroupResp) err := grpc.Invoke(ctx, "/group.group/quitGroup", in, out, c.cc, opts...) if err != nil { return nil, err @@ -2368,8 +1827,8 @@ func (c *groupClient) GetGroupsInfo(ctx context.Context, in *GetGroupsInfoReq, o return out, nil } -func (c *groupClient) SetGroupInfo(ctx context.Context, in *SetGroupInfoReq, opts ...grpc.CallOption) (*CommonResp, error) { - out := new(CommonResp) +func (c *groupClient) SetGroupInfo(ctx context.Context, in *SetGroupInfoReq, opts ...grpc.CallOption) (*SetGroupInfoResp, error) { + out := new(SetGroupInfoResp) err := grpc.Invoke(ctx, "/group.group/setGroupInfo", in, out, c.cc, opts...) if err != nil { return nil, err @@ -2462,14 +1921,13 @@ func (c *groupClient) GetGroupAllMember(ctx context.Context, in *GetGroupAllMemb type GroupServer interface { CreateGroup(context.Context, *CreateGroupReq) (*CreateGroupResp, error) - JoinGroup(context.Context, *JoinGroupReq) (*CommonResp, error) - QuitGroup(context.Context, *QuitGroupReq) (*CommonResp, error) + JoinGroup(context.Context, *JoinGroupReq) (*JoinGroupResp, error) + QuitGroup(context.Context, *QuitGroupReq) (*QuitGroupResp, error) GetGroupsInfo(context.Context, *GetGroupsInfoReq) (*GetGroupsInfoResp, error) - SetGroupInfo(context.Context, *SetGroupInfoReq) (*CommonResp, error) + SetGroupInfo(context.Context, *SetGroupInfoReq) (*SetGroupInfoResp, error) GetGroupApplicationList(context.Context, *GetGroupApplicationListReq) (*GetGroupApplicationListResp, error) TransferGroupOwner(context.Context, *TransferGroupOwnerReq) (*TransferGroupOwnerResp, error) GroupApplicationResponse(context.Context, *GroupApplicationResponseReq) (*GroupApplicationResponseResp, error) - // rpc setOwnerGroupNickName(SetOwnerGroupNickNameReq) returns(CommonResp); GetGroupMemberList(context.Context, *GetGroupMemberListReq) (*GetGroupMemberListResp, error) GetGroupMembersInfo(context.Context, *GetGroupMembersInfoReq) (*GetGroupMembersInfoResp, error) KickGroupMember(context.Context, *KickGroupMemberReq) (*KickGroupMemberResp, error) @@ -2799,116 +2257,86 @@ var _Group_serviceDesc = grpc.ServiceDesc{ Metadata: "group/group.proto", } -func init() { proto.RegisterFile("group/group.proto", fileDescriptor_group_ed07d0078ff66bfe) } +func init() { proto.RegisterFile("group/group.proto", fileDescriptor_group_a130b5186d308ee6) } -var fileDescriptor_group_ed07d0078ff66bfe = []byte{ - // 1718 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0xcd, 0x6e, 0xdc, 0xb6, - 0x13, 0x87, 0x76, 0xb5, 0xb6, 0x77, 0xfc, 0x4d, 0xc7, 0x8e, 0xfe, 0x8a, 0xff, 0x86, 0xc3, 0x06, - 0x85, 0xd1, 0x83, 0x0b, 0x38, 0x68, 0x81, 0xb4, 0x39, 0x34, 0xb1, 0x63, 0xc7, 0x69, 0x63, 0x27, - 0xb2, 0x73, 0xe9, 0x25, 0x51, 0x56, 0xf4, 0x46, 0xf1, 0xae, 0xb4, 0x96, 0xb4, 0x4d, 0xda, 0x4b, - 0x91, 0xa2, 0x40, 0xbf, 0x50, 0xf4, 0x90, 0x53, 0xdb, 0x17, 0xe8, 0xa9, 0x4f, 0xd0, 0xb7, 0xe9, - 0x8b, 0x14, 0x1c, 0x92, 0x12, 0xf5, 0xb5, 0x1b, 0xd8, 0x45, 0x73, 0x59, 0x68, 0x86, 0x43, 0x72, - 0x66, 0x38, 0xf3, 0xe3, 0x0c, 0x17, 0x16, 0xbb, 0x51, 0x38, 0x1c, 0xbc, 0x8f, 0xbf, 0x9b, 0x83, - 0x28, 0x4c, 0x42, 0xd2, 0x42, 0x82, 0xee, 0x02, 0x6c, 0x87, 0xfd, 0x7e, 0x18, 0x38, 0x2c, 0x1e, - 0x90, 0x55, 0x68, 0xdf, 0x89, 0xa2, 0x30, 0xda, 0x0e, 0x3d, 0x66, 0x19, 0xeb, 0xc6, 0x46, 0xcb, - 0xc9, 0x18, 0xc4, 0x86, 0x29, 0x24, 0xee, 0xc7, 0x5d, 0xab, 0xb1, 0x6e, 0x6c, 0xb4, 0x9d, 0x94, - 0xa6, 0xaf, 0x1b, 0x30, 0xb7, 0x1d, 0x31, 0x37, 0x61, 0x7b, 0x7c, 0x5d, 0x87, 0x9d, 0x91, 0x1b, - 0x00, 0x7d, 0xd6, 0x7f, 0xca, 0xa2, 0xcf, 0xfc, 0x38, 0xb1, 0x8c, 0xf5, 0xe6, 0xc6, 0xf4, 0xd6, - 0xff, 0x36, 0x85, 0x0e, 0x28, 0x74, 0xcb, 0xf3, 0xee, 0xa3, 0xc0, 0x7e, 0x70, 0x12, 0x3a, 0x9a, - 0x30, 0xd7, 0x03, 0xe5, 0x0e, 0xdc, 0x3e, 0x93, 0x5b, 0x65, 0x0c, 0x42, 0x61, 0xc6, 0x0f, 0x92, - 0x28, 0xf4, 0x86, 0x9d, 0xc4, 0x0f, 0x03, 0xab, 0x89, 0x02, 0x39, 0x1e, 0x97, 0x09, 0xc2, 0xc4, - 0x3f, 0xf1, 0x3b, 0x2e, 0xca, 0x98, 0x42, 0x46, 0xe7, 0x11, 0x0b, 0x26, 0x4f, 0xdc, 0x0e, 0x7b, - 0x14, 0xf5, 0xac, 0x16, 0x0e, 0x2b, 0x92, 0x5c, 0x82, 0x56, 0x12, 0x9e, 0xb2, 0xc0, 0x9a, 0x40, - 0xbe, 0x20, 0xc8, 0x3a, 0x4c, 0x87, 0x03, 0x16, 0xe1, 0xe4, 0xfd, 0x1d, 0x6b, 0x12, 0xc7, 0x74, - 0x16, 0x99, 0x83, 0x06, 0x7b, 0x69, 0x4d, 0xe1, 0x40, 0x83, 0xbd, 0xa4, 0x9f, 0x00, 0x29, 0x5b, - 0x4a, 0x16, 0xa0, 0x39, 0xf4, 0x3d, 0xf4, 0x6f, 0xdb, 0xe1, 0x9f, 0x5c, 0x93, 0x98, 0x25, 0x4e, - 0xd8, 0x13, 0xd6, 0xb6, 0x1c, 0x45, 0x52, 0x06, 0xf3, 0x39, 0xb7, 0x5e, 0xe4, 0x90, 0xf8, 0x36, - 0xe8, 0xc5, 0xfd, 0x1d, 0xe9, 0x33, 0x45, 0xd2, 0x1e, 0x2c, 0xec, 0xb1, 0x04, 0xf7, 0x88, 0xf1, - 0x34, 0xd8, 0x19, 0x37, 0x57, 0x0e, 0xa7, 0x07, 0xd8, 0x76, 0x74, 0x56, 0xe6, 0xa6, 0xc6, 0x08, - 0x37, 0x35, 0x4b, 0x6e, 0xa2, 0x31, 0x2c, 0x16, 0x76, 0xbb, 0x90, 0x59, 0xd7, 0xc0, 0xf4, 0xdc, - 0xc4, 0xb5, 0x9a, 0x18, 0x62, 0x0b, 0x7a, 0x88, 0xe1, 0xea, 0x38, 0x4a, 0xff, 0x36, 0x60, 0xfe, - 0x48, 0xee, 0xaa, 0x4c, 0xd4, 0x1c, 0x62, 0xe4, 0x1c, 0x32, 0x3e, 0x02, 0x73, 0xd1, 0xd5, 0xac, - 0x88, 0xae, 0x62, 0x94, 0x9a, 0x15, 0x51, 0xfa, 0xaf, 0x47, 0x20, 0x7d, 0x00, 0xb6, 0x72, 0xed, - 0xad, 0xc1, 0xa0, 0x27, 0x95, 0xe1, 0xa7, 0xc5, 0xed, 0x5d, 0x80, 0xe6, 0xa3, 0xd4, 0x56, 0xfe, - 0xc9, 0x57, 0x3c, 0xd4, 0x56, 0x14, 0x96, 0xea, 0x2c, 0xfa, 0xab, 0x09, 0x57, 0x6b, 0x96, 0x7c, - 0xbc, 0xe3, 0x26, 0xee, 0xe3, 0x47, 0x31, 0x8b, 0x78, 0xe4, 0xa7, 0x0b, 0x37, 0xf6, 0x77, 0xb8, - 0x65, 0x7b, 0xd2, 0xb3, 0x62, 0x4d, 0x45, 0x92, 0x35, 0x80, 0xdd, 0x28, 0xec, 0xf3, 0x59, 0x69, - 0x74, 0x68, 0x1c, 0x7e, 0xd2, 0xc7, 0xa1, 0x1c, 0x15, 0x3e, 0x4b, 0x69, 0x42, 0xc0, 0xdc, 0xed, - 0xb9, 0x5d, 0x74, 0x56, 0xcb, 0xc1, 0x6f, 0xbe, 0x9e, 0xc3, 0xce, 0x86, 0x2c, 0x4e, 0x78, 0x6c, - 0x08, 0x77, 0x69, 0x1c, 0x3e, 0x7e, 0xd7, 0x0d, 0xbc, 0x1e, 0xf3, 0xf8, 0xb8, 0x70, 0x99, 0xc6, - 0xe1, 0x9a, 0xde, 0xf2, 0xbc, 0x63, 0xbf, 0xcf, 0x30, 0x71, 0x9b, 0x8e, 0x22, 0xc9, 0x7b, 0xb0, - 0xa0, 0xf4, 0x3a, 0xf0, 0x3b, 0xa7, 0x01, 0x0f, 0x85, 0x36, 0xce, 0x2f, 0xf1, 0xc9, 0xbb, 0x30, - 0x27, 0xb4, 0x4c, 0x25, 0x01, 0x25, 0x0b, 0x5c, 0xb2, 0x01, 0xf3, 0x6a, 0xee, 0xae, 0x3c, 0xf9, - 0x69, 0x14, 0x2c, 0xb2, 0xc9, 0x35, 0x98, 0x15, 0x73, 0x95, 0xdc, 0x0c, 0xca, 0xe5, 0x99, 0xfc, - 0xfc, 0xa4, 0x2d, 0x9c, 0x6b, 0xcd, 0x8a, 0xf3, 0xd3, 0x58, 0xdc, 0x67, 0xc7, 0x5f, 0x0e, 0x98, - 0x35, 0x27, 0x7c, 0xc6, 0xbf, 0x79, 0x6c, 0x0a, 0x91, 0xa3, 0xc4, 0x4d, 0x86, 0xb1, 0x35, 0x8f, - 0x63, 0x39, 0x5e, 0x26, 0xe3, 0xb0, 0x78, 0xd8, 0x4b, 0xac, 0x05, 0x5d, 0x46, 0xf0, 0xe8, 0x19, - 0x5c, 0xa9, 0x09, 0x0d, 0x1e, 0x19, 0x3c, 0x88, 0xb7, 0xc3, 0x61, 0x90, 0xc8, 0x74, 0x16, 0x04, - 0xb9, 0x09, 0x26, 0xea, 0xda, 0xc0, 0x74, 0xdd, 0x50, 0xe9, 0x3a, 0x2e, 0xc4, 0x1c, 0x9c, 0x45, - 0xbf, 0x33, 0x6a, 0xf7, 0x44, 0x18, 0xb1, 0x60, 0xf2, 0x4e, 0xa4, 0x83, 0x88, 0x22, 0xc9, 0x0a, - 0x4c, 0xdc, 0x89, 0x34, 0x00, 0x91, 0x14, 0xf9, 0x10, 0xcc, 0x1d, 0x01, 0x1f, 0xc6, 0xc6, 0xf4, - 0x16, 0x1d, 0xad, 0x0f, 0x97, 0x74, 0x50, 0x9e, 0xfe, 0x64, 0xc0, 0xf2, 0x71, 0xe4, 0x06, 0xf1, - 0x09, 0x8b, 0x50, 0xf4, 0xf0, 0x45, 0xc0, 0x22, 0x09, 0x2b, 0x7b, 0x79, 0x58, 0x51, 0xc1, 0x6f, - 0xc3, 0xd4, 0x61, 0xcf, 0x43, 0x41, 0x05, 0x63, 0x8a, 0xe6, 0x63, 0x07, 0xec, 0x85, 0x18, 0x13, - 0x69, 0x91, 0xd2, 0xc5, 0x34, 0x35, 0xcb, 0x69, 0x7a, 0x0f, 0x56, 0xaa, 0x94, 0x39, 0x8f, 0x47, - 0xe8, 0x57, 0x30, 0x73, 0x2f, 0xf4, 0x83, 0xf4, 0x26, 0xaf, 0x87, 0x49, 0x0b, 0x26, 0xfb, 0x2c, - 0x8e, 0xdd, 0xae, 0x02, 0x49, 0x45, 0x66, 0x00, 0xd6, 0x2c, 0x00, 0xd8, 0x18, 0x3b, 0x7e, 0x30, - 0xe1, 0x4a, 0xd1, 0xf1, 0xdc, 0x8c, 0x30, 0x88, 0x99, 0xbc, 0x95, 0xf4, 0x15, 0x8c, 0xd2, 0x0a, - 0x5c, 0x27, 0x34, 0x3e, 0x83, 0x1e, 0x49, 0xea, 0xe7, 0xd2, 0x1c, 0x05, 0x4a, 0x66, 0x09, 0x94, - 0x0a, 0x50, 0x80, 0xb7, 0x42, 0xab, 0x0c, 0x05, 0x07, 0x35, 0x29, 0x3e, 0x51, 0x9d, 0xe2, 0x3a, - 0xd4, 0x4d, 0x16, 0xa0, 0x2e, 0x07, 0x28, 0xb8, 0xdf, 0x54, 0x11, 0x50, 0x70, 0xb7, 0x12, 0x4c, - 0xb4, 0xab, 0x60, 0x42, 0x03, 0x39, 0xc8, 0x83, 0x5c, 0x1e, 0x3e, 0xa7, 0xc7, 0xc0, 0xe7, 0x4c, - 0x09, 0x3e, 0x15, 0xbc, 0xcc, 0x8e, 0x80, 0x97, 0xb9, 0x37, 0x80, 0x97, 0xf9, 0x0a, 0x78, 0x79, - 0x00, 0xab, 0xf5, 0xa1, 0x70, 0xae, 0xc8, 0xfe, 0xde, 0x00, 0xeb, 0x88, 0x25, 0x18, 0x10, 0xb8, - 0xb4, 0xf2, 0xe3, 0xe8, 0x30, 0xb7, 0x61, 0x2a, 0x50, 0xc7, 0x20, 0xd3, 0x56, 0xd1, 0xc5, 0x80, - 0x6c, 0x96, 0x03, 0x32, 0x4d, 0x05, 0x53, 0x4b, 0x05, 0xfa, 0x04, 0x66, 0x1e, 0x0e, 0xfd, 0xe4, - 0x0d, 0x92, 0xac, 0x70, 0xeb, 0x37, 0xca, 0x75, 0x67, 0x65, 0xb2, 0xd1, 0x6f, 0x1b, 0x60, 0x15, - 0xfd, 0x87, 0xd1, 0xc5, 0x8b, 0xd0, 0xfa, 0xed, 0x64, 0x79, 0xda, 0xc8, 0xca, 0x53, 0x02, 0x26, - 0x5e, 0x69, 0x62, 0x75, 0xfc, 0xe6, 0x3c, 0xbf, 0x93, 0x96, 0x35, 0xf8, 0xcd, 0xbd, 0x1e, 0xb1, - 0x33, 0xee, 0x75, 0x91, 0x1b, 0x92, 0xe2, 0x19, 0xe1, 0x66, 0x2a, 0x60, 0x14, 0x4e, 0x60, 0x14, - 0x16, 0xd9, 0x7c, 0xd5, 0x13, 0x7e, 0xc1, 0x4f, 0x8a, 0x68, 0x3a, 0x91, 0x17, 0xbc, 0xb0, 0x35, - 0xe4, 0x79, 0x22, 0xb2, 0x40, 0xe3, 0xf0, 0xf1, 0x67, 0x59, 0x84, 0x8a, 0xf0, 0xd7, 0x38, 0xf4, - 0xb5, 0x01, 0x4b, 0xe8, 0x06, 0x51, 0x82, 0xef, 0x0e, 0x7b, 0x3d, 0xf4, 0xc0, 0x0a, 0x4c, 0x0c, - 0xb9, 0x37, 0x54, 0x25, 0x2e, 0x29, 0xae, 0x43, 0x94, 0x55, 0xe2, 0xf8, 0xcd, 0x03, 0xe0, 0x79, - 0xe8, 0x0b, 0xd5, 0xb9, 0x17, 0x4c, 0x27, 0xa5, 0x73, 0xc1, 0x61, 0x16, 0x82, 0xa3, 0xb6, 0xc0, - 0xa3, 0xbf, 0x1b, 0xb0, 0xac, 0xee, 0x98, 0xfb, 0x69, 0xe7, 0x33, 0x3a, 0x10, 0xce, 0x59, 0x6f, - 0x73, 0x4b, 0x4f, 0xfc, 0x5e, 0xc2, 0x22, 0xd4, 0xaf, 0xe5, 0x48, 0x8a, 0xef, 0x14, 0xb0, 0x97, - 0xc9, 0x11, 0x3b, 0x93, 0x15, 0x95, 0x22, 0xe9, 0x1f, 0x06, 0xac, 0x54, 0x69, 0x27, 0xea, 0x74, - 0x56, 0xac, 0xd3, 0x99, 0x5e, 0xa7, 0xb3, 0x42, 0x9d, 0xae, 0x68, 0xf2, 0x51, 0xae, 0x21, 0x14, - 0xd5, 0xba, 0xad, 0x57, 0xeb, 0xf9, 0x03, 0xca, 0x75, 0x84, 0x9a, 0xaa, 0x66, 0x5e, 0xd5, 0x1f, - 0x4b, 0xaa, 0xc6, 0xe3, 0xcb, 0xfb, 0xb5, 0x9c, 0x2a, 0x0d, 0x6c, 0x6d, 0xf4, 0xed, 0x6a, 0x6f, - 0xaf, 0xb0, 0x7c, 0x7b, 0xe9, 0xe5, 0xf7, 0x2f, 0x06, 0x5c, 0xae, 0x54, 0xe6, 0x6d, 0x39, 0x8e, - 0xfe, 0x65, 0x00, 0xf9, 0xd4, 0xef, 0x9c, 0x6a, 0x72, 0xa3, 0x5d, 0x73, 0x13, 0xa6, 0x87, 0xbe, - 0xc7, 0xe7, 0xf2, 0xb5, 0x64, 0x95, 0x36, 0x6a, 0x37, 0x5d, 0x5c, 0x40, 0x80, 0x1b, 0xa7, 0x3d, - 0x91, 0xa4, 0xaa, 0x31, 0xb0, 0xe8, 0xd0, 0x56, 0xd9, 0xa1, 0x1f, 0x40, 0x7b, 0xdf, 0xdb, 0x12, - 0xf7, 0x01, 0x22, 0xd3, 0x7e, 0xd6, 0x38, 0xef, 0x7b, 0x62, 0x3b, 0xbc, 0x3f, 0x44, 0xb6, 0x4a, - 0x8a, 0x7e, 0x0d, 0x4b, 0x25, 0xa3, 0x2f, 0x74, 0x04, 0x9b, 0xd0, 0xf6, 0xbd, 0x2d, 0xb9, 0x57, - 0xbe, 0xd1, 0x4c, 0xf5, 0x73, 0x32, 0x11, 0x7a, 0x08, 0xcb, 0x5d, 0x96, 0xf0, 0x2a, 0x8a, 0x79, - 0xa8, 0x85, 0xca, 0xee, 0xd4, 0x11, 0xc6, 0x08, 0x47, 0x94, 0x21, 0x9e, 0xbe, 0x6a, 0x40, 0x3b, - 0xed, 0x5d, 0xb3, 0xe3, 0xf3, 0xf2, 0xc7, 0xe7, 0xbd, 0xf5, 0xc6, 0x75, 0x0d, 0xa0, 0x83, 0x0f, - 0x16, 0x29, 0xcc, 0x9b, 0x8e, 0xc6, 0xe1, 0x33, 0x43, 0x2c, 0xc7, 0x3c, 0x59, 0xf2, 0x28, 0x92, - 0xfb, 0x40, 0xc4, 0xad, 0xe8, 0x19, 0x38, 0xd0, 0xcf, 0x3a, 0x3a, 0x8b, 0x7e, 0x63, 0xc0, 0x4a, - 0x95, 0x57, 0x2f, 0x7a, 0xb2, 0x5d, 0xb5, 0x54, 0xed, 0x13, 0x42, 0x26, 0x42, 0x7f, 0x33, 0xe0, - 0x92, 0x1f, 0x7c, 0xe1, 0x27, 0x8c, 0xdf, 0xa5, 0xc7, 0x61, 0x7a, 0x81, 0x9f, 0xf3, 0x64, 0xeb, - 0x5f, 0x65, 0xb4, 0x64, 0x32, 0x73, 0xc9, 0x64, 0xc1, 0xa4, 0xcc, 0x39, 0xab, 0x85, 0xd0, 0xa5, - 0x48, 0xfa, 0xca, 0x80, 0xe5, 0x0a, 0xe5, 0xfe, 0xd3, 0xd0, 0x7f, 0x06, 0x97, 0xd2, 0xe6, 0xa9, - 0xd7, 0x7b, 0x13, 0xc8, 0x39, 0xef, 0x3b, 0xd2, 0xcf, 0xda, 0x1d, 0xaa, 0x6d, 0xf5, 0xb6, 0xb0, - 0x76, 0xeb, 0xcf, 0x29, 0x10, 0xcf, 0xaa, 0x1c, 0x44, 0x3b, 0xd9, 0xb3, 0x1d, 0x59, 0x96, 0x0b, - 0xe4, 0x5f, 0x48, 0xed, 0x95, 0x2a, 0x76, 0x3c, 0x20, 0xd7, 0xa1, 0xfd, 0x5c, 0xf5, 0x5f, 0x64, - 0x49, 0x0a, 0xe9, 0x1d, 0x99, 0xbd, 0xa8, 0x66, 0x66, 0x6f, 0xb7, 0xd7, 0xa1, 0x7d, 0xa6, 0xea, - 0xc9, 0x74, 0x92, 0x5e, 0x61, 0x56, 0x4d, 0xba, 0x0d, 0xb3, 0x5d, 0xfd, 0x25, 0x8e, 0x5c, 0x2e, - 0xb4, 0xbf, 0xea, 0x2e, 0xb5, 0xad, 0xea, 0x81, 0x78, 0x40, 0x6e, 0xc0, 0x4c, 0xac, 0xbd, 0xab, - 0x11, 0x65, 0x55, 0xe1, 0xb1, 0xad, 0x6a, 0xfb, 0x27, 0x70, 0xb9, 0x5b, 0xdd, 0x67, 0x93, 0xab, - 0xa3, 0xfb, 0x70, 0xbe, 0x20, 0x1d, 0x27, 0x12, 0x0f, 0xc8, 0x43, 0x20, 0x49, 0xa9, 0x2d, 0x26, - 0xab, 0x72, 0x66, 0x65, 0xfb, 0x6e, 0xff, 0x7f, 0xc4, 0x68, 0x3c, 0x20, 0x1d, 0xb0, 0xba, 0x35, - 0x5d, 0x09, 0xa1, 0xb9, 0xf7, 0xed, 0xca, 0x0e, 0xd6, 0x7e, 0x67, 0xac, 0x8c, 0xd0, 0xbb, 0x5b, - 0xaa, 0xbf, 0x52, 0xbd, 0x2b, 0x0b, 0xc7, 0x54, 0xef, 0x9a, 0xc2, 0xed, 0x18, 0x96, 0xba, 0xe5, - 0xd2, 0x84, 0x54, 0xcf, 0x4a, 0xcf, 0x7d, 0x6d, 0xd4, 0x70, 0x3c, 0x20, 0x77, 0x61, 0xfe, 0x34, - 0x7f, 0xd3, 0x12, 0xf5, 0xc8, 0x5f, 0x2e, 0x3b, 0x6c, 0xbb, 0x6e, 0x28, 0x35, 0xb9, 0x00, 0xee, - 0xa9, 0xc9, 0x95, 0xb7, 0x69, 0x6a, 0x72, 0xcd, 0xad, 0x70, 0x00, 0x8b, 0x25, 0x34, 0x24, 0x57, - 0xe4, 0x9c, 0x2a, 0x10, 0xb7, 0x57, 0xeb, 0x07, 0xc5, 0x7a, 0xdd, 0x22, 0xde, 0xa4, 0xeb, 0x55, - 0x81, 0x9e, 0xbd, 0x5a, 0x3f, 0x18, 0x0f, 0x6e, 0xcf, 0x7f, 0x3e, 0xbb, 0x29, 0xfe, 0x95, 0xf9, - 0x18, 0x7f, 0x9f, 0x4e, 0xe0, 0x9f, 0x33, 0xd7, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0xc0, 0xd8, - 0xe8, 0x44, 0xb1, 0x19, 0x00, 0x00, +var fileDescriptor_group_a130b5186d308ee6 = []byte{ + // 1246 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0x4b, 0x6f, 0x23, 0xc5, + 0x13, 0x57, 0xc7, 0x71, 0x76, 0x5d, 0x89, 0xf3, 0xe8, 0xbc, 0xfc, 0x9f, 0xf5, 0x3f, 0x64, 0x1b, + 0x69, 0x15, 0x21, 0x64, 0x8b, 0x20, 0xed, 0x81, 0x45, 0xa0, 0x38, 0x8f, 0x5d, 0x6f, 0x36, 0x89, + 0x32, 0x1b, 0x2e, 0x5c, 0x82, 0x37, 0xd3, 0x19, 0x0d, 0x19, 0xcf, 0x8c, 0xa7, 0xc7, 0x09, 0xe2, + 0xb2, 0xe2, 0xb2, 0x12, 0xe2, 0x02, 0xe2, 0xca, 0x85, 0x3b, 0x07, 0x0e, 0x9c, 0xb8, 0xf0, 0x39, + 0xf8, 0x14, 0x7c, 0x05, 0x34, 0xdd, 0x3d, 0xe3, 0x9e, 0x67, 0xb2, 0xb6, 0xc4, 0x5e, 0x2c, 0x75, + 0x55, 0xf5, 0xd4, 0xfb, 0x57, 0xd5, 0x86, 0x25, 0xd3, 0x77, 0x87, 0x5e, 0x9b, 0xff, 0xb6, 0x3c, + 0xdf, 0x0d, 0x5c, 0x5c, 0xe5, 0x07, 0xed, 0xe1, 0x89, 0x47, 0x9d, 0xf3, 0xee, 0x51, 0xdb, 0xbb, + 0x32, 0xdb, 0x9c, 0xd3, 0x66, 0xc6, 0xd5, 0xf9, 0x0d, 0x6b, 0xdf, 0x30, 0x21, 0x49, 0x3e, 0x03, + 0xd8, 0x75, 0xfb, 0x7d, 0xd7, 0xd1, 0x29, 0xf3, 0x70, 0x03, 0xee, 0xed, 0xfb, 0xfe, 0xae, 0x6b, + 0xd0, 0x06, 0xda, 0x44, 0x5b, 0x55, 0x3d, 0x3a, 0xe2, 0x35, 0x98, 0xd9, 0xf7, 0xfd, 0x23, 0x66, + 0x36, 0xa6, 0x36, 0xd1, 0x56, 0x4d, 0x97, 0x27, 0xf2, 0x1c, 0xf0, 0xd3, 0x50, 0xd7, 0x8e, 0x61, + 0x1c, 0xd1, 0xfe, 0x2b, 0xea, 0x77, 0x9d, 0x4b, 0x37, 0x94, 0xfe, 0x82, 0x51, 0xbf, 0xbb, 0xc7, + 0x3f, 0x53, 0xd3, 0xe5, 0x09, 0x37, 0xa1, 0xa6, 0xbb, 0x36, 0x7d, 0x41, 0xaf, 0xa9, 0xcd, 0x3f, + 0x54, 0xd5, 0x47, 0x04, 0xf2, 0x0f, 0x82, 0xf9, 0x5d, 0x9f, 0xf6, 0x02, 0xca, 0x3f, 0xa9, 0xd3, + 0x01, 0xde, 0x81, 0xf9, 0xae, 0x63, 0x05, 0xe2, 0xd3, 0x2f, 0x2c, 0x16, 0x34, 0xd0, 0x66, 0x65, + 0x6b, 0x76, 0xfb, 0x7f, 0x2d, 0xe1, 0x6e, 0x56, 0xb7, 0x9e, 0xba, 0x80, 0x3f, 0x81, 0x1a, 0x97, + 0x0a, 0x99, 0x5c, 0xe7, 0xec, 0x76, 0xb3, 0xc5, 0xa8, 0x7f, 0x4d, 0xfd, 0xf3, 0x9e, 0x67, 0x9d, + 0x7b, 0x3d, 0xbf, 0xd7, 0x67, 0xad, 0x58, 0x46, 0x1f, 0x89, 0xe3, 0x4d, 0x98, 0x3d, 0xf1, 0xa8, + 0xdf, 0x0b, 0x2c, 0xd7, 0xe9, 0xee, 0x35, 0x2a, 0xdc, 0x19, 0x95, 0x84, 0x35, 0xb8, 0x7f, 0xe2, + 0x49, 0x5f, 0xa7, 0x39, 0x3b, 0x3e, 0xf3, 0xdb, 0x37, 0x0e, 0xf5, 0x25, 0xbb, 0x2a, 0x6f, 0x8f, + 0x48, 0xe4, 0x35, 0x2c, 0x24, 0x1c, 0x1e, 0x27, 0x05, 0x49, 0x07, 0x2b, 0x6f, 0xe5, 0x20, 0xf1, + 0x61, 0xf1, 0x29, 0x0d, 0xf8, 0x99, 0x71, 0x1e, 0x1d, 0x84, 0x66, 0x0b, 0x81, 0xbd, 0x38, 0xe0, + 0x35, 0x5d, 0x25, 0xa5, 0xc3, 0x32, 0x55, 0x1e, 0x96, 0x4a, 0x32, 0x2c, 0xe4, 0x7b, 0x04, 0x4b, + 0x29, 0xa5, 0x63, 0xf9, 0xdd, 0x81, 0x7a, 0xec, 0x08, 0xb7, 0xb4, 0xc2, 0x4b, 0xa3, 0xdc, 0xf7, + 0xe4, 0x15, 0xf2, 0x03, 0x82, 0x85, 0x97, 0xd2, 0x96, 0xc8, 0xff, 0x44, 0x3c, 0xd1, 0xdb, 0x15, + 0x8c, 0xea, 0xf7, 0x54, 0x4e, 0x39, 0x94, 0x16, 0x13, 0xd9, 0x87, 0xc5, 0xa4, 0x31, 0xcc, 0xc3, + 0x1f, 0xa9, 0x0d, 0x2a, 0xcd, 0x59, 0x92, 0xd5, 0x3f, 0x62, 0xe8, 0x8a, 0x10, 0xf9, 0x16, 0xb4, + 0x28, 0xbe, 0x3b, 0x9e, 0x67, 0x5b, 0x17, 0xfc, 0xfb, 0xa1, 0xbf, 0xa1, 0x7b, 0xaa, 0x89, 0xa8, + 0xdc, 0xc4, 0x9c, 0xc4, 0x6e, 0x00, 0x1c, 0xf8, 0x6e, 0x3f, 0x91, 0x5a, 0x85, 0x42, 0x7e, 0x41, + 0xf0, 0xa0, 0x50, 0xf9, 0x58, 0x69, 0x3e, 0x84, 0xc5, 0x08, 0x0e, 0x86, 0x94, 0x05, 0x4a, 0xa6, + 0xdf, 0x2b, 0xca, 0x8a, 0x14, 0xd5, 0x33, 0x17, 0xc9, 0x5f, 0x08, 0x56, 0xcf, 0xfc, 0x9e, 0xc3, + 0x2e, 0xa9, 0xcf, 0x99, 0xbc, 0x1b, 0xc3, 0xb0, 0x34, 0xe0, 0x9e, 0x2c, 0x71, 0x19, 0x95, 0xe8, + 0x88, 0x1f, 0xc1, 0xfc, 0x89, 0x6d, 0xa8, 0x9d, 0x2c, 0x0c, 0x4c, 0x51, 0x43, 0xb9, 0x63, 0x7a, + 0xa3, 0xca, 0x89, 0xf0, 0xa4, 0xa8, 0xe9, 0x20, 0x4f, 0x97, 0x77, 0x4f, 0x35, 0xd5, 0x3d, 0x87, + 0xb0, 0x96, 0xe7, 0xc0, 0x78, 0x95, 0xf2, 0x06, 0xc1, 0xdc, 0x73, 0xd7, 0x72, 0x62, 0xbc, 0x2d, + 0x8e, 0xc2, 0x06, 0x80, 0x4e, 0x07, 0x47, 0x94, 0xb1, 0x9e, 0x49, 0x65, 0x04, 0x14, 0x4a, 0x59, + 0xc7, 0xdf, 0xee, 0x31, 0xe9, 0x40, 0x5d, 0xb1, 0x63, 0x3c, 0x67, 0xfe, 0x0e, 0x4b, 0x2f, 0x55, + 0x77, 0x21, 0xc3, 0x75, 0x18, 0x95, 0xb8, 0xa6, 0x5a, 0x81, 0xca, 0xe3, 0x9e, 0xee, 0x5e, 0x25, + 0x32, 0x95, 0x4c, 0x64, 0x94, 0x96, 0x98, 0x4e, 0xb7, 0x44, 0xc8, 0x7f, 0xd6, 0x73, 0x0c, 0x9b, + 0x1a, 0x61, 0x71, 0x8b, 0x7c, 0x2a, 0x14, 0x4c, 0x60, 0x4e, 0x9c, 0x74, 0xca, 0x86, 0x76, 0xd0, + 0x98, 0xe1, 0x7d, 0x91, 0xa0, 0x91, 0x53, 0x68, 0x16, 0xbb, 0x36, 0x5e, 0xb8, 0x2e, 0x61, 0xee, + 0x74, 0x68, 0x05, 0x77, 0x48, 0xfd, 0x64, 0x70, 0xdf, 0x81, 0xba, 0xa2, 0x67, 0x3c, 0x5b, 0x7f, + 0x45, 0xb0, 0x1a, 0xa1, 0xca, 0x68, 0xb4, 0x97, 0x5b, 0x3d, 0x11, 0x14, 0x87, 0x68, 0x74, 0x60, + 0xd9, 0x01, 0xf5, 0x79, 0x42, 0xab, 0xba, 0x3c, 0x85, 0xfa, 0x8e, 0xe9, 0x37, 0xc1, 0x4b, 0x3a, + 0xe0, 0x99, 0xac, 0xea, 0xd1, 0x91, 0xfc, 0x86, 0x60, 0x2d, 0xcf, 0xc6, 0xb1, 0x40, 0xef, 0x00, + 0xa0, 0x3f, 0xda, 0x79, 0x04, 0xdc, 0x3d, 0x2a, 0x82, 0x3b, 0xa1, 0xed, 0x60, 0x68, 0xdb, 0x7c, + 0x6a, 0x28, 0x37, 0x43, 0xcd, 0x8e, 0x34, 0x57, 0xf8, 0x11, 0x1d, 0xc9, 0x8f, 0x19, 0x73, 0xe3, + 0x05, 0xa0, 0x14, 0x04, 0x14, 0xb3, 0xa6, 0xf8, 0x66, 0xa0, 0xaa, 0x9b, 0x0c, 0x04, 0x7e, 0x46, + 0xb0, 0x9e, 0x6b, 0xd2, 0xbb, 0x0c, 0x21, 0xf9, 0x1d, 0x01, 0x3e, 0xb4, 0x2e, 0xae, 0x14, 0xb9, + 0xf2, 0x20, 0x7d, 0x00, 0x8b, 0xa1, 0x3c, 0x35, 0x84, 0xe3, 0x4a, 0xa8, 0x32, 0xf4, 0xd0, 0x78, + 0x9d, 0xf6, 0x98, 0xeb, 0xc8, 0x70, 0xc9, 0x53, 0x3a, 0x58, 0xd5, 0xf2, 0x96, 0x9b, 0x49, 0xb5, + 0xdc, 0x13, 0xa8, 0x75, 0x8d, 0x6d, 0x01, 0x1d, 0x85, 0xbb, 0x38, 0x57, 0xcd, 0x01, 0x47, 0x2c, + 0xe2, 0xf2, 0x44, 0x5e, 0xc3, 0x72, 0xc6, 0xdd, 0xb1, 0x12, 0xf0, 0x18, 0xea, 0xb1, 0x15, 0x4a, + 0x0e, 0x16, 0x65, 0xab, 0xc7, 0x3c, 0x3d, 0x29, 0x46, 0x86, 0xbc, 0xd7, 0xc3, 0x71, 0x40, 0x0d, + 0x6e, 0x45, 0xd4, 0xeb, 0x49, 0xa0, 0x45, 0x19, 0xa0, 0xdd, 0x84, 0x59, 0x37, 0x8b, 0x53, 0xee, + 0x1d, 0x71, 0xea, 0x8d, 0x68, 0x88, 0x8c, 0xde, 0x89, 0x76, 0xf2, 0x3b, 0xef, 0xa5, 0x23, 0x71, + 0xf2, 0x07, 0x82, 0x95, 0xae, 0x73, 0x6d, 0x05, 0x34, 0xb4, 0xec, 0xcc, 0x8d, 0x11, 0xfa, 0x76, + 0x1c, 0x2e, 0x1e, 0x52, 0xa3, 0x42, 0x9b, 0x4e, 0x14, 0xda, 0x87, 0xb0, 0x24, 0x74, 0xa9, 0xd5, + 0x5a, 0xe5, 0xd5, 0x9a, 0x65, 0x94, 0x16, 0xdd, 0x77, 0x08, 0x56, 0x73, 0xcc, 0xfe, 0x4f, 0x4b, + 0xc7, 0x81, 0x95, 0x78, 0xf9, 0xb4, 0xed, 0xbb, 0x34, 0xeb, 0x64, 0x0b, 0xfb, 0x4f, 0xca, 0x5c, + 0x52, 0x14, 0xbe, 0x4b, 0xbc, 0xda, 0xfe, 0xf3, 0x3e, 0x88, 0xe7, 0x3f, 0xfe, 0x14, 0x66, 0x2f, + 0x46, 0xaf, 0x4b, 0xbc, 0x1a, 0xcd, 0xd8, 0xc4, 0x13, 0x5b, 0x5b, 0xcb, 0x23, 0x33, 0x0f, 0x3f, + 0x86, 0xda, 0xd7, 0xd1, 0x4a, 0x86, 0x97, 0xa5, 0x90, 0xba, 0x2c, 0x6a, 0x2b, 0x59, 0xa2, 0xb8, + 0x37, 0x88, 0xe6, 0x7d, 0x7c, 0x4f, 0xdd, 0x34, 0xe2, 0x7b, 0xc9, 0xb5, 0xa0, 0x03, 0x75, 0x53, + 0x7d, 0x15, 0xe2, 0xf5, 0xe8, 0x8d, 0x9f, 0x7a, 0xa0, 0x6a, 0x8d, 0x7c, 0x06, 0xf3, 0xf0, 0xe7, + 0x30, 0xc7, 0x94, 0x07, 0x14, 0x8e, 0x7c, 0x4b, 0x3d, 0xf1, 0xb4, 0xf5, 0x5c, 0x3a, 0xf3, 0xf0, + 0x57, 0xb0, 0x6e, 0xe6, 0xbf, 0x5e, 0xf0, 0xc3, 0x94, 0xd6, 0xec, 0xd3, 0x4a, 0x23, 0xb7, 0x89, + 0x30, 0x0f, 0x9f, 0x02, 0x0e, 0x32, 0xfb, 0x3b, 0x6e, 0xca, 0x9b, 0xb9, 0x6f, 0x13, 0xed, 0xff, + 0x25, 0x5c, 0xe6, 0xe1, 0x0b, 0x68, 0x98, 0x05, 0xcb, 0x21, 0x26, 0x89, 0x3f, 0x4a, 0x72, 0x17, + 0x63, 0xed, 0xfd, 0x5b, 0x65, 0x84, 0xdd, 0x66, 0x66, 0xbb, 0x89, 0xed, 0xce, 0x5d, 0xce, 0x62, + 0xbb, 0x0b, 0xd6, 0xa2, 0x33, 0x58, 0x36, 0xb3, 0xe3, 0x1e, 0xe7, 0xdf, 0x8a, 0xb3, 0xbf, 0x51, + 0xc6, 0x66, 0x1e, 0x7e, 0x06, 0x0b, 0x57, 0xc9, 0xf9, 0x85, 0xa3, 0x7f, 0x8b, 0xb2, 0x63, 0x5c, + 0xd3, 0x8a, 0x58, 0xb1, 0xcb, 0xa9, 0x81, 0xa0, 0xba, 0x9c, 0x9d, 0x51, 0xaa, 0xcb, 0x79, 0x93, + 0xe4, 0x18, 0x96, 0xac, 0x34, 0x46, 0xe2, 0x07, 0x11, 0xac, 0xe5, 0x80, 0xbe, 0xd6, 0x2c, 0x66, + 0x8a, 0xef, 0x99, 0x69, 0xfc, 0x89, 0xbf, 0x97, 0x07, 0x85, 0x5a, 0xb3, 0x98, 0xc9, 0xbc, 0xce, + 0xc2, 0x97, 0xf5, 0x96, 0xf8, 0x27, 0xf1, 0x09, 0xff, 0x7d, 0x35, 0xc3, 0xff, 0x26, 0xfc, 0xf8, + 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf6, 0x24, 0x19, 0x44, 0x65, 0x14, 0x00, 0x00, } diff --git a/pkg/proto/group/group.proto b/pkg/proto/group/group.proto index ff1821ec2..6ba7c52ba 100644 --- a/pkg/proto/group/group.proto +++ b/pkg/proto/group/group.proto @@ -1,285 +1,216 @@ syntax = "proto3"; +import "Open_IM/pkg/proto/sdk_ws/ws.proto"; option go_package = "./group;group"; package group; message CommonResp{ - int32 ErrorCode = 1; - string ErrorMsg = 2; + int32 ErrCode = 1; + string ErrMsg = 2; } +message GroupAddMemberInfo{ + string UserID = 1; + int32 RoleLevel = 2; +} + + message CreateGroupReq{ - repeated GroupAddMemberInfo memberList = 1; - string groupName = 2; - string introduction = 3; - string notification = 4; - string faceUrl = 5; - string token = 6; - string operationID = 7; - string ex = 8; -} -message GroupAddMemberInfo{ - string uid = 1; - int32 setRole = 2; + repeated GroupAddMemberInfo InitMemberList = 1; + server_api_params.GroupInfo GroupInfo = 2; + string OperationID = 3; + string OpUserID = 4; //app manager or group owner + string OwnerUserID = 5; //owner } message CreateGroupResp{ - int32 ErrorCode = 1; - string ErrorMsg = 2; - string groupID = 3; + int32 ErrCode = 1; + string ErrMsg = 2; + server_api_params.GroupInfo GroupInfo = 3; } + message GetGroupsInfoReq{ - repeated string groupIDList = 1; - string token = 2; - string operationID = 3; + repeated string GroupIDList = 1; + string OperationID = 2; + string OpUserID = 3; //No verification permission } message GetGroupsInfoResp{ - int32 ErrorCode = 1; - string ErrorMsg = 2; - repeated GroupInfo data = 3; + int32 ErrCode = 1; + string ErrMsg = 2; + repeated server_api_params.GroupInfo GroupInfoList = 3; } + message SetGroupInfoReq{ - string groupID = 1; - string groupName = 2; - string notification = 3; - string introduction = 4; - string faceUrl = 5; - string token = 6; - string operationID = 7; + server_api_params.GroupInfo GroupInfo = 1; + string OpUserID = 2; //app manager or group owner + string OperationID = 3; +} +message SetGroupInfoResp{ + CommonResp CommonResp = 1; } message GetGroupApplicationListReq { - string UID = 1; + string OpUserID = 1; //app manager or group owner(manager) string OperationID = 2; + string FromUserID = 3; //owner or manager } - -message GetGroupApplicationList_Data_User { - string ID = 1; - string GroupID = 2; - string FromUserID = 3; - string ToUserID = 4; - int32 Flag = 5; - string RequestMsg = 6; - string HandledMsg = 7; - int64 AddTime = 8; - string FromUserNickname = 9; - string ToUserNickname = 10; - string FromUserFaceUrl = 11; - string ToUserFaceUrl = 12; - string HandledUser = 13; - int32 Type = 14; - int32 HandleStatus = 15; - int32 HandleResult = 16; -} - -message GetGroupApplicationListData { - int32 Count = 1; - repeated GetGroupApplicationList_Data_User User = 2; -} - message GetGroupApplicationListResp { int32 ErrCode = 1; string ErrMsg = 2; - GetGroupApplicationListData Data = 3; + repeated server_api_params.GroupRequest GroupRequestList = 3; } + message TransferGroupOwnerReq { string GroupID = 1; - string OldOwner = 2; - string NewOwner = 3; + string OldOwnerUserID = 2; + string NewOwnerUserID = 3; string OperationID = 4; + string OpUserID = 5; //app manager or group owner } - message TransferGroupOwnerResp{ - int32 ErrCode = 1; - string ErrMsg = 2; + CommonResp CommonResp = 1; } message JoinGroupReq{ - string groupID = 1; - string message = 2; - string token = 3; + string GroupID = 1; + string ReqMessage = 2; + string OpUserID = 3; string OperationID = 4; } +message JoinGroupResp{ + CommonResp CommonResp = 1; +} + message GroupApplicationResponseReq{ string OperationID = 1; - string OwnerID = 2; + string OpUserID = 2; string GroupID = 3; - string FromUserID = 4; - string FromUserNickName = 5; - string FromUserFaceUrl = 6; - string ToUserID = 7; - string ToUserNickName = 8; - string ToUserFaceUrl = 9; - int64 AddTime = 10; - string RequestMsg = 11; - string HandledMsg = 12; - int32 Type = 13; - int32 HandleStatus = 14; - int32 HandleResult = 15; + string FromUserID = 4; // + string HandledMsg = 5; + int32 HandleResult = 6; } - message GroupApplicationResponseResp{ - int32 ErrCode = 1; - string ErrMsg = 2; + CommonResp CommonResp = 1; } -message SetOwnerGroupNickNameReq{ - string groupID = 1; - string nickName = 2; - string OperationID = 3; - string token = 4; -} - message QuitGroupReq{ - string groupID = 1; - string operationID = 2; - string token = 3; + string GroupID = 1; + string OperationID = 2; + string OpUserID = 3; +} +message QuitGroupResp{ + CommonResp CommonResp = 1; } -message GroupApplicationUserInfo{ - string groupID = 1; - string uid = 2; - string name = 3; - string icon = 4; - string reqMsg = 5; - int64 applicationTime = 6; - int32 flag = 7; - string operatorID = 8; - string handledMsg = 9; -} - -message GroupMemberFullInfo { - string userId = 1; - int32 role = 2; - uint64 joinTime = 3; - string nickName = 4; - string faceUrl = 5; -} message GetGroupMemberListReq { - string groupID = 1; - string token = 2; - string operationID = 3; - int32 filter = 4; - int32 nextSeq = 5; + string GroupID = 1; + string OpUserID = 2; //No verification permission + string OperationID = 3; + int32 Filter = 4; + int32 NextSeq = 5; } message GetGroupMemberListResp { - int32 errorCode = 1; - string errorMsg = 2; - repeated GroupMemberFullInfo memberList = 3; + int32 ErrCode = 1; + string ErrMsg = 2; + repeated server_api_params.GroupMemberFullInfo memberList = 3; int32 nextSeq = 4; } - message GetGroupMembersInfoReq { - string groupID = 1; + string GroupID = 1; repeated string memberList = 2; - string token = 3; - string operationID = 4; + string OpUserID = 3; //No verification permission + string OperationID = 4; } message GetGroupMembersInfoResp { - int32 errorCode = 1; - string errorMsg = 2; - repeated GroupMemberFullInfo memberList = 3; - + int32 ErrCode = 1; + string ErrMsg = 2; + repeated server_api_params.GroupMemberFullInfo memberList = 3; } message KickGroupMemberReq { - string groupID = 1; - repeated GroupMemberFullInfo uidListInfo = 2; - string reason = 3; - string token = 4; - string operationID = 5; + string GroupID = 1; + repeated string KickedUserIDList = 2; + string Reason = 3; + string OperationID = 5; + string OpUserID = 6; //app manger or group manager } message Id2Result { - string uId = 1; - int32 result = 2; //0 ok; -1 error + string UserID = 1; + int32 Result = 2; //0 ok; -1 error } message KickGroupMemberResp { - int32 errorCode = 1; - string errorMsg = 2; - repeated Id2Result id2result = 3; + int32 ErrCode = 1; + string ErrMsg = 2; + repeated Id2Result Id2ResultList = 3; } -message getJoinedGroupListReq { - string token = 1; +message GetJoinedGroupListReq { + string FromUserID = 1; string operationID = 2; + string OpUserID = 3; //app manager or FromUserID } - -message GroupInfo { - string groupId = 1; - string groupName = 2; - string notification = 3; - string introduction = 4; - string faceUrl = 5; - uint64 createTime = 6; - string ownerId = 7; - uint32 memberCount = 8; -} - -message getJoinedGroupListResp{ - int32 errorCode = 1; - string errorMsg = 2; - repeated GroupInfo groupList = 3; +message GetJoinedGroupListResp{ + int32 ErrCode = 1; + string ErrMsg = 2; + repeated server_api_params.GroupInfo GroupList = 3; } -message inviteUserToGroupReq { - string token = 1; - string operationID = 2; - string groupID = 3; - string reason = 4; - repeated string uidList = 5; +message InviteUserToGroupReq { + string OperationID = 2; + string GroupID = 3; + string Reason = 4; + repeated string InvitedUserIDList = 5; + string OpUserID = 6; //group member or app manager +} +message InviteUserToGroupResp { + int32 ErrCode = 1; + string ErrMsg = 2; + repeated Id2Result Id2ResultList = 3; // 0 ok, -1 error } -message inviteUserToGroupResp { - int32 errorCode = 1; - string errorMsg = 2; - repeated Id2Result id2result = 3; // 0 ok, -1 error -} message GetGroupAllMemberReq { - string groupID = 1; - string token = 2; - string operationID = 3; + string GroupID = 1; + string OpUserID = 2; //No verification permission + string OperationID = 3; } - message GetGroupAllMemberResp { - int32 errorCode = 1; - string errorMsg = 2; - repeated GroupMemberFullInfo memberList = 3; + int32 ErrCode = 1; + string ErrMsg = 2; + repeated server_api_params.GroupMemberFullInfo memberList = 3; } service group{ rpc createGroup(CreateGroupReq) returns(CreateGroupResp); - rpc joinGroup(JoinGroupReq) returns(CommonResp); - rpc quitGroup(QuitGroupReq) returns(CommonResp); + rpc joinGroup(JoinGroupReq) returns(JoinGroupResp); + rpc quitGroup(QuitGroupReq) returns(QuitGroupResp); rpc getGroupsInfo(GetGroupsInfoReq) returns(GetGroupsInfoResp); - rpc setGroupInfo(SetGroupInfoReq) returns(CommonResp); + rpc setGroupInfo(SetGroupInfoReq) returns(SetGroupInfoResp); rpc getGroupApplicationList(GetGroupApplicationListReq) returns(GetGroupApplicationListResp); rpc transferGroupOwner(TransferGroupOwnerReq) returns(TransferGroupOwnerResp); rpc groupApplicationResponse(GroupApplicationResponseReq) returns(GroupApplicationResponseResp); - // rpc setOwnerGroupNickName(SetOwnerGroupNickNameReq) returns(CommonResp); rpc getGroupMemberList(GetGroupMemberListReq) returns(GetGroupMemberListResp); rpc getGroupMembersInfo(GetGroupMembersInfoReq) returns(GetGroupMembersInfoResp); rpc kickGroupMember(KickGroupMemberReq) returns (KickGroupMemberResp); - rpc getJoinedGroupList(getJoinedGroupListReq) returns (getJoinedGroupListResp); - rpc inviteUserToGroup(inviteUserToGroupReq) returns (inviteUserToGroupResp); - + rpc getJoinedGroupList(GetJoinedGroupListReq) returns (GetJoinedGroupListResp); + rpc inviteUserToGroup(InviteUserToGroupReq) returns (InviteUserToGroupResp); rpc getGroupAllMember(GetGroupAllMemberReq) returns(GetGroupAllMemberResp); } diff --git a/pkg/proto/push/push.pb.go b/pkg/proto/push/push.pb.go index b53d2b8a1..0dc06210a 100644 --- a/pkg/proto/push/push.pb.go +++ b/pkg/proto/push/push.pb.go @@ -6,6 +6,7 @@ package pbPush // import "./push" 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,32 +25,18 @@ var _ = math.Inf const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type PushMsgReq struct { - SendID string `protobuf:"bytes,1,opt,name=SendID" json:"SendID,omitempty"` - RecvID string `protobuf:"bytes,2,opt,name=RecvID" json:"RecvID,omitempty"` - Content string `protobuf:"bytes,3,opt,name=Content" json:"Content,omitempty"` - RecvSeq int64 `protobuf:"varint,4,opt,name=RecvSeq" json:"RecvSeq,omitempty"` - SendTime int64 `protobuf:"varint,5,opt,name=SendTime" json:"SendTime,omitempty"` - MsgFrom int32 `protobuf:"varint,6,opt,name=MsgFrom" json:"MsgFrom,omitempty"` - ContentType int32 `protobuf:"varint,7,opt,name=ContentType" json:"ContentType,omitempty"` - SessionType int32 `protobuf:"varint,8,opt,name=SessionType" json:"SessionType,omitempty"` - OperationID string `protobuf:"bytes,9,opt,name=OperationID" json:"OperationID,omitempty"` - MsgID string `protobuf:"bytes,10,opt,name=MsgID" json:"MsgID,omitempty"` - OfflineInfo string `protobuf:"bytes,11,opt,name=OfflineInfo" json:"OfflineInfo,omitempty"` - Options string `protobuf:"bytes,12,opt,name=Options" json:"Options,omitempty"` - PlatformID int32 `protobuf:"varint,13,opt,name=PlatformID" json:"PlatformID,omitempty"` - SenderNickName string `protobuf:"bytes,14,opt,name=SenderNickName" json:"SenderNickName,omitempty"` - SenderFaceURL string `protobuf:"bytes,15,opt,name=SenderFaceURL" json:"SenderFaceURL,omitempty"` - ClientMsgID string `protobuf:"bytes,16,opt,name=ClientMsgID" json:"ClientMsgID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + OperationID string `protobuf:"bytes,1,opt,name=operationID" json:"operationID,omitempty"` + MsgData *sdk_ws.MsgData `protobuf:"bytes,2,opt,name=msgData" json:"msgData,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *PushMsgReq) Reset() { *m = PushMsgReq{} } func (m *PushMsgReq) String() string { return proto.CompactTextString(m) } func (*PushMsgReq) ProtoMessage() {} func (*PushMsgReq) Descriptor() ([]byte, []int) { - return fileDescriptor_push_e44270f7d93180b9, []int{0} + return fileDescriptor_push_3a8dbda4109fac8a, []int{0} } func (m *PushMsgReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PushMsgReq.Unmarshal(m, b) @@ -69,62 +56,6 @@ func (m *PushMsgReq) XXX_DiscardUnknown() { var xxx_messageInfo_PushMsgReq proto.InternalMessageInfo -func (m *PushMsgReq) GetSendID() string { - if m != nil { - return m.SendID - } - return "" -} - -func (m *PushMsgReq) GetRecvID() string { - if m != nil { - return m.RecvID - } - return "" -} - -func (m *PushMsgReq) GetContent() string { - if m != nil { - return m.Content - } - return "" -} - -func (m *PushMsgReq) GetRecvSeq() int64 { - if m != nil { - return m.RecvSeq - } - return 0 -} - -func (m *PushMsgReq) GetSendTime() int64 { - if m != nil { - return m.SendTime - } - return 0 -} - -func (m *PushMsgReq) GetMsgFrom() int32 { - if m != nil { - return m.MsgFrom - } - return 0 -} - -func (m *PushMsgReq) GetContentType() int32 { - if m != nil { - return m.ContentType - } - return 0 -} - -func (m *PushMsgReq) GetSessionType() int32 { - if m != nil { - return m.SessionType - } - return 0 -} - func (m *PushMsgReq) GetOperationID() string { if m != nil { return m.OperationID @@ -132,53 +63,11 @@ func (m *PushMsgReq) GetOperationID() string { return "" } -func (m *PushMsgReq) GetMsgID() string { +func (m *PushMsgReq) GetMsgData() *sdk_ws.MsgData { if m != nil { - return m.MsgID + return m.MsgData } - return "" -} - -func (m *PushMsgReq) GetOfflineInfo() string { - if m != nil { - return m.OfflineInfo - } - return "" -} - -func (m *PushMsgReq) GetOptions() string { - if m != nil { - return m.Options - } - return "" -} - -func (m *PushMsgReq) GetPlatformID() int32 { - if m != nil { - return m.PlatformID - } - return 0 -} - -func (m *PushMsgReq) GetSenderNickName() string { - if m != nil { - return m.SenderNickName - } - return "" -} - -func (m *PushMsgReq) GetSenderFaceURL() string { - if m != nil { - return m.SenderFaceURL - } - return "" -} - -func (m *PushMsgReq) GetClientMsgID() string { - if m != nil { - return m.ClientMsgID - } - return "" + return nil } type PushMsgResp struct { @@ -192,7 +81,7 @@ func (m *PushMsgResp) Reset() { *m = PushMsgResp{} } func (m *PushMsgResp) String() string { return proto.CompactTextString(m) } func (*PushMsgResp) ProtoMessage() {} func (*PushMsgResp) Descriptor() ([]byte, []int) { - return fileDescriptor_push_e44270f7d93180b9, []int{1} + return fileDescriptor_push_3a8dbda4109fac8a, []int{1} } func (m *PushMsgResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PushMsgResp.Unmarshal(m, b) @@ -296,32 +185,23 @@ var _PushMsgService_serviceDesc = grpc.ServiceDesc{ Metadata: "push/push.proto", } -func init() { proto.RegisterFile("push/push.proto", fileDescriptor_push_e44270f7d93180b9) } +func init() { proto.RegisterFile("push/push.proto", fileDescriptor_push_3a8dbda4109fac8a) } -var fileDescriptor_push_e44270f7d93180b9 = []byte{ - // 378 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x92, 0x5d, 0xeb, 0xda, 0x30, - 0x14, 0xc6, 0xe9, 0xb4, 0xbe, 0x1c, 0xe7, 0xcb, 0xc2, 0x18, 0xc1, 0x8b, 0x51, 0x64, 0x0c, 0x6f, - 0xd6, 0xc1, 0x76, 0xb9, 0x9b, 0x31, 0x8b, 0x50, 0x98, 0x2f, 0xa4, 0xee, 0x66, 0x77, 0xb5, 0x9e, - 0x6a, 0x59, 0x9b, 0xc4, 0xa6, 0x0a, 0xfb, 0xd2, 0xfb, 0x0c, 0x23, 0x49, 0xd5, 0xfe, 0xbd, 0x29, - 0x7d, 0x7e, 0xe7, 0x39, 0x87, 0x27, 0xc9, 0x81, 0xb1, 0xbc, 0xa8, 0xd3, 0x67, 0xfd, 0xf1, 0x65, - 0x29, 0x2a, 0x41, 0xda, 0xfa, 0x7f, 0xf6, 0xaf, 0x05, 0xb0, 0xbd, 0xa8, 0xd3, 0x4a, 0x1d, 0x19, - 0x9e, 0xc9, 0x3b, 0xe8, 0x44, 0xc8, 0x0f, 0x61, 0x40, 0x1d, 0xcf, 0x99, 0xf7, 0x59, 0xad, 0x34, - 0x67, 0x98, 0x5c, 0xc3, 0x80, 0xbe, 0xb2, 0xdc, 0x2a, 0x42, 0xa1, 0xbb, 0x10, 0xbc, 0x42, 0x5e, - 0xd1, 0x96, 0x29, 0xdc, 0xa4, 0xae, 0x68, 0x4f, 0x84, 0x67, 0xda, 0xf6, 0x9c, 0x79, 0x8b, 0xdd, - 0x24, 0x99, 0x42, 0x4f, 0x4f, 0xdd, 0x65, 0x05, 0x52, 0xd7, 0x94, 0xee, 0x5a, 0x77, 0xad, 0xd4, - 0x71, 0x59, 0x8a, 0x82, 0x76, 0x3c, 0x67, 0xee, 0xb2, 0x9b, 0x24, 0x1e, 0x0c, 0xea, 0xd1, 0xbb, - 0xbf, 0x12, 0x69, 0xd7, 0x54, 0x9b, 0x48, 0x3b, 0x22, 0x54, 0x2a, 0x13, 0xdc, 0x38, 0x7a, 0xd6, - 0xd1, 0x40, 0xda, 0xb1, 0x91, 0x58, 0xc6, 0x55, 0x26, 0x78, 0x18, 0xd0, 0xbe, 0x49, 0xdc, 0x44, - 0xe4, 0x2d, 0xb8, 0x2b, 0x75, 0x0c, 0x03, 0x0a, 0xa6, 0x66, 0x85, 0xe9, 0x4b, 0xd3, 0x3c, 0xe3, - 0x18, 0xf2, 0x54, 0xd0, 0x41, 0xdd, 0xf7, 0x40, 0x3a, 0xf7, 0x46, 0xea, 0x19, 0x8a, 0xbe, 0xb6, - 0xf7, 0x50, 0x4b, 0xf2, 0x1e, 0x60, 0x9b, 0xc7, 0x55, 0x2a, 0xca, 0x22, 0x0c, 0xe8, 0xd0, 0x84, - 0x6a, 0x10, 0xf2, 0x11, 0x46, 0xfa, 0xf4, 0x58, 0xae, 0xb3, 0xe4, 0xcf, 0x3a, 0x2e, 0x90, 0x8e, - 0xcc, 0x80, 0x27, 0x4a, 0x3e, 0xc0, 0xd0, 0x92, 0x65, 0x9c, 0xe0, 0x2f, 0xf6, 0x93, 0x8e, 0x8d, - 0xed, 0x25, 0x34, 0xb7, 0x94, 0x67, 0xc8, 0x2b, 0x7b, 0x8a, 0x89, 0x4d, 0xda, 0x40, 0xb3, 0x4f, - 0x30, 0xb8, 0xbf, 0xb7, 0x92, 0x3a, 0x1e, 0x43, 0x75, 0xc9, 0xab, 0x85, 0x38, 0xa0, 0x79, 0x74, - 0x97, 0x35, 0xc8, 0x97, 0xef, 0x30, 0xaa, 0xed, 0x11, 0x96, 0xd7, 0x2c, 0x41, 0xe2, 0x43, 0xb7, - 0x26, 0x64, 0xe2, 0x9b, 0x7d, 0x7a, 0xec, 0xcf, 0xf4, 0xcd, 0x13, 0x51, 0xf2, 0xc7, 0xf8, 0xf7, - 0xd0, 0x37, 0x7b, 0xf7, 0x4d, 0xee, 0x35, 0xdf, 0x77, 0xcc, 0xfe, 0x7d, 0xfd, 0x1f, 0x00, 0x00, - 0xff, 0xff, 0x6b, 0x53, 0xf4, 0xd4, 0x92, 0x02, 0x00, 0x00, +var fileDescriptor_push_3a8dbda4109fac8a = []byte{ + // 229 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0x31, 0x4f, 0xc3, 0x30, + 0x10, 0x85, 0x15, 0x04, 0x54, 0x5c, 0x04, 0x05, 0x4f, 0x55, 0x06, 0x14, 0x3a, 0x75, 0xc1, 0x96, + 0x0a, 0x1b, 0x0b, 0x82, 0x2e, 0x1d, 0x22, 0x90, 0xd9, 0x58, 0x2c, 0x97, 0x9c, 0xd2, 0xa8, 0xb4, + 0x3e, 0x7c, 0x4e, 0xfb, 0xf7, 0x51, 0x9c, 0x00, 0x11, 0x8b, 0x65, 0x7d, 0xf7, 0x49, 0xef, 0xde, + 0xc1, 0x98, 0x1a, 0x5e, 0xab, 0xf6, 0x91, 0xe4, 0x5d, 0x70, 0xe2, 0xb8, 0xfd, 0x67, 0x37, 0x2f, + 0x84, 0x3b, 0xb3, 0x2c, 0x14, 0x6d, 0x2a, 0x15, 0x07, 0x8a, 0xcb, 0x8d, 0x39, 0xb0, 0x3a, 0x70, + 0x27, 0x4e, 0x4b, 0x80, 0xd7, 0x86, 0xd7, 0x05, 0x57, 0x1a, 0xbf, 0x44, 0x0e, 0xa9, 0x23, 0xf4, + 0x36, 0xd4, 0x6e, 0xb7, 0x5c, 0x4c, 0x92, 0x3c, 0x99, 0x9d, 0xe9, 0x21, 0x12, 0xf7, 0x30, 0xda, + 0x72, 0xb5, 0xb0, 0xc1, 0x4e, 0x8e, 0xf2, 0x64, 0x96, 0xce, 0x33, 0xc9, 0xe8, 0xf7, 0xe8, 0x8d, + 0xa5, 0xda, 0x90, 0xf5, 0x76, 0xcb, 0xb2, 0xe8, 0x0c, 0xfd, 0xa3, 0x4e, 0x6f, 0x21, 0xfd, 0x4d, + 0x61, 0x12, 0xd7, 0x00, 0x1a, 0xb9, 0xf9, 0x0c, 0xcf, 0xae, 0xc4, 0x98, 0x72, 0xa2, 0x07, 0x64, + 0xfe, 0x08, 0x17, 0xbd, 0xfe, 0x86, 0x7e, 0x5f, 0x7f, 0xa0, 0x90, 0x30, 0xea, 0x89, 0xb8, 0x94, + 0xb1, 0xe7, 0xdf, 0xd6, 0xd9, 0xd5, 0x3f, 0xc2, 0xf4, 0x34, 0x7e, 0x3f, 0x97, 0xf1, 0x1e, 0x0f, + 0xb4, 0x6a, 0xf9, 0xea, 0x34, 0xd6, 0xbd, 0xfb, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xa1, 0x97, 0x1e, + 0x77, 0x2a, 0x01, 0x00, 0x00, } diff --git a/pkg/proto/push/push.proto b/pkg/proto/push/push.proto index 60fddfe3b..455b3e6de 100644 --- a/pkg/proto/push/push.proto +++ b/pkg/proto/push/push.proto @@ -1,24 +1,11 @@ syntax = "proto3"; +import "Open_IM/pkg/proto/sdk_ws/ws.proto"; option go_package = "./push;pbPush"; package push; message PushMsgReq { - string SendID = 1; - string RecvID = 2; - string Content = 3; - int64 RecvSeq = 4; - int64 SendTime = 5; - int32 MsgFrom = 6; - int32 ContentType = 7; - int32 SessionType = 8; - string OperationID = 9; - string MsgID = 10; - string OfflineInfo = 11; - string Options =12; - int32 PlatformID =13; - string SenderNickName = 14; - string SenderFaceURL = 15; - string ClientMsgID = 16; + string operationID = 1; + server_api_params.MsgData msgData = 2; } message PushMsgResp{ int32 ResultCode = 1; diff --git a/pkg/proto/relay/relay.pb.go b/pkg/proto/relay/relay.pb.go index d56aae9e0..d8451ff70 100644 --- a/pkg/proto/relay/relay.pb.go +++ b/pkg/proto/relay/relay.pb.go @@ -6,6 +6,7 @@ package pbRelay // import "./relay" 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,197 +24,90 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package -type MsgToUserReq struct { - SendID string `protobuf:"bytes,1,opt,name=SendID" json:"SendID,omitempty"` - RecvID string `protobuf:"bytes,2,opt,name=RecvID" json:"RecvID,omitempty"` - Content string `protobuf:"bytes,5,opt,name=Content" json:"Content,omitempty"` - RecvSeq int64 `protobuf:"varint,6,opt,name=RecvSeq" json:"RecvSeq,omitempty"` - SendTime int64 `protobuf:"varint,7,opt,name=SendTime" json:"SendTime,omitempty"` - MsgFrom int32 `protobuf:"varint,8,opt,name=MsgFrom" json:"MsgFrom,omitempty"` - ContentType int32 `protobuf:"varint,9,opt,name=ContentType" json:"ContentType,omitempty"` - SessionType int32 `protobuf:"varint,10,opt,name=SessionType" json:"SessionType,omitempty"` - OperationID string `protobuf:"bytes,11,opt,name=OperationID" json:"OperationID,omitempty"` - ServerMsgID string `protobuf:"bytes,12,opt,name=ServerMsgID" json:"ServerMsgID,omitempty"` - PlatformID int32 `protobuf:"varint,13,opt,name=PlatformID" json:"PlatformID,omitempty"` - SenderNickName string `protobuf:"bytes,14,opt,name=SenderNickName" json:"SenderNickName,omitempty"` - SenderFaceURL string `protobuf:"bytes,15,opt,name=SenderFaceURL" json:"SenderFaceURL,omitempty"` - ClientMsgID string `protobuf:"bytes,16,opt,name=ClientMsgID" json:"ClientMsgID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +type OnlinePushMsgReq struct { + OperationID string `protobuf:"bytes,1,opt,name=OperationID" json:"OperationID,omitempty"` + MsgData *sdk_ws.MsgData `protobuf:"bytes,2,opt,name=msgData" json:"msgData,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *MsgToUserReq) Reset() { *m = MsgToUserReq{} } -func (m *MsgToUserReq) String() string { return proto.CompactTextString(m) } -func (*MsgToUserReq) ProtoMessage() {} -func (*MsgToUserReq) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_709d2b3cc3a7ad83, []int{0} +func (m *OnlinePushMsgReq) Reset() { *m = OnlinePushMsgReq{} } +func (m *OnlinePushMsgReq) String() string { return proto.CompactTextString(m) } +func (*OnlinePushMsgReq) ProtoMessage() {} +func (*OnlinePushMsgReq) Descriptor() ([]byte, []int) { + return fileDescriptor_relay_aeddd7666fcf4cae, []int{0} } -func (m *MsgToUserReq) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MsgToUserReq.Unmarshal(m, b) +func (m *OnlinePushMsgReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OnlinePushMsgReq.Unmarshal(m, b) } -func (m *MsgToUserReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MsgToUserReq.Marshal(b, m, deterministic) +func (m *OnlinePushMsgReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OnlinePushMsgReq.Marshal(b, m, deterministic) } -func (dst *MsgToUserReq) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgToUserReq.Merge(dst, src) +func (dst *OnlinePushMsgReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_OnlinePushMsgReq.Merge(dst, src) } -func (m *MsgToUserReq) XXX_Size() int { - return xxx_messageInfo_MsgToUserReq.Size(m) +func (m *OnlinePushMsgReq) XXX_Size() int { + return xxx_messageInfo_OnlinePushMsgReq.Size(m) } -func (m *MsgToUserReq) XXX_DiscardUnknown() { - xxx_messageInfo_MsgToUserReq.DiscardUnknown(m) +func (m *OnlinePushMsgReq) XXX_DiscardUnknown() { + xxx_messageInfo_OnlinePushMsgReq.DiscardUnknown(m) } -var xxx_messageInfo_MsgToUserReq proto.InternalMessageInfo +var xxx_messageInfo_OnlinePushMsgReq proto.InternalMessageInfo -func (m *MsgToUserReq) GetSendID() string { - if m != nil { - return m.SendID - } - return "" -} - -func (m *MsgToUserReq) GetRecvID() string { - if m != nil { - return m.RecvID - } - return "" -} - -func (m *MsgToUserReq) GetContent() string { - if m != nil { - return m.Content - } - return "" -} - -func (m *MsgToUserReq) GetRecvSeq() int64 { - if m != nil { - return m.RecvSeq - } - return 0 -} - -func (m *MsgToUserReq) GetSendTime() int64 { - if m != nil { - return m.SendTime - } - return 0 -} - -func (m *MsgToUserReq) GetMsgFrom() int32 { - if m != nil { - return m.MsgFrom - } - return 0 -} - -func (m *MsgToUserReq) GetContentType() int32 { - if m != nil { - return m.ContentType - } - return 0 -} - -func (m *MsgToUserReq) GetSessionType() int32 { - if m != nil { - return m.SessionType - } - return 0 -} - -func (m *MsgToUserReq) GetOperationID() string { +func (m *OnlinePushMsgReq) GetOperationID() string { if m != nil { return m.OperationID } return "" } -func (m *MsgToUserReq) GetServerMsgID() string { +func (m *OnlinePushMsgReq) GetMsgData() *sdk_ws.MsgData { if m != nil { - return m.ServerMsgID + return m.MsgData } - return "" + return nil } -func (m *MsgToUserReq) GetPlatformID() int32 { - if m != nil { - return m.PlatformID - } - return 0 -} - -func (m *MsgToUserReq) GetSenderNickName() string { - if m != nil { - return m.SenderNickName - } - return "" -} - -func (m *MsgToUserReq) GetSenderFaceURL() string { - if m != nil { - return m.SenderFaceURL - } - return "" -} - -func (m *MsgToUserReq) GetClientMsgID() string { - if m != nil { - return m.ClientMsgID - } - return "" -} - -type MsgToUserResp struct { +type OnlinePushMsgResp struct { Resp []*SingleMsgToUser `protobuf:"bytes,1,rep,name=resp" json:"resp,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *MsgToUserResp) Reset() { *m = MsgToUserResp{} } -func (m *MsgToUserResp) String() string { return proto.CompactTextString(m) } -func (*MsgToUserResp) ProtoMessage() {} -func (*MsgToUserResp) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_709d2b3cc3a7ad83, []int{1} +func (m *OnlinePushMsgResp) Reset() { *m = OnlinePushMsgResp{} } +func (m *OnlinePushMsgResp) String() string { return proto.CompactTextString(m) } +func (*OnlinePushMsgResp) ProtoMessage() {} +func (*OnlinePushMsgResp) Descriptor() ([]byte, []int) { + return fileDescriptor_relay_aeddd7666fcf4cae, []int{1} } -func (m *MsgToUserResp) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MsgToUserResp.Unmarshal(m, b) +func (m *OnlinePushMsgResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OnlinePushMsgResp.Unmarshal(m, b) } -func (m *MsgToUserResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MsgToUserResp.Marshal(b, m, deterministic) +func (m *OnlinePushMsgResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OnlinePushMsgResp.Marshal(b, m, deterministic) } -func (dst *MsgToUserResp) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgToUserResp.Merge(dst, src) +func (dst *OnlinePushMsgResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_OnlinePushMsgResp.Merge(dst, src) } -func (m *MsgToUserResp) XXX_Size() int { - return xxx_messageInfo_MsgToUserResp.Size(m) +func (m *OnlinePushMsgResp) XXX_Size() int { + return xxx_messageInfo_OnlinePushMsgResp.Size(m) } -func (m *MsgToUserResp) XXX_DiscardUnknown() { - xxx_messageInfo_MsgToUserResp.DiscardUnknown(m) +func (m *OnlinePushMsgResp) XXX_DiscardUnknown() { + xxx_messageInfo_OnlinePushMsgResp.DiscardUnknown(m) } -var xxx_messageInfo_MsgToUserResp proto.InternalMessageInfo +var xxx_messageInfo_OnlinePushMsgResp proto.InternalMessageInfo -func (m *MsgToUserResp) GetResp() []*SingleMsgToUser { +func (m *OnlinePushMsgResp) GetResp() []*SingleMsgToUser { if m != nil { return m.Resp } return nil } -// message SendMsgByWSReq{ -// string SendID = 1; -// string RecvID = 2; -// string Content = 3; -// int64 SendTime = 4; -// int64 MsgFrom = 5; -// int64 ContentType = 6; -// int64 SessionType = 7; -// string OperationID = 8; -// int64 PlatformID = 9; -// } type SingleMsgToUser struct { ResultCode int64 `protobuf:"varint,1,opt,name=ResultCode" json:"ResultCode,omitempty"` RecvID string `protobuf:"bytes,2,opt,name=RecvID" json:"RecvID,omitempty"` @@ -227,7 +121,7 @@ func (m *SingleMsgToUser) Reset() { *m = SingleMsgToUser{} } func (m *SingleMsgToUser) String() string { return proto.CompactTextString(m) } func (*SingleMsgToUser) ProtoMessage() {} func (*SingleMsgToUser) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_709d2b3cc3a7ad83, []int{2} + return fileDescriptor_relay_aeddd7666fcf4cae, []int{2} } func (m *SingleMsgToUser) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SingleMsgToUser.Unmarshal(m, b) @@ -271,6 +165,7 @@ func (m *SingleMsgToUser) GetRecvPlatFormID() int32 { type GetUsersOnlineStatusReq struct { UserIDList []string `protobuf:"bytes,1,rep,name=userIDList" json:"userIDList,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:"-"` @@ -280,7 +175,7 @@ func (m *GetUsersOnlineStatusReq) Reset() { *m = GetUsersOnlineStatusReq func (m *GetUsersOnlineStatusReq) String() string { return proto.CompactTextString(m) } func (*GetUsersOnlineStatusReq) ProtoMessage() {} func (*GetUsersOnlineStatusReq) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_709d2b3cc3a7ad83, []int{3} + return fileDescriptor_relay_aeddd7666fcf4cae, []int{3} } func (m *GetUsersOnlineStatusReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUsersOnlineStatusReq.Unmarshal(m, b) @@ -314,6 +209,13 @@ func (m *GetUsersOnlineStatusReq) GetOperationID() string { return "" } +func (m *GetUsersOnlineStatusReq) GetOpUserID() string { + if m != nil { + return m.OpUserID + } + return "" +} + type GetUsersOnlineStatusResp struct { ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"` ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` @@ -328,7 +230,7 @@ func (m *GetUsersOnlineStatusResp) Reset() { *m = GetUsersOnlineStatusRe func (m *GetUsersOnlineStatusResp) String() string { return proto.CompactTextString(m) } func (*GetUsersOnlineStatusResp) ProtoMessage() {} func (*GetUsersOnlineStatusResp) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_709d2b3cc3a7ad83, []int{4} + return fileDescriptor_relay_aeddd7666fcf4cae, []int{4} } func (m *GetUsersOnlineStatusResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUsersOnlineStatusResp.Unmarshal(m, b) @@ -390,7 +292,7 @@ func (m *GetUsersOnlineStatusResp_SuccessDetail) Reset() { func (m *GetUsersOnlineStatusResp_SuccessDetail) String() string { return proto.CompactTextString(m) } func (*GetUsersOnlineStatusResp_SuccessDetail) ProtoMessage() {} func (*GetUsersOnlineStatusResp_SuccessDetail) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_709d2b3cc3a7ad83, []int{4, 0} + return fileDescriptor_relay_aeddd7666fcf4cae, []int{4, 0} } func (m *GetUsersOnlineStatusResp_SuccessDetail) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUsersOnlineStatusResp_SuccessDetail.Unmarshal(m, b) @@ -437,7 +339,7 @@ func (m *GetUsersOnlineStatusResp_FailedDetail) Reset() { *m = GetUsersO func (m *GetUsersOnlineStatusResp_FailedDetail) String() string { return proto.CompactTextString(m) } func (*GetUsersOnlineStatusResp_FailedDetail) ProtoMessage() {} func (*GetUsersOnlineStatusResp_FailedDetail) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_709d2b3cc3a7ad83, []int{4, 1} + return fileDescriptor_relay_aeddd7666fcf4cae, []int{4, 1} } func (m *GetUsersOnlineStatusResp_FailedDetail) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUsersOnlineStatusResp_FailedDetail.Unmarshal(m, b) @@ -493,7 +395,7 @@ func (m *GetUsersOnlineStatusResp_SuccessResult) Reset() { func (m *GetUsersOnlineStatusResp_SuccessResult) String() string { return proto.CompactTextString(m) } func (*GetUsersOnlineStatusResp_SuccessResult) ProtoMessage() {} func (*GetUsersOnlineStatusResp_SuccessResult) Descriptor() ([]byte, []int) { - return fileDescriptor_relay_709d2b3cc3a7ad83, []int{4, 2} + return fileDescriptor_relay_aeddd7666fcf4cae, []int{4, 2} } func (m *GetUsersOnlineStatusResp_SuccessResult) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUsersOnlineStatusResp_SuccessResult.Unmarshal(m, b) @@ -535,8 +437,8 @@ func (m *GetUsersOnlineStatusResp_SuccessResult) GetDetailPlatformStatus() []*Ge } func init() { - proto.RegisterType((*MsgToUserReq)(nil), "relay.MsgToUserReq") - proto.RegisterType((*MsgToUserResp)(nil), "relay.MsgToUserResp") + proto.RegisterType((*OnlinePushMsgReq)(nil), "relay.OnlinePushMsgReq") + proto.RegisterType((*OnlinePushMsgResp)(nil), "relay.OnlinePushMsgResp") proto.RegisterType((*SingleMsgToUser)(nil), "relay.SingleMsgToUser") proto.RegisterType((*GetUsersOnlineStatusReq)(nil), "relay.GetUsersOnlineStatusReq") proto.RegisterType((*GetUsersOnlineStatusResp)(nil), "relay.GetUsersOnlineStatusResp") @@ -556,7 +458,7 @@ const _ = grpc.SupportPackageIsVersion4 // Client API for OnlineMessageRelayService service type OnlineMessageRelayServiceClient interface { - MsgToUser(ctx context.Context, in *MsgToUserReq, opts ...grpc.CallOption) (*MsgToUserResp, error) + OnlinePushMsg(ctx context.Context, in *OnlinePushMsgReq, opts ...grpc.CallOption) (*OnlinePushMsgResp, error) GetUsersOnlineStatus(ctx context.Context, in *GetUsersOnlineStatusReq, opts ...grpc.CallOption) (*GetUsersOnlineStatusResp, error) } @@ -568,9 +470,9 @@ func NewOnlineMessageRelayServiceClient(cc *grpc.ClientConn) OnlineMessageRelayS return &onlineMessageRelayServiceClient{cc} } -func (c *onlineMessageRelayServiceClient) MsgToUser(ctx context.Context, in *MsgToUserReq, opts ...grpc.CallOption) (*MsgToUserResp, error) { - out := new(MsgToUserResp) - err := grpc.Invoke(ctx, "/relay.OnlineMessageRelayService/MsgToUser", in, out, c.cc, opts...) +func (c *onlineMessageRelayServiceClient) OnlinePushMsg(ctx context.Context, in *OnlinePushMsgReq, opts ...grpc.CallOption) (*OnlinePushMsgResp, error) { + out := new(OnlinePushMsgResp) + err := grpc.Invoke(ctx, "/relay.OnlineMessageRelayService/OnlinePushMsg", in, out, c.cc, opts...) if err != nil { return nil, err } @@ -589,7 +491,7 @@ func (c *onlineMessageRelayServiceClient) GetUsersOnlineStatus(ctx context.Conte // Server API for OnlineMessageRelayService service type OnlineMessageRelayServiceServer interface { - MsgToUser(context.Context, *MsgToUserReq) (*MsgToUserResp, error) + OnlinePushMsg(context.Context, *OnlinePushMsgReq) (*OnlinePushMsgResp, error) GetUsersOnlineStatus(context.Context, *GetUsersOnlineStatusReq) (*GetUsersOnlineStatusResp, error) } @@ -597,20 +499,20 @@ func RegisterOnlineMessageRelayServiceServer(s *grpc.Server, srv OnlineMessageRe s.RegisterService(&_OnlineMessageRelayService_serviceDesc, srv) } -func _OnlineMessageRelayService_MsgToUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgToUserReq) +func _OnlineMessageRelayService_OnlinePushMsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OnlinePushMsgReq) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(OnlineMessageRelayServiceServer).MsgToUser(ctx, in) + return srv.(OnlineMessageRelayServiceServer).OnlinePushMsg(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/relay.OnlineMessageRelayService/MsgToUser", + FullMethod: "/relay.OnlineMessageRelayService/OnlinePushMsg", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(OnlineMessageRelayServiceServer).MsgToUser(ctx, req.(*MsgToUserReq)) + return srv.(OnlineMessageRelayServiceServer).OnlinePushMsg(ctx, req.(*OnlinePushMsgReq)) } return interceptor(ctx, in, info, handler) } @@ -638,8 +540,8 @@ var _OnlineMessageRelayService_serviceDesc = grpc.ServiceDesc{ HandlerType: (*OnlineMessageRelayServiceServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "MsgToUser", - Handler: _OnlineMessageRelayService_MsgToUser_Handler, + MethodName: "OnlinePushMsg", + Handler: _OnlineMessageRelayService_OnlinePushMsg_Handler, }, { MethodName: "GetUsersOnlineStatus", @@ -650,48 +552,42 @@ var _OnlineMessageRelayService_serviceDesc = grpc.ServiceDesc{ Metadata: "relay/relay.proto", } -func init() { proto.RegisterFile("relay/relay.proto", fileDescriptor_relay_709d2b3cc3a7ad83) } +func init() { proto.RegisterFile("relay/relay.proto", fileDescriptor_relay_aeddd7666fcf4cae) } -var fileDescriptor_relay_709d2b3cc3a7ad83 = []byte{ - // 628 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x41, 0x6b, 0xdb, 0x4c, - 0x10, 0x45, 0x9f, 0xe2, 0x24, 0x9e, 0xd8, 0xc9, 0x97, 0x6d, 0x48, 0xb7, 0x3a, 0xa4, 0xc6, 0x94, - 0x60, 0x4a, 0xeb, 0x42, 0x0a, 0xbd, 0xe4, 0x56, 0x0b, 0x17, 0x41, 0x9c, 0x84, 0x95, 0x43, 0x4b, - 0x7b, 0x52, 0xe4, 0x89, 0x11, 0x95, 0x25, 0x79, 0x77, 0x1d, 0xc8, 0xdf, 0xe9, 0xb9, 0xf7, 0x5e, - 0xfb, 0xd3, 0xca, 0xee, 0x4a, 0xf6, 0xda, 0xb5, 0x1b, 0x72, 0x31, 0x7e, 0x6f, 0x66, 0xdf, 0xcc, - 0xbc, 0xd9, 0x15, 0x1c, 0x72, 0x4c, 0xa3, 0x87, 0x77, 0xfa, 0xb7, 0x5b, 0xf0, 0x5c, 0xe6, 0xa4, - 0xa6, 0x41, 0xfb, 0xb7, 0x0b, 0x8d, 0x81, 0x18, 0x0f, 0xf3, 0x1b, 0x81, 0x9c, 0xe1, 0x94, 0x1c, - 0xc3, 0x76, 0x88, 0xd9, 0x28, 0xf0, 0xa9, 0xd3, 0x72, 0x3a, 0x75, 0x56, 0x22, 0xc5, 0x33, 0x8c, - 0xef, 0x03, 0x9f, 0xfe, 0x67, 0x78, 0x83, 0x08, 0x85, 0x9d, 0x5e, 0x9e, 0x49, 0xcc, 0x24, 0xad, - 0xe9, 0x40, 0x05, 0x55, 0x44, 0xe5, 0x84, 0x38, 0xa5, 0xdb, 0x2d, 0xa7, 0xe3, 0xb2, 0x0a, 0x12, - 0x0f, 0x76, 0x95, 0xea, 0x30, 0x99, 0x20, 0xdd, 0xd1, 0xa1, 0x39, 0x56, 0xa7, 0x06, 0x62, 0xdc, - 0xe7, 0xf9, 0x84, 0xee, 0xb6, 0x9c, 0x4e, 0x8d, 0x55, 0x90, 0xb4, 0x60, 0xaf, 0x94, 0x1e, 0x3e, - 0x14, 0x48, 0xeb, 0x3a, 0x6a, 0x53, 0x2a, 0x23, 0x44, 0x21, 0x92, 0x3c, 0xd3, 0x19, 0x60, 0x32, - 0x2c, 0x4a, 0x65, 0x5c, 0x15, 0xc8, 0x23, 0x99, 0xe4, 0x59, 0xe0, 0xd3, 0x3d, 0xdd, 0xb1, 0x4d, - 0x19, 0x0d, 0x7e, 0x8f, 0x7c, 0x20, 0xc6, 0x81, 0x4f, 0x1b, 0x26, 0xc3, 0xa2, 0xc8, 0x09, 0xc0, - 0x75, 0x1a, 0xc9, 0xbb, 0x9c, 0x4f, 0x02, 0x9f, 0x36, 0x75, 0x11, 0x8b, 0x21, 0xa7, 0xb0, 0xaf, - 0xa6, 0x41, 0x7e, 0x99, 0xc4, 0xdf, 0x2f, 0xa3, 0x09, 0xd2, 0x7d, 0x2d, 0xb2, 0xc2, 0x92, 0x57, - 0xd0, 0x34, 0x4c, 0x3f, 0x8a, 0xf1, 0x86, 0x5d, 0xd0, 0x03, 0x9d, 0xb6, 0x4c, 0xea, 0xa9, 0xd3, - 0x04, 0x33, 0x69, 0xfa, 0xf9, 0xdf, 0xf4, 0x63, 0x51, 0xed, 0x73, 0x68, 0x5a, 0x1b, 0x14, 0x05, - 0x79, 0x0d, 0x5b, 0x1c, 0x45, 0x41, 0x9d, 0x96, 0xdb, 0xd9, 0x3b, 0x3b, 0xee, 0x9a, 0xb5, 0x87, - 0x49, 0x36, 0x4e, 0x71, 0x91, 0xa9, 0x73, 0xda, 0x53, 0x38, 0x58, 0x09, 0xa8, 0xf9, 0x18, 0x8a, - 0x59, 0x2a, 0x7b, 0xf9, 0x08, 0xf5, 0x2d, 0x70, 0x99, 0xc5, 0x6c, 0xbc, 0x09, 0xa7, 0xb0, 0xaf, - 0xfe, 0x29, 0x27, 0xfa, 0xc6, 0x1b, 0x57, 0x7b, 0xb3, 0xc2, 0xb6, 0xbf, 0xc1, 0xf3, 0x4f, 0x28, - 0x55, 0x29, 0x71, 0x95, 0xa5, 0x49, 0x86, 0xa1, 0x8c, 0xe4, 0x4c, 0xa8, 0xcb, 0x77, 0x02, 0x30, - 0x13, 0xc8, 0x03, 0xff, 0x22, 0x11, 0x52, 0xf7, 0x5f, 0x67, 0x16, 0xa3, 0xcc, 0xc8, 0xad, 0xf5, - 0x99, 0xfa, 0x36, 0xd5, 0xfe, 0xb5, 0x05, 0x74, 0xbd, 0xba, 0x28, 0xd4, 0xdd, 0x42, 0xce, 0xe7, - 0x63, 0xd5, 0x58, 0x05, 0xd5, 0x4c, 0xc8, 0xd5, 0x7e, 0xab, 0x99, 0x0c, 0x22, 0x21, 0x34, 0xc5, - 0x2c, 0x8e, 0x51, 0x08, 0x63, 0x00, 0x75, 0xb5, 0xa7, 0x6f, 0x4b, 0x4f, 0x37, 0x55, 0xea, 0x86, - 0xf6, 0x21, 0xb6, 0xac, 0x41, 0xae, 0xa1, 0x71, 0x17, 0x25, 0x29, 0x8e, 0x4a, 0xcd, 0x2d, 0xad, - 0xf9, 0xe6, 0x31, 0xcd, 0xbe, 0x3e, 0xe3, 0xa3, 0x8c, 0x92, 0x94, 0x2d, 0x29, 0x78, 0x3d, 0x68, - 0x96, 0x15, 0x4d, 0x58, 0xbd, 0xb0, 0xa2, 0xbc, 0x91, 0xe5, 0x3b, 0x9e, 0x63, 0x35, 0xab, 0xd0, - 0xaa, 0xd5, 0xac, 0x06, 0x79, 0x5f, 0xa0, 0x61, 0x97, 0x50, 0x79, 0xc6, 0x7a, 0xbd, 0xc7, 0x3a, - 0x2b, 0xd1, 0xd3, 0x5d, 0xf4, 0x7e, 0x38, 0xf3, 0xfe, 0x4a, 0x0b, 0x16, 0xda, 0xce, 0x92, 0xf6, - 0x86, 0xde, 0x48, 0x04, 0x47, 0x23, 0xdd, 0x55, 0xf5, 0xce, 0x8c, 0x2f, 0x4f, 0x5c, 0x47, 0xe9, - 0xdd, 0x5a, 0xa9, 0xb3, 0x9f, 0x0e, 0xbc, 0x30, 0x07, 0x07, 0x28, 0x44, 0x34, 0x46, 0xa6, 0x34, - 0xd5, 0xc3, 0x4f, 0x62, 0x24, 0x1f, 0xa0, 0xbe, 0x78, 0x21, 0xcf, 0xca, 0x7a, 0xf6, 0x87, 0xd3, - 0x3b, 0xfa, 0x9b, 0x14, 0x05, 0xf9, 0x0c, 0x47, 0xeb, 0xba, 0x22, 0x27, 0xff, 0x6c, 0x79, 0xea, - 0xbd, 0x7c, 0x64, 0xa4, 0x8f, 0x87, 0x5f, 0x0f, 0xba, 0xe6, 0x83, 0x7e, 0x5e, 0xdc, 0xea, 0x56, - 0x6f, 0xb7, 0xf5, 0x97, 0xfd, 0xfd, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4e, 0xe4, 0x7c, 0xdc, - 0xee, 0x05, 0x00, 0x00, +var fileDescriptor_relay_aeddd7666fcf4cae = []byte{ + // 544 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x5f, 0x6f, 0xd2, 0x50, + 0x14, 0x4f, 0x05, 0x36, 0x39, 0x0c, 0x27, 0x37, 0xcb, 0x56, 0xfb, 0x80, 0xc8, 0x83, 0x21, 0x46, + 0x4b, 0x82, 0xbe, 0xf9, 0x60, 0xb2, 0x35, 0x33, 0x24, 0x36, 0x90, 0x8b, 0x8b, 0xc6, 0x17, 0x72, + 0x07, 0x67, 0xb5, 0xae, 0xd0, 0xcb, 0x3d, 0x2d, 0xc4, 0xaf, 0xe3, 0x97, 0xd0, 0x8f, 0x67, 0x7a, + 0x6f, 0xc1, 0x42, 0x98, 0xcb, 0x5e, 0x08, 0xe7, 0xdc, 0x73, 0x7e, 0xff, 0xda, 0x5e, 0x68, 0x28, + 0x8c, 0xc4, 0xcf, 0xae, 0xfe, 0x75, 0xa5, 0x8a, 0x93, 0x98, 0x55, 0x74, 0xe1, 0xbc, 0x18, 0x48, + 0x9c, 0x8f, 0xfb, 0x7e, 0x57, 0xde, 0x06, 0x5d, 0x7d, 0xd2, 0xa5, 0xe9, 0xed, 0x78, 0x45, 0xdd, + 0x15, 0x99, 0xc9, 0xf6, 0x0f, 0x78, 0x3a, 0x98, 0x47, 0xe1, 0x1c, 0x87, 0x29, 0x7d, 0xf7, 0x29, + 0xe0, 0xb8, 0x60, 0x2d, 0xa8, 0x0d, 0x24, 0x2a, 0x91, 0x84, 0xf1, 0xbc, 0xef, 0xd9, 0x56, 0xcb, + 0xea, 0x54, 0x79, 0xb1, 0xc5, 0xde, 0xc1, 0xe1, 0x8c, 0x02, 0x4f, 0x24, 0xc2, 0x7e, 0xd4, 0xb2, + 0x3a, 0xb5, 0x9e, 0xe3, 0x12, 0xaa, 0x25, 0xaa, 0xb1, 0x90, 0xe1, 0x58, 0x0a, 0x25, 0x66, 0xe4, + 0xfa, 0x66, 0x82, 0xaf, 0x47, 0xdb, 0x1f, 0xa0, 0xb1, 0xc3, 0x45, 0x92, 0xbd, 0x82, 0xb2, 0x42, + 0x92, 0xb6, 0xd5, 0x2a, 0x75, 0x6a, 0xbd, 0x53, 0xd7, 0xd8, 0x18, 0x85, 0xf3, 0x20, 0x42, 0x9f, + 0x82, 0xcf, 0xf1, 0x15, 0xa1, 0xe2, 0x7a, 0xa6, 0xbd, 0x80, 0xe3, 0x9d, 0x03, 0xd6, 0x04, 0xe0, + 0x48, 0x69, 0x94, 0x5c, 0xc4, 0x53, 0xd4, 0x52, 0x4b, 0xbc, 0xd0, 0x61, 0xa7, 0x70, 0xc0, 0x71, + 0xb2, 0xec, 0x7b, 0x5a, 0x68, 0x95, 0xe7, 0x15, 0x7b, 0x09, 0x4f, 0xb2, 0x7f, 0xc3, 0x48, 0x24, + 0x97, 0xb1, 0x9a, 0xf5, 0x3d, 0xbb, 0xd4, 0xb2, 0x3a, 0x15, 0xbe, 0xd3, 0x6d, 0xaf, 0xe0, 0xec, + 0x23, 0x26, 0x19, 0x15, 0x19, 0xed, 0xa3, 0x44, 0x24, 0x29, 0x65, 0x31, 0x35, 0x01, 0x52, 0x42, + 0xd5, 0xf7, 0x3e, 0x85, 0x94, 0x68, 0xfd, 0x55, 0x5e, 0xe8, 0x64, 0x31, 0xc6, 0x85, 0x18, 0x0d, + 0x7f, 0xb1, 0xc5, 0x1c, 0x78, 0x1c, 0xcb, 0x2b, 0xbd, 0xa1, 0xe9, 0xab, 0x7c, 0x53, 0xb7, 0x7f, + 0x97, 0xc1, 0xde, 0xcf, 0x4c, 0x92, 0xd9, 0x70, 0x88, 0x4a, 0x6d, 0x2c, 0x57, 0xf8, 0xba, 0xcc, + 0xfc, 0xa2, 0x52, 0x3e, 0x05, 0x6b, 0xbf, 0xa6, 0x62, 0x23, 0xa8, 0x53, 0x3a, 0x99, 0x20, 0x91, + 0x09, 0xc7, 0x2e, 0xe9, 0xbc, 0xdf, 0xe4, 0x79, 0xdf, 0xc5, 0xe4, 0x8e, 0x8a, 0x4b, 0x7c, 0x1b, + 0x83, 0x0d, 0xe1, 0xe8, 0x46, 0x84, 0x11, 0x4e, 0x73, 0xcc, 0xb2, 0xc6, 0x7c, 0x7d, 0x1f, 0xe6, + 0xa5, 0xde, 0xf1, 0x30, 0x11, 0x61, 0xc4, 0xb7, 0x10, 0x9c, 0x0b, 0xa8, 0xe7, 0x8c, 0xe6, 0x38, + 0x8b, 0x48, 0x46, 0x22, 0xb9, 0x89, 0xd5, 0x2c, 0x7f, 0x11, 0x37, 0x75, 0xe6, 0x95, 0x34, 0xea, + 0xda, 0xab, 0xa9, 0x9c, 0xaf, 0x70, 0x54, 0xa4, 0xc8, 0xe6, 0xd2, 0x62, 0xc8, 0x79, 0xf5, 0xf0, + 0x14, 0x9d, 0x5f, 0xd6, 0x46, 0x5f, 0x1e, 0xc1, 0x3f, 0x6c, 0x6b, 0x0b, 0xfb, 0x0e, 0x6d, 0x4c, + 0xc0, 0xc9, 0x54, 0xab, 0x1a, 0xe6, 0x2e, 0x4c, 0x2e, 0x0f, 0x7c, 0x1c, 0x79, 0x76, 0x7b, 0xa1, + 0x7a, 0x7f, 0x2c, 0x78, 0x66, 0x16, 0x7d, 0x24, 0x12, 0x01, 0xf2, 0x0c, 0x73, 0x84, 0x6a, 0x19, + 0x4e, 0x90, 0x9d, 0x43, 0x7d, 0xeb, 0x23, 0x64, 0x67, 0x39, 0xe7, 0xee, 0x35, 0xe0, 0xd8, 0xfb, + 0x0f, 0x48, 0xb2, 0x2f, 0x70, 0xb2, 0x4f, 0x21, 0x6b, 0xfe, 0x57, 0xfe, 0xc2, 0x79, 0x7e, 0x8f, + 0xbd, 0xf3, 0xc6, 0xb7, 0x63, 0xd7, 0x5c, 0x64, 0xef, 0xe5, 0xb5, 0x96, 0x7d, 0x7d, 0xa0, 0xef, + 0xa9, 0xb7, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x60, 0xd7, 0x1d, 0xf3, 0xe6, 0x04, 0x00, 0x00, } diff --git a/pkg/proto/relay/relay.proto b/pkg/proto/relay/relay.proto index a3464e077..c0149a674 100644 --- a/pkg/proto/relay/relay.proto +++ b/pkg/proto/relay/relay.proto @@ -1,27 +1,15 @@ syntax = "proto3"; +import "Open_IM/pkg/proto/sdk_ws/ws.proto"; option go_package = "./relay;pbRelay"; package relay; -message MsgToUserReq { - string SendID = 1; - string RecvID = 2; - string Content = 5; - int64 RecvSeq = 6; - int64 SendTime = 7; - int32 MsgFrom = 8; - int32 ContentType = 9; - int32 SessionType = 10; - string OperationID = 11; - string ServerMsgID = 12; - int32 PlatformID = 13; - string SenderNickName = 14; - string SenderFaceURL = 15; - string ClientMsgID = 16; +message OnlinePushMsgReq { + string OperationID = 1; + server_api_params.MsgData msgData = 2; } -message MsgToUserResp{ +message OnlinePushMsgResp{ repeated SingleMsgToUser resp = 1; -} -//message SendMsgByWSReq{ +}//message SendMsgByWSReq{ // string SendID = 1; // string RecvID = 2; // string Content = 3; @@ -32,6 +20,7 @@ repeated SingleMsgToUser resp = 1; // string OperationID = 8; // int64 PlatformID = 9; //} + message SingleMsgToUser{ int64 ResultCode = 1; string RecvID = 2; @@ -40,6 +29,7 @@ message SingleMsgToUser{ message GetUsersOnlineStatusReq{ repeated string userIDList = 1; string operationID = 2; + string opUserID = 3; } message GetUsersOnlineStatusResp{ int32 errCode = 1; @@ -63,7 +53,7 @@ message GetUsersOnlineStatusResp{ } } service OnlineMessageRelayService { - rpc MsgToUser(MsgToUserReq) returns(MsgToUserResp); + rpc OnlinePushMsg(OnlinePushMsgReq) returns(OnlinePushMsgResp); rpc GetUsersOnlineStatus(GetUsersOnlineStatusReq)returns(GetUsersOnlineStatusResp); // rpc SendMsgByWS(SendMsgByWSReq) returns(MsgToUserResp); } diff --git a/pkg/proto/sdk_ws/ws.pb.go b/pkg/proto/sdk_ws/ws.pb.go index 5ac2ab6c6..c99165093 100644 --- a/pkg/proto/sdk_ws/ws.pb.go +++ b/pkg/proto/sdk_ws/ws.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: sdk_ws/ws.proto -package open_im_sdk // import "./sdk_ws" +package server_api_params import proto "github.com/golang/protobuf/proto" import fmt "fmt" @@ -18,749 +18,29 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package -type PullMessageBySeqListResp struct { - MaxSeq int64 `protobuf:"varint,1,opt,name=MaxSeq" json:"MaxSeq,omitempty"` - MinSeq int64 `protobuf:"varint,2,opt,name=MinSeq" json:"MinSeq,omitempty"` - SingleUserMsg []*GatherFormat `protobuf:"bytes,3,rep,name=SingleUserMsg" json:"SingleUserMsg,omitempty"` - GroupUserMsg []*GatherFormat `protobuf:"bytes,4,rep,name=GroupUserMsg" json:"GroupUserMsg,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PullMessageBySeqListResp) Reset() { *m = PullMessageBySeqListResp{} } -func (m *PullMessageBySeqListResp) String() string { return proto.CompactTextString(m) } -func (*PullMessageBySeqListResp) ProtoMessage() {} -func (*PullMessageBySeqListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{0} -} -func (m *PullMessageBySeqListResp) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PullMessageBySeqListResp.Unmarshal(m, b) -} -func (m *PullMessageBySeqListResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PullMessageBySeqListResp.Marshal(b, m, deterministic) -} -func (dst *PullMessageBySeqListResp) XXX_Merge(src proto.Message) { - xxx_messageInfo_PullMessageBySeqListResp.Merge(dst, src) -} -func (m *PullMessageBySeqListResp) XXX_Size() int { - return xxx_messageInfo_PullMessageBySeqListResp.Size(m) -} -func (m *PullMessageBySeqListResp) XXX_DiscardUnknown() { - xxx_messageInfo_PullMessageBySeqListResp.DiscardUnknown(m) -} - -var xxx_messageInfo_PullMessageBySeqListResp proto.InternalMessageInfo - -func (m *PullMessageBySeqListResp) GetMaxSeq() int64 { - if m != nil { - return m.MaxSeq - } - return 0 -} - -func (m *PullMessageBySeqListResp) GetMinSeq() int64 { - if m != nil { - return m.MinSeq - } - return 0 -} - -func (m *PullMessageBySeqListResp) GetSingleUserMsg() []*GatherFormat { - if m != nil { - return m.SingleUserMsg - } - return nil -} - -func (m *PullMessageBySeqListResp) GetGroupUserMsg() []*GatherFormat { - if m != nil { - return m.GroupUserMsg - } - return nil -} - -type PullMessageBySeqListReq struct { - SeqList []int64 `protobuf:"varint,1,rep,packed,name=seqList" json:"seqList,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *PullMessageBySeqListReq) Reset() { *m = PullMessageBySeqListReq{} } -func (m *PullMessageBySeqListReq) String() string { return proto.CompactTextString(m) } -func (*PullMessageBySeqListReq) ProtoMessage() {} -func (*PullMessageBySeqListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{1} -} -func (m *PullMessageBySeqListReq) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_PullMessageBySeqListReq.Unmarshal(m, b) -} -func (m *PullMessageBySeqListReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_PullMessageBySeqListReq.Marshal(b, m, deterministic) -} -func (dst *PullMessageBySeqListReq) XXX_Merge(src proto.Message) { - xxx_messageInfo_PullMessageBySeqListReq.Merge(dst, src) -} -func (m *PullMessageBySeqListReq) XXX_Size() int { - return xxx_messageInfo_PullMessageBySeqListReq.Size(m) -} -func (m *PullMessageBySeqListReq) XXX_DiscardUnknown() { - xxx_messageInfo_PullMessageBySeqListReq.DiscardUnknown(m) -} - -var xxx_messageInfo_PullMessageBySeqListReq proto.InternalMessageInfo - -func (m *PullMessageBySeqListReq) GetSeqList() []int64 { - if m != nil { - return m.SeqList - } - return nil -} - -type GetMaxAndMinSeqReq struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetMaxAndMinSeqReq) Reset() { *m = GetMaxAndMinSeqReq{} } -func (m *GetMaxAndMinSeqReq) String() string { return proto.CompactTextString(m) } -func (*GetMaxAndMinSeqReq) ProtoMessage() {} -func (*GetMaxAndMinSeqReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{2} -} -func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b) -} -func (m *GetMaxAndMinSeqReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetMaxAndMinSeqReq.Marshal(b, m, deterministic) -} -func (dst *GetMaxAndMinSeqReq) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetMaxAndMinSeqReq.Merge(dst, src) -} -func (m *GetMaxAndMinSeqReq) XXX_Size() int { - return xxx_messageInfo_GetMaxAndMinSeqReq.Size(m) -} -func (m *GetMaxAndMinSeqReq) XXX_DiscardUnknown() { - xxx_messageInfo_GetMaxAndMinSeqReq.DiscardUnknown(m) -} - -var xxx_messageInfo_GetMaxAndMinSeqReq proto.InternalMessageInfo - -type GetMaxAndMinSeqResp struct { - MaxSeq int64 `protobuf:"varint,1,opt,name=maxSeq" json:"maxSeq,omitempty"` - MinSeq int64 `protobuf:"varint,2,opt,name=minSeq" json:"minSeq,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GetMaxAndMinSeqResp) Reset() { *m = GetMaxAndMinSeqResp{} } -func (m *GetMaxAndMinSeqResp) String() string { return proto.CompactTextString(m) } -func (*GetMaxAndMinSeqResp) ProtoMessage() {} -func (*GetMaxAndMinSeqResp) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{3} -} -func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b) -} -func (m *GetMaxAndMinSeqResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetMaxAndMinSeqResp.Marshal(b, m, deterministic) -} -func (dst *GetMaxAndMinSeqResp) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetMaxAndMinSeqResp.Merge(dst, src) -} -func (m *GetMaxAndMinSeqResp) XXX_Size() int { - return xxx_messageInfo_GetMaxAndMinSeqResp.Size(m) -} -func (m *GetMaxAndMinSeqResp) XXX_DiscardUnknown() { - xxx_messageInfo_GetMaxAndMinSeqResp.DiscardUnknown(m) -} - -var xxx_messageInfo_GetMaxAndMinSeqResp proto.InternalMessageInfo - -func (m *GetMaxAndMinSeqResp) GetMaxSeq() int64 { - if m != nil { - return m.MaxSeq - } - return 0 -} - -func (m *GetMaxAndMinSeqResp) GetMinSeq() int64 { - if m != nil { - return m.MinSeq - } - return 0 -} - -type GatherFormat struct { - // @inject_tag: json:"id" - ID string `protobuf:"bytes,1,opt,name=ID" json:"id"` - // @inject_tag: json:"list" - List []*MsgFormat `protobuf:"bytes,2,rep,name=List" json:"list"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GatherFormat) Reset() { *m = GatherFormat{} } -func (m *GatherFormat) String() string { return proto.CompactTextString(m) } -func (*GatherFormat) ProtoMessage() {} -func (*GatherFormat) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{4} -} -func (m *GatherFormat) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GatherFormat.Unmarshal(m, b) -} -func (m *GatherFormat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GatherFormat.Marshal(b, m, deterministic) -} -func (dst *GatherFormat) XXX_Merge(src proto.Message) { - xxx_messageInfo_GatherFormat.Merge(dst, src) -} -func (m *GatherFormat) XXX_Size() int { - return xxx_messageInfo_GatherFormat.Size(m) -} -func (m *GatherFormat) XXX_DiscardUnknown() { - xxx_messageInfo_GatherFormat.DiscardUnknown(m) -} - -var xxx_messageInfo_GatherFormat proto.InternalMessageInfo - -func (m *GatherFormat) GetID() string { - if m != nil { - return m.ID - } - return "" -} - -func (m *GatherFormat) GetList() []*MsgFormat { - if m != nil { - return m.List - } - return nil -} - -type MsgFormat struct { - // @inject_tag: json:"sendID" - SendID string `protobuf:"bytes,1,opt,name=SendID" json:"sendID"` - // @inject_tag: json:"recvID" - RecvID string `protobuf:"bytes,2,opt,name=RecvID" json:"recvID"` - // @inject_tag: json:"msgFrom" - MsgFrom int32 `protobuf:"varint,3,opt,name=MsgFrom" json:"msgFrom"` - // @inject_tag: json:"contentType" - ContentType int32 `protobuf:"varint,4,opt,name=ContentType" json:"contentType"` - // @inject_tag: json:"serverMsgID" - ServerMsgID string `protobuf:"bytes,5,opt,name=ServerMsgID" json:"serverMsgID"` - // @inject_tag: json:"content" - Content string `protobuf:"bytes,6,opt,name=Content" json:"content"` - // @inject_tag: json:"seq" - Seq int64 `protobuf:"varint,7,opt,name=Seq" json:"seq"` - // @inject_tag: json:"sendTime" - SendTime int64 `protobuf:"varint,8,opt,name=SendTime" json:"sendTime"` - // @inject_tag: json:"senderPlatformID" - SenderPlatformID int32 `protobuf:"varint,9,opt,name=SenderPlatformID" json:"senderPlatformID"` - // @inject_tag: json:"senderNickName" - SenderNickName string `protobuf:"bytes,10,opt,name=SenderNickName" json:"senderNickName"` - // @inject_tag: json:"senderFaceUrl" - SenderFaceURL string `protobuf:"bytes,11,opt,name=SenderFaceURL" json:"senderFaceUrl"` - // @inject_tag: json:"clientMsgID" - ClientMsgID string `protobuf:"bytes,12,opt,name=ClientMsgID" json:"clientMsgID"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MsgFormat) Reset() { *m = MsgFormat{} } -func (m *MsgFormat) String() string { return proto.CompactTextString(m) } -func (*MsgFormat) ProtoMessage() {} -func (*MsgFormat) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{5} -} -func (m *MsgFormat) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MsgFormat.Unmarshal(m, b) -} -func (m *MsgFormat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MsgFormat.Marshal(b, m, deterministic) -} -func (dst *MsgFormat) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgFormat.Merge(dst, src) -} -func (m *MsgFormat) XXX_Size() int { - return xxx_messageInfo_MsgFormat.Size(m) -} -func (m *MsgFormat) XXX_DiscardUnknown() { - xxx_messageInfo_MsgFormat.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgFormat proto.InternalMessageInfo - -func (m *MsgFormat) GetSendID() string { - if m != nil { - return m.SendID - } - return "" -} - -func (m *MsgFormat) GetRecvID() string { - if m != nil { - return m.RecvID - } - return "" -} - -func (m *MsgFormat) GetMsgFrom() int32 { - if m != nil { - return m.MsgFrom - } - return 0 -} - -func (m *MsgFormat) GetContentType() int32 { - if m != nil { - return m.ContentType - } - return 0 -} - -func (m *MsgFormat) GetServerMsgID() string { - if m != nil { - return m.ServerMsgID - } - return "" -} - -func (m *MsgFormat) GetContent() string { - if m != nil { - return m.Content - } - return "" -} - -func (m *MsgFormat) GetSeq() int64 { - if m != nil { - return m.Seq - } - return 0 -} - -func (m *MsgFormat) GetSendTime() int64 { - if m != nil { - return m.SendTime - } - return 0 -} - -func (m *MsgFormat) GetSenderPlatformID() int32 { - if m != nil { - return m.SenderPlatformID - } - return 0 -} - -func (m *MsgFormat) GetSenderNickName() string { - if m != nil { - return m.SenderNickName - } - return "" -} - -func (m *MsgFormat) GetSenderFaceURL() string { - if m != nil { - return m.SenderFaceURL - } - return "" -} - -func (m *MsgFormat) GetClientMsgID() string { - if m != nil { - return m.ClientMsgID - } - return "" -} - -type UserSendMsgReq struct { - Options map[string]int32 `protobuf:"bytes,1,rep,name=Options" json:"Options,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` - SenderNickName string `protobuf:"bytes,2,opt,name=SenderNickName" json:"SenderNickName,omitempty"` - SenderFaceURL string `protobuf:"bytes,3,opt,name=SenderFaceURL" json:"SenderFaceURL,omitempty"` - PlatformID int32 `protobuf:"varint,4,opt,name=PlatformID" json:"PlatformID,omitempty"` - SessionType int32 `protobuf:"varint,5,opt,name=SessionType" json:"SessionType,omitempty"` - MsgFrom int32 `protobuf:"varint,6,opt,name=MsgFrom" json:"MsgFrom,omitempty"` - ContentType int32 `protobuf:"varint,7,opt,name=ContentType" json:"ContentType,omitempty"` - RecvID string `protobuf:"bytes,8,opt,name=RecvID" json:"RecvID,omitempty"` - ForceList []string `protobuf:"bytes,9,rep,name=ForceList" json:"ForceList,omitempty"` - Content string `protobuf:"bytes,10,opt,name=Content" json:"Content,omitempty"` - ClientMsgID string `protobuf:"bytes,11,opt,name=ClientMsgID" json:"ClientMsgID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UserSendMsgReq) Reset() { *m = UserSendMsgReq{} } -func (m *UserSendMsgReq) String() string { return proto.CompactTextString(m) } -func (*UserSendMsgReq) ProtoMessage() {} -func (*UserSendMsgReq) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{6} -} -func (m *UserSendMsgReq) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UserSendMsgReq.Unmarshal(m, b) -} -func (m *UserSendMsgReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UserSendMsgReq.Marshal(b, m, deterministic) -} -func (dst *UserSendMsgReq) XXX_Merge(src proto.Message) { - xxx_messageInfo_UserSendMsgReq.Merge(dst, src) -} -func (m *UserSendMsgReq) XXX_Size() int { - return xxx_messageInfo_UserSendMsgReq.Size(m) -} -func (m *UserSendMsgReq) XXX_DiscardUnknown() { - xxx_messageInfo_UserSendMsgReq.DiscardUnknown(m) -} - -var xxx_messageInfo_UserSendMsgReq proto.InternalMessageInfo - -func (m *UserSendMsgReq) GetOptions() map[string]int32 { - if m != nil { - return m.Options - } - return nil -} - -func (m *UserSendMsgReq) GetSenderNickName() string { - if m != nil { - return m.SenderNickName - } - return "" -} - -func (m *UserSendMsgReq) GetSenderFaceURL() string { - if m != nil { - return m.SenderFaceURL - } - return "" -} - -func (m *UserSendMsgReq) GetPlatformID() int32 { - if m != nil { - return m.PlatformID - } - return 0 -} - -func (m *UserSendMsgReq) GetSessionType() int32 { - if m != nil { - return m.SessionType - } - return 0 -} - -func (m *UserSendMsgReq) GetMsgFrom() int32 { - if m != nil { - return m.MsgFrom - } - return 0 -} - -func (m *UserSendMsgReq) GetContentType() int32 { - if m != nil { - return m.ContentType - } - return 0 -} - -func (m *UserSendMsgReq) GetRecvID() string { - if m != nil { - return m.RecvID - } - return "" -} - -func (m *UserSendMsgReq) GetForceList() []string { - if m != nil { - return m.ForceList - } - return nil -} - -func (m *UserSendMsgReq) GetContent() string { - if m != nil { - return m.Content - } - return "" -} - -func (m *UserSendMsgReq) GetClientMsgID() string { - if m != nil { - return m.ClientMsgID - } - return "" -} - -type UserSendMsgResp struct { - ServerMsgID string `protobuf:"bytes,1,opt,name=ServerMsgID" json:"ServerMsgID,omitempty"` - ClientMsgID string `protobuf:"bytes,2,opt,name=ClientMsgID" json:"ClientMsgID,omitempty"` - SendTime int64 `protobuf:"varint,3,opt,name=sendTime" json:"sendTime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *UserSendMsgResp) Reset() { *m = UserSendMsgResp{} } -func (m *UserSendMsgResp) String() string { return proto.CompactTextString(m) } -func (*UserSendMsgResp) ProtoMessage() {} -func (*UserSendMsgResp) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{7} -} -func (m *UserSendMsgResp) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_UserSendMsgResp.Unmarshal(m, b) -} -func (m *UserSendMsgResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_UserSendMsgResp.Marshal(b, m, deterministic) -} -func (dst *UserSendMsgResp) XXX_Merge(src proto.Message) { - xxx_messageInfo_UserSendMsgResp.Merge(dst, src) -} -func (m *UserSendMsgResp) XXX_Size() int { - return xxx_messageInfo_UserSendMsgResp.Size(m) -} -func (m *UserSendMsgResp) XXX_DiscardUnknown() { - xxx_messageInfo_UserSendMsgResp.DiscardUnknown(m) -} - -var xxx_messageInfo_UserSendMsgResp proto.InternalMessageInfo - -func (m *UserSendMsgResp) GetServerMsgID() string { - if m != nil { - return m.ServerMsgID - } - return "" -} - -func (m *UserSendMsgResp) GetClientMsgID() string { - if m != nil { - return m.ClientMsgID - } - return "" -} - -func (m *UserSendMsgResp) GetSendTime() int64 { - if m != nil { - return m.SendTime - } - return 0 -} - -type MsgData struct { - SendID string `protobuf:"bytes,1,opt,name=sendID" json:"sendID,omitempty"` - RecvID string `protobuf:"bytes,2,opt,name=recvID" json:"recvID,omitempty"` - SessionType int32 `protobuf:"varint,3,opt,name=sessionType" json:"sessionType,omitempty"` - MsgFrom int32 `protobuf:"varint,4,opt,name=msgFrom" json:"msgFrom,omitempty"` - ContentType int32 `protobuf:"varint,5,opt,name=contentType" json:"contentType,omitempty"` - ServerMsgID string `protobuf:"bytes,6,opt,name=serverMsgID" json:"serverMsgID,omitempty"` - Content string `protobuf:"bytes,7,opt,name=content" json:"content,omitempty"` - SendTime int64 `protobuf:"varint,8,opt,name=sendTime" json:"sendTime,omitempty"` - Seq int64 `protobuf:"varint,9,opt,name=seq" json:"seq,omitempty"` - SenderPlatformID int32 `protobuf:"varint,10,opt,name=senderPlatformID" json:"senderPlatformID,omitempty"` - SenderNickName string `protobuf:"bytes,11,opt,name=senderNickName" json:"senderNickName,omitempty"` - SenderFaceURL string `protobuf:"bytes,12,opt,name=senderFaceURL" json:"senderFaceURL,omitempty"` - ClientMsgID string `protobuf:"bytes,13,opt,name=clientMsgID" json:"clientMsgID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MsgData) Reset() { *m = MsgData{} } -func (m *MsgData) String() string { return proto.CompactTextString(m) } -func (*MsgData) ProtoMessage() {} -func (*MsgData) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{8} -} -func (m *MsgData) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MsgData.Unmarshal(m, b) -} -func (m *MsgData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MsgData.Marshal(b, m, deterministic) -} -func (dst *MsgData) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgData.Merge(dst, src) -} -func (m *MsgData) XXX_Size() int { - return xxx_messageInfo_MsgData.Size(m) -} -func (m *MsgData) XXX_DiscardUnknown() { - xxx_messageInfo_MsgData.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgData proto.InternalMessageInfo - -func (m *MsgData) GetSendID() string { - if m != nil { - return m.SendID - } - return "" -} - -func (m *MsgData) GetRecvID() string { - if m != nil { - return m.RecvID - } - return "" -} - -func (m *MsgData) GetSessionType() int32 { - if m != nil { - return m.SessionType - } - return 0 -} - -func (m *MsgData) GetMsgFrom() int32 { - if m != nil { - return m.MsgFrom - } - return 0 -} - -func (m *MsgData) GetContentType() int32 { - if m != nil { - return m.ContentType - } - return 0 -} - -func (m *MsgData) GetServerMsgID() string { - if m != nil { - return m.ServerMsgID - } - return "" -} - -func (m *MsgData) GetContent() string { - if m != nil { - return m.Content - } - return "" -} - -func (m *MsgData) GetSendTime() int64 { - if m != nil { - return m.SendTime - } - return 0 -} - -func (m *MsgData) GetSeq() int64 { - if m != nil { - return m.Seq - } - return 0 -} - -func (m *MsgData) GetSenderPlatformID() int32 { - if m != nil { - return m.SenderPlatformID - } - return 0 -} - -func (m *MsgData) GetSenderNickName() string { - if m != nil { - return m.SenderNickName - } - return "" -} - -func (m *MsgData) GetSenderFaceURL() string { - if m != nil { - return m.SenderFaceURL - } - return "" -} - -func (m *MsgData) GetClientMsgID() string { - if m != nil { - return m.ClientMsgID - } - return "" -} - -type OfflinePushInfo struct { - Title string `protobuf:"bytes,1,opt,name=Title" json:"Title,omitempty"` - Desc string `protobuf:"bytes,2,opt,name=Desc" json:"Desc,omitempty"` - Ext string `protobuf:"bytes,3,opt,name=Ext" json:"Ext,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *OfflinePushInfo) Reset() { *m = OfflinePushInfo{} } -func (m *OfflinePushInfo) String() string { return proto.CompactTextString(m) } -func (*OfflinePushInfo) ProtoMessage() {} -func (*OfflinePushInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{9} -} -func (m *OfflinePushInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OfflinePushInfo.Unmarshal(m, b) -} -func (m *OfflinePushInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OfflinePushInfo.Marshal(b, m, deterministic) -} -func (dst *OfflinePushInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_OfflinePushInfo.Merge(dst, src) -} -func (m *OfflinePushInfo) XXX_Size() int { - return xxx_messageInfo_OfflinePushInfo.Size(m) -} -func (m *OfflinePushInfo) XXX_DiscardUnknown() { - xxx_messageInfo_OfflinePushInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_OfflinePushInfo proto.InternalMessageInfo - -func (m *OfflinePushInfo) GetTitle() string { - if m != nil { - return m.Title - } - return "" -} - -func (m *OfflinePushInfo) GetDesc() string { - if m != nil { - return m.Desc - } - return "" -} - -func (m *OfflinePushInfo) GetExt() string { - if m != nil { - return m.Ext - } - return "" -} - -// public type GroupInfo struct { - GroupID string `protobuf:"bytes,1,opt,name=GroupID" json:"GroupID,omitempty"` - GroupName string `protobuf:"bytes,2,opt,name=GroupName" json:"GroupName,omitempty"` - Notification string `protobuf:"bytes,3,opt,name=Notification" json:"Notification,omitempty"` - Introduction string `protobuf:"bytes,4,opt,name=Introduction" json:"Introduction,omitempty"` - FaceUrl string `protobuf:"bytes,5,opt,name=FaceUrl" json:"FaceUrl,omitempty"` - Ex string `protobuf:"bytes,6,opt,name=Ex" json:"Ex,omitempty"` - Owner *PublicUserInfo `protobuf:"bytes,7,opt,name=Owner" json:"Owner,omitempty"` - CreateTime uint64 `protobuf:"varint,8,opt,name=CreateTime" json:"CreateTime,omitempty"` - MemberCount uint32 `protobuf:"varint,9,opt,name=MemberCount" json:"MemberCount,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + GroupID string `protobuf:"bytes,1,opt,name=groupID" json:"groupID,omitempty"` + GroupName string `protobuf:"bytes,2,opt,name=groupName" json:"groupName,omitempty"` + Notification string `protobuf:"bytes,3,opt,name=notification" json:"notification,omitempty"` + Introduction string `protobuf:"bytes,4,opt,name=introduction" json:"introduction,omitempty"` + FaceURL string `protobuf:"bytes,5,opt,name=faceURL" json:"faceURL,omitempty"` + OwnerUserID string `protobuf:"bytes,6,opt,name=ownerUserID" json:"ownerUserID,omitempty"` + CreateTime uint32 `protobuf:"varint,7,opt,name=createTime" json:"createTime,omitempty"` + MemberCount uint32 `protobuf:"varint,8,opt,name=memberCount" json:"memberCount,omitempty"` + Ex string `protobuf:"bytes,9,opt,name=ex" json:"ex,omitempty"` + Status int32 `protobuf:"varint,10,opt,name=status" json:"status,omitempty"` + CreatorUserID string `protobuf:"bytes,11,opt,name=creatorUserID" json:"creatorUserID,omitempty"` + GroupType int32 `protobuf:"varint,12,opt,name=groupType" json:"groupType,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GroupInfo) Reset() { *m = GroupInfo{} } func (m *GroupInfo) String() string { return proto.CompactTextString(m) } func (*GroupInfo) ProtoMessage() {} func (*GroupInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{10} + return fileDescriptor_ws_dd0597f97f3a9074, []int{0} } func (m *GroupInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupInfo.Unmarshal(m, b) @@ -808,28 +88,21 @@ func (m *GroupInfo) GetIntroduction() string { return "" } -func (m *GroupInfo) GetFaceUrl() string { +func (m *GroupInfo) GetFaceURL() string { if m != nil { - return m.FaceUrl + return m.FaceURL } return "" } -func (m *GroupInfo) GetEx() string { +func (m *GroupInfo) GetOwnerUserID() string { if m != nil { - return m.Ex + return m.OwnerUserID } return "" } -func (m *GroupInfo) GetOwner() *PublicUserInfo { - if m != nil { - return m.Owner - } - return nil -} - -func (m *GroupInfo) GetCreateTime() uint64 { +func (m *GroupInfo) GetCreateTime() uint32 { if m != nil { return m.CreateTime } @@ -843,15 +116,45 @@ func (m *GroupInfo) GetMemberCount() uint32 { return 0 } -// private, Group members have permission to view +func (m *GroupInfo) GetEx() string { + if m != nil { + return m.Ex + } + return "" +} + +func (m *GroupInfo) GetStatus() int32 { + if m != nil { + return m.Status + } + return 0 +} + +func (m *GroupInfo) GetCreatorUserID() string { + if m != nil { + return m.CreatorUserID + } + return "" +} + +func (m *GroupInfo) GetGroupType() int32 { + if m != nil { + return m.GroupType + } + return 0 +} + type GroupMemberFullInfo struct { - GroupID string `protobuf:"bytes,1,opt,name=GroupID" json:"GroupID,omitempty"` - UserID string `protobuf:"bytes,2,opt,name=UserID" json:"UserID,omitempty"` - Role int32 `protobuf:"varint,3,opt,name=Role" json:"Role,omitempty"` - JoinTime uint64 `protobuf:"varint,4,opt,name=JoinTime" json:"JoinTime,omitempty"` - NickName string `protobuf:"bytes,5,opt,name=NickName" json:"NickName,omitempty"` - FaceUrl string `protobuf:"bytes,6,opt,name=FaceUrl" json:"FaceUrl,omitempty"` - FriendRemark string `protobuf:"bytes,7,opt,name=FriendRemark" json:"FriendRemark,omitempty"` + GroupID string `protobuf:"bytes,1,opt,name=groupID" json:"groupID,omitempty"` + UserID string `protobuf:"bytes,2,opt,name=userID" json:"userID,omitempty"` + RoleLevel int32 `protobuf:"varint,3,opt,name=roleLevel" json:"roleLevel,omitempty"` + JoinTime int64 `protobuf:"varint,4,opt,name=joinTime" json:"joinTime,omitempty"` + Nickname string `protobuf:"bytes,5,opt,name=nickname" json:"nickname,omitempty"` + FaceURL string `protobuf:"bytes,6,opt,name=faceURL" json:"faceURL,omitempty"` + AppMangerLevel int32 `protobuf:"varint,7,opt,name=appMangerLevel" json:"appMangerLevel,omitempty"` + JoinSource int32 `protobuf:"varint,8,opt,name=joinSource" json:"joinSource,omitempty"` + OperatorUserID string `protobuf:"bytes,9,opt,name=operatorUserID" json:"operatorUserID,omitempty"` + Ex string `protobuf:"bytes,10,opt,name=ex" json:"ex,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -861,7 +164,7 @@ func (m *GroupMemberFullInfo) Reset() { *m = GroupMemberFullInfo{} } func (m *GroupMemberFullInfo) String() string { return proto.CompactTextString(m) } func (*GroupMemberFullInfo) ProtoMessage() {} func (*GroupMemberFullInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{11} + return fileDescriptor_ws_dd0597f97f3a9074, []int{1} } func (m *GroupMemberFullInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GroupMemberFullInfo.Unmarshal(m, b) @@ -895,142 +198,68 @@ func (m *GroupMemberFullInfo) GetUserID() string { return "" } -func (m *GroupMemberFullInfo) GetRole() int32 { +func (m *GroupMemberFullInfo) GetRoleLevel() int32 { if m != nil { - return m.Role + return m.RoleLevel } return 0 } -func (m *GroupMemberFullInfo) GetJoinTime() uint64 { +func (m *GroupMemberFullInfo) GetJoinTime() int64 { if m != nil { return m.JoinTime } return 0 } -func (m *GroupMemberFullInfo) GetNickName() string { +func (m *GroupMemberFullInfo) GetNickname() string { if m != nil { - return m.NickName + return m.Nickname } return "" } -func (m *GroupMemberFullInfo) GetFaceUrl() string { +func (m *GroupMemberFullInfo) GetFaceURL() string { if m != nil { - return m.FaceUrl + return m.FaceURL } return "" } -func (m *GroupMemberFullInfo) GetFriendRemark() string { +func (m *GroupMemberFullInfo) GetAppMangerLevel() int32 { if m != nil { - return m.FriendRemark - } - return "" -} - -// private, Friends have permission to view -type UserInfo struct { - UserID string `protobuf:"bytes,1,opt,name=UserID" json:"UserID,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_ws_e632726fa8a2c9ae, []int{12} -} -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) GetUserID() string { - if m != nil { - return m.UserID - } - 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 m.AppMangerLevel } return 0 } -func (m *UserInfo) GetMobile() string { +func (m *GroupMemberFullInfo) GetJoinSource() int32 { if m != nil { - return m.Mobile + return m.JoinSource + } + return 0 +} + +func (m *GroupMemberFullInfo) GetOperatorUserID() string { + if m != nil { + return m.OperatorUserID } 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 { +func (m *GroupMemberFullInfo) GetEx() string { if m != nil { return m.Ex } return "" } -// No permissions required type PublicUserInfo struct { - UserID string `protobuf:"bytes,1,opt,name=UserID" json:"UserID,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"` + UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` + Nickname string `protobuf:"bytes,2,opt,name=nickname" json:"nickname,omitempty"` + FaceURL string `protobuf:"bytes,3,opt,name=faceURL" json:"faceURL,omitempty"` + Gender int32 `protobuf:"varint,4,opt,name=gender" json:"gender,omitempty"` + AppMangerLevel int32 `protobuf:"varint,5,opt,name=appMangerLevel" json:"appMangerLevel,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1040,7 +269,7 @@ func (m *PublicUserInfo) Reset() { *m = PublicUserInfo{} } func (m *PublicUserInfo) String() string { return proto.CompactTextString(m) } func (*PublicUserInfo) ProtoMessage() {} func (*PublicUserInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{13} + return fileDescriptor_ws_dd0597f97f3a9074, []int{2} } func (m *PublicUserInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PublicUserInfo.Unmarshal(m, b) @@ -1067,16 +296,16 @@ func (m *PublicUserInfo) GetUserID() string { return "" } -func (m *PublicUserInfo) GetName() string { +func (m *PublicUserInfo) GetNickname() string { if m != nil { - return m.Name + return m.Nickname } return "" } -func (m *PublicUserInfo) GetIcon() string { +func (m *PublicUserInfo) GetFaceURL() string { if m != nil { - return m.Icon + return m.FaceURL } return "" } @@ -1088,633 +317,131 @@ func (m *PublicUserInfo) GetGender() int32 { return 0 } -type TipsComm struct { - Detail string `protobuf:"bytes,1,opt,name=Detail" json:"Detail,omitempty"` - DefaultTips string `protobuf:"bytes,2,opt,name=DefaultTips" json:"DefaultTips,omitempty"` +func (m *PublicUserInfo) GetAppMangerLevel() int32 { + if m != nil { + return m.AppMangerLevel + } + return 0 +} + +type UserInfo struct { + UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` + Nickname string `protobuf:"bytes,2,opt,name=nickname" json:"nickname,omitempty"` + FaceURL string `protobuf:"bytes,3,opt,name=faceURL" json:"faceURL,omitempty"` + Gender int32 `protobuf:"varint,4,opt,name=gender" json:"gender,omitempty"` + PhoneNumber string `protobuf:"bytes,5,opt,name=phoneNumber" json:"phoneNumber,omitempty"` + Birth uint32 `protobuf:"varint,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"` + CreateTime uint32 `protobuf:"varint,9,opt,name=createTime" json:"createTime,omitempty"` + AppMangerLevel int32 `protobuf:"varint,10,opt,name=appMangerLevel" json:"appMangerLevel,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *TipsComm) Reset() { *m = TipsComm{} } -func (m *TipsComm) String() string { return proto.CompactTextString(m) } -func (*TipsComm) ProtoMessage() {} -func (*TipsComm) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{14} +func (m *UserInfo) Reset() { *m = UserInfo{} } +func (m *UserInfo) String() string { return proto.CompactTextString(m) } +func (*UserInfo) ProtoMessage() {} +func (*UserInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{3} } -func (m *TipsComm) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TipsComm.Unmarshal(m, b) +func (m *UserInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UserInfo.Unmarshal(m, b) } -func (m *TipsComm) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TipsComm.Marshal(b, m, deterministic) +func (m *UserInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UserInfo.Marshal(b, m, deterministic) } -func (dst *TipsComm) XXX_Merge(src proto.Message) { - xxx_messageInfo_TipsComm.Merge(dst, src) +func (dst *UserInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_UserInfo.Merge(dst, src) } -func (m *TipsComm) XXX_Size() int { - return xxx_messageInfo_TipsComm.Size(m) +func (m *UserInfo) XXX_Size() int { + return xxx_messageInfo_UserInfo.Size(m) } -func (m *TipsComm) XXX_DiscardUnknown() { - xxx_messageInfo_TipsComm.DiscardUnknown(m) +func (m *UserInfo) XXX_DiscardUnknown() { + xxx_messageInfo_UserInfo.DiscardUnknown(m) } -var xxx_messageInfo_TipsComm proto.InternalMessageInfo +var xxx_messageInfo_UserInfo proto.InternalMessageInfo -func (m *TipsComm) GetDetail() string { +func (m *UserInfo) GetUserID() string { if m != nil { - return m.Detail + return m.UserID } return "" } -func (m *TipsComm) GetDefaultTips() string { +func (m *UserInfo) GetNickname() string { if m != nil { - return m.DefaultTips + return m.Nickname } return "" } -// ////////////////////group///////////////////// -// Actively join the group -type MemberEnterTips struct { - Group *GroupInfo `protobuf:"bytes,1,opt,name=Group" json:"Group,omitempty"` - Member *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=Member" json:"Member,omitempty"` - OperationTime uint64 `protobuf:"varint,3,opt,name=OperationTime" json:"OperationTime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MemberEnterTips) Reset() { *m = MemberEnterTips{} } -func (m *MemberEnterTips) String() string { return proto.CompactTextString(m) } -func (*MemberEnterTips) ProtoMessage() {} -func (*MemberEnterTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{15} -} -func (m *MemberEnterTips) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MemberEnterTips.Unmarshal(m, b) -} -func (m *MemberEnterTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MemberEnterTips.Marshal(b, m, deterministic) -} -func (dst *MemberEnterTips) XXX_Merge(src proto.Message) { - xxx_messageInfo_MemberEnterTips.Merge(dst, src) -} -func (m *MemberEnterTips) XXX_Size() int { - return xxx_messageInfo_MemberEnterTips.Size(m) -} -func (m *MemberEnterTips) XXX_DiscardUnknown() { - xxx_messageInfo_MemberEnterTips.DiscardUnknown(m) -} - -var xxx_messageInfo_MemberEnterTips proto.InternalMessageInfo - -func (m *MemberEnterTips) GetGroup() *GroupInfo { +func (m *UserInfo) GetFaceURL() string { if m != nil { - return m.Group - } - return nil -} - -func (m *MemberEnterTips) GetMember() *GroupMemberFullInfo { - if m != nil { - return m.Member - } - return nil -} - -func (m *MemberEnterTips) GetOperationTime() uint64 { - if m != nil { - return m.OperationTime - } - return 0 -} - -// Actively leave the group -type MemberLeaveTips struct { - Group *GroupInfo `protobuf:"bytes,1,opt,name=Group" json:"Group,omitempty"` - Member *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=Member" json:"Member,omitempty"` - OperationTime uint64 `protobuf:"varint,3,opt,name=OperationTime" json:"OperationTime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MemberLeaveTips) Reset() { *m = MemberLeaveTips{} } -func (m *MemberLeaveTips) String() string { return proto.CompactTextString(m) } -func (*MemberLeaveTips) ProtoMessage() {} -func (*MemberLeaveTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{16} -} -func (m *MemberLeaveTips) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MemberLeaveTips.Unmarshal(m, b) -} -func (m *MemberLeaveTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MemberLeaveTips.Marshal(b, m, deterministic) -} -func (dst *MemberLeaveTips) XXX_Merge(src proto.Message) { - xxx_messageInfo_MemberLeaveTips.Merge(dst, src) -} -func (m *MemberLeaveTips) XXX_Size() int { - return xxx_messageInfo_MemberLeaveTips.Size(m) -} -func (m *MemberLeaveTips) XXX_DiscardUnknown() { - xxx_messageInfo_MemberLeaveTips.DiscardUnknown(m) -} - -var xxx_messageInfo_MemberLeaveTips proto.InternalMessageInfo - -func (m *MemberLeaveTips) GetGroup() *GroupInfo { - if m != nil { - return m.Group - } - return nil -} - -func (m *MemberLeaveTips) GetMember() *GroupMemberFullInfo { - if m != nil { - return m.Member - } - return nil -} - -func (m *MemberLeaveTips) GetOperationTime() uint64 { - if m != nil { - return m.OperationTime - } - return 0 -} - -type MemberInvitedTips struct { - Group *GroupInfo `protobuf:"bytes,1,opt,name=Group" json:"Group,omitempty"` - OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=OpUser" json:"OpUser,omitempty"` - Member *GroupMemberFullInfo `protobuf:"bytes,3,opt,name=Member" json:"Member,omitempty"` - OperationTime uint64 `protobuf:"varint,4,opt,name=OperationTime" json:"OperationTime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MemberInvitedTips) Reset() { *m = MemberInvitedTips{} } -func (m *MemberInvitedTips) String() string { return proto.CompactTextString(m) } -func (*MemberInvitedTips) ProtoMessage() {} -func (*MemberInvitedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{17} -} -func (m *MemberInvitedTips) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MemberInvitedTips.Unmarshal(m, b) -} -func (m *MemberInvitedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MemberInvitedTips.Marshal(b, m, deterministic) -} -func (dst *MemberInvitedTips) XXX_Merge(src proto.Message) { - xxx_messageInfo_MemberInvitedTips.Merge(dst, src) -} -func (m *MemberInvitedTips) XXX_Size() int { - return xxx_messageInfo_MemberInvitedTips.Size(m) -} -func (m *MemberInvitedTips) XXX_DiscardUnknown() { - xxx_messageInfo_MemberInvitedTips.DiscardUnknown(m) -} - -var xxx_messageInfo_MemberInvitedTips proto.InternalMessageInfo - -func (m *MemberInvitedTips) GetGroup() *GroupInfo { - if m != nil { - return m.Group - } - return nil -} - -func (m *MemberInvitedTips) GetOpUser() *GroupMemberFullInfo { - if m != nil { - return m.OpUser - } - return nil -} - -func (m *MemberInvitedTips) GetMember() *GroupMemberFullInfo { - if m != nil { - return m.Member - } - return nil -} - -func (m *MemberInvitedTips) GetOperationTime() uint64 { - if m != nil { - return m.OperationTime - } - return 0 -} - -type MemberKickedTips struct { - Group *GroupInfo `protobuf:"bytes,1,opt,name=Group" json:"Group,omitempty"` - OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=OpUser" json:"OpUser,omitempty"` - Member *GroupMemberFullInfo `protobuf:"bytes,3,opt,name=Member" json:"Member,omitempty"` - OperationTime uint64 `protobuf:"varint,4,opt,name=OperationTime" json:"OperationTime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MemberKickedTips) Reset() { *m = MemberKickedTips{} } -func (m *MemberKickedTips) String() string { return proto.CompactTextString(m) } -func (*MemberKickedTips) ProtoMessage() {} -func (*MemberKickedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{18} -} -func (m *MemberKickedTips) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MemberKickedTips.Unmarshal(m, b) -} -func (m *MemberKickedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MemberKickedTips.Marshal(b, m, deterministic) -} -func (dst *MemberKickedTips) XXX_Merge(src proto.Message) { - xxx_messageInfo_MemberKickedTips.Merge(dst, src) -} -func (m *MemberKickedTips) XXX_Size() int { - return xxx_messageInfo_MemberKickedTips.Size(m) -} -func (m *MemberKickedTips) XXX_DiscardUnknown() { - xxx_messageInfo_MemberKickedTips.DiscardUnknown(m) -} - -var xxx_messageInfo_MemberKickedTips proto.InternalMessageInfo - -func (m *MemberKickedTips) GetGroup() *GroupInfo { - if m != nil { - return m.Group - } - return nil -} - -func (m *MemberKickedTips) GetOpUser() *GroupMemberFullInfo { - if m != nil { - return m.OpUser - } - return nil -} - -func (m *MemberKickedTips) GetMember() *GroupMemberFullInfo { - if m != nil { - return m.Member - } - return nil -} - -func (m *MemberKickedTips) GetOperationTime() uint64 { - if m != nil { - return m.OperationTime - } - return 0 -} - -type GroupMemberChangeInfo struct { - ChangeType int32 `protobuf:"varint,1,opt,name=ChangeType" json:"ChangeType,omitempty"` - OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=OpUser" json:"OpUser,omitempty"` - Member *GroupMemberFullInfo `protobuf:"bytes,3,opt,name=Member" json:"Member,omitempty"` - MuteTime uint64 `protobuf:"varint,4,opt,name=MuteTime" json:"MuteTime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GroupMemberChangeInfo) Reset() { *m = GroupMemberChangeInfo{} } -func (m *GroupMemberChangeInfo) String() string { return proto.CompactTextString(m) } -func (*GroupMemberChangeInfo) ProtoMessage() {} -func (*GroupMemberChangeInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{19} -} -func (m *GroupMemberChangeInfo) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GroupMemberChangeInfo.Unmarshal(m, b) -} -func (m *GroupMemberChangeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GroupMemberChangeInfo.Marshal(b, m, deterministic) -} -func (dst *GroupMemberChangeInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_GroupMemberChangeInfo.Merge(dst, src) -} -func (m *GroupMemberChangeInfo) XXX_Size() int { - return xxx_messageInfo_GroupMemberChangeInfo.Size(m) -} -func (m *GroupMemberChangeInfo) XXX_DiscardUnknown() { - xxx_messageInfo_GroupMemberChangeInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_GroupMemberChangeInfo proto.InternalMessageInfo - -func (m *GroupMemberChangeInfo) GetChangeType() int32 { - if m != nil { - return m.ChangeType - } - return 0 -} - -func (m *GroupMemberChangeInfo) GetOpUser() *GroupMemberFullInfo { - if m != nil { - return m.OpUser - } - return nil -} - -func (m *GroupMemberChangeInfo) GetMember() *GroupMemberFullInfo { - if m != nil { - return m.Member - } - return nil -} - -func (m *GroupMemberChangeInfo) GetMuteTime() uint64 { - if m != nil { - return m.MuteTime - } - return 0 -} - -type MemberInfoChangedTips struct { - Group *GroupInfo `protobuf:"bytes,1,opt,name=Group" json:"Group,omitempty"` - MemberChanged *GroupMemberChangeInfo `protobuf:"bytes,2,opt,name=MemberChanged" json:"MemberChanged,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MemberInfoChangedTips) Reset() { *m = MemberInfoChangedTips{} } -func (m *MemberInfoChangedTips) String() string { return proto.CompactTextString(m) } -func (*MemberInfoChangedTips) ProtoMessage() {} -func (*MemberInfoChangedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{20} -} -func (m *MemberInfoChangedTips) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MemberInfoChangedTips.Unmarshal(m, b) -} -func (m *MemberInfoChangedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MemberInfoChangedTips.Marshal(b, m, deterministic) -} -func (dst *MemberInfoChangedTips) XXX_Merge(src proto.Message) { - xxx_messageInfo_MemberInfoChangedTips.Merge(dst, src) -} -func (m *MemberInfoChangedTips) XXX_Size() int { - return xxx_messageInfo_MemberInfoChangedTips.Size(m) -} -func (m *MemberInfoChangedTips) XXX_DiscardUnknown() { - xxx_messageInfo_MemberInfoChangedTips.DiscardUnknown(m) -} - -var xxx_messageInfo_MemberInfoChangedTips proto.InternalMessageInfo - -func (m *MemberInfoChangedTips) GetGroup() *GroupInfo { - if m != nil { - return m.Group - } - return nil -} - -func (m *MemberInfoChangedTips) GetMemberChanged() *GroupMemberChangeInfo { - if m != nil { - return m.MemberChanged - } - return nil -} - -type GroupCreatedTips struct { - Group *GroupInfo `protobuf:"bytes,1,opt,name=Group" json:"Group,omitempty"` - Creator *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=Creator" json:"Creator,omitempty"` - MemberList []*GroupMemberFullInfo `protobuf:"bytes,3,rep,name=MemberList" json:"MemberList,omitempty"` - OperationTime uint64 `protobuf:"varint,4,opt,name=OperationTime" json:"OperationTime,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GroupCreatedTips) Reset() { *m = GroupCreatedTips{} } -func (m *GroupCreatedTips) String() string { return proto.CompactTextString(m) } -func (*GroupCreatedTips) ProtoMessage() {} -func (*GroupCreatedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{21} -} -func (m *GroupCreatedTips) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GroupCreatedTips.Unmarshal(m, b) -} -func (m *GroupCreatedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GroupCreatedTips.Marshal(b, m, deterministic) -} -func (dst *GroupCreatedTips) XXX_Merge(src proto.Message) { - xxx_messageInfo_GroupCreatedTips.Merge(dst, src) -} -func (m *GroupCreatedTips) XXX_Size() int { - return xxx_messageInfo_GroupCreatedTips.Size(m) -} -func (m *GroupCreatedTips) XXX_DiscardUnknown() { - xxx_messageInfo_GroupCreatedTips.DiscardUnknown(m) -} - -var xxx_messageInfo_GroupCreatedTips proto.InternalMessageInfo - -func (m *GroupCreatedTips) GetGroup() *GroupInfo { - if m != nil { - return m.Group - } - return nil -} - -func (m *GroupCreatedTips) GetCreator() *GroupMemberFullInfo { - if m != nil { - return m.Creator - } - return nil -} - -func (m *GroupCreatedTips) GetMemberList() []*GroupMemberFullInfo { - if m != nil { - return m.MemberList - } - return nil -} - -func (m *GroupCreatedTips) GetOperationTime() uint64 { - if m != nil { - return m.OperationTime - } - return 0 -} - -type GroupInfoChangedTips struct { - ChangedType int32 `protobuf:"varint,1,opt,name=ChangedType" json:"ChangedType,omitempty"` - Group *GroupInfo `protobuf:"bytes,2,opt,name=Group" json:"Group,omitempty"` - OpUser *GroupMemberFullInfo `protobuf:"bytes,3,opt,name=OpUser" json:"OpUser,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *GroupInfoChangedTips) Reset() { *m = GroupInfoChangedTips{} } -func (m *GroupInfoChangedTips) String() string { return proto.CompactTextString(m) } -func (*GroupInfoChangedTips) ProtoMessage() {} -func (*GroupInfoChangedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{22} -} -func (m *GroupInfoChangedTips) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GroupInfoChangedTips.Unmarshal(m, b) -} -func (m *GroupInfoChangedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GroupInfoChangedTips.Marshal(b, m, deterministic) -} -func (dst *GroupInfoChangedTips) XXX_Merge(src proto.Message) { - xxx_messageInfo_GroupInfoChangedTips.Merge(dst, src) -} -func (m *GroupInfoChangedTips) XXX_Size() int { - return xxx_messageInfo_GroupInfoChangedTips.Size(m) -} -func (m *GroupInfoChangedTips) XXX_DiscardUnknown() { - xxx_messageInfo_GroupInfoChangedTips.DiscardUnknown(m) -} - -var xxx_messageInfo_GroupInfoChangedTips proto.InternalMessageInfo - -func (m *GroupInfoChangedTips) GetChangedType() int32 { - if m != nil { - return m.ChangedType - } - return 0 -} - -func (m *GroupInfoChangedTips) GetGroup() *GroupInfo { - if m != nil { - return m.Group - } - return nil -} - -func (m *GroupInfoChangedTips) GetOpUser() *GroupMemberFullInfo { - if m != nil { - return m.OpUser - } - return nil -} - -type ReceiveJoinApplicationTips struct { - Group *GroupInfo `protobuf:"bytes,1,opt,name=Group" json:"Group,omitempty"` - Member *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=Member" json:"Member,omitempty"` - Reason string `protobuf:"bytes,3,opt,name=Reason" json:"Reason,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ReceiveJoinApplicationTips) Reset() { *m = ReceiveJoinApplicationTips{} } -func (m *ReceiveJoinApplicationTips) String() string { return proto.CompactTextString(m) } -func (*ReceiveJoinApplicationTips) ProtoMessage() {} -func (*ReceiveJoinApplicationTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{23} -} -func (m *ReceiveJoinApplicationTips) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReceiveJoinApplicationTips.Unmarshal(m, b) -} -func (m *ReceiveJoinApplicationTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReceiveJoinApplicationTips.Marshal(b, m, deterministic) -} -func (dst *ReceiveJoinApplicationTips) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReceiveJoinApplicationTips.Merge(dst, src) -} -func (m *ReceiveJoinApplicationTips) XXX_Size() int { - return xxx_messageInfo_ReceiveJoinApplicationTips.Size(m) -} -func (m *ReceiveJoinApplicationTips) XXX_DiscardUnknown() { - xxx_messageInfo_ReceiveJoinApplicationTips.DiscardUnknown(m) -} - -var xxx_messageInfo_ReceiveJoinApplicationTips proto.InternalMessageInfo - -func (m *ReceiveJoinApplicationTips) GetGroup() *GroupInfo { - if m != nil { - return m.Group - } - return nil -} - -func (m *ReceiveJoinApplicationTips) GetMember() *GroupMemberFullInfo { - if m != nil { - return m.Member - } - return nil -} - -func (m *ReceiveJoinApplicationTips) GetReason() string { - if m != nil { - return m.Reason + return m.FaceURL } return "" } -type ApplicationProcessedTips struct { - Group *GroupInfo `protobuf:"bytes,1,opt,name=Group" json:"Group,omitempty"` - OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=OpUser" json:"OpUser,omitempty"` - Result int32 `protobuf:"varint,3,opt,name=Result" json:"Result,omitempty"` - Reason string `protobuf:"bytes,4,opt,name=Reason" json:"Reason,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ApplicationProcessedTips) Reset() { *m = ApplicationProcessedTips{} } -func (m *ApplicationProcessedTips) String() string { return proto.CompactTextString(m) } -func (*ApplicationProcessedTips) ProtoMessage() {} -func (*ApplicationProcessedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{24} -} -func (m *ApplicationProcessedTips) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ApplicationProcessedTips.Unmarshal(m, b) -} -func (m *ApplicationProcessedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ApplicationProcessedTips.Marshal(b, m, deterministic) -} -func (dst *ApplicationProcessedTips) XXX_Merge(src proto.Message) { - xxx_messageInfo_ApplicationProcessedTips.Merge(dst, src) -} -func (m *ApplicationProcessedTips) XXX_Size() int { - return xxx_messageInfo_ApplicationProcessedTips.Size(m) -} -func (m *ApplicationProcessedTips) XXX_DiscardUnknown() { - xxx_messageInfo_ApplicationProcessedTips.DiscardUnknown(m) -} - -var xxx_messageInfo_ApplicationProcessedTips proto.InternalMessageInfo - -func (m *ApplicationProcessedTips) GetGroup() *GroupInfo { +func (m *UserInfo) GetGender() int32 { if m != nil { - return m.Group - } - return nil -} - -func (m *ApplicationProcessedTips) GetOpUser() *GroupMemberFullInfo { - if m != nil { - return m.OpUser - } - return nil -} - -func (m *ApplicationProcessedTips) GetResult() int32 { - if m != nil { - return m.Result + return m.Gender } return 0 } -func (m *ApplicationProcessedTips) GetReason() string { +func (m *UserInfo) GetPhoneNumber() string { if m != nil { - return m.Reason + return m.PhoneNumber } return "" } -// ////////////////////friend///////////////////// +func (m *UserInfo) GetBirth() uint32 { + if m != nil { + return m.Birth + } + return 0 +} + +func (m *UserInfo) GetEmail() string { + if m != nil { + return m.Email + } + return "" +} + +func (m *UserInfo) GetEx() string { + if m != nil { + return m.Ex + } + return "" +} + +func (m *UserInfo) GetCreateTime() uint32 { + if m != nil { + return m.CreateTime + } + return 0 +} + +func (m *UserInfo) GetAppMangerLevel() int32 { + if m != nil { + return m.AppMangerLevel + } + return 0 +} + type FriendInfo struct { - OwnerUserID string `protobuf:"bytes,1,opt,name=OwnerUserID" json:"OwnerUserID,omitempty"` - Remark string `protobuf:"bytes,2,opt,name=Remark" json:"Remark,omitempty"` - CreateTime uint64 `protobuf:"varint,3,opt,name=CreateTime" json:"CreateTime,omitempty"` - FriendUserInfo *UserInfo `protobuf:"bytes,4,opt,name=FriendUserInfo" json:"FriendUserInfo,omitempty"` + OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID" json:"ownerUserID,omitempty"` + Remark string `protobuf:"bytes,2,opt,name=remark" json:"remark,omitempty"` + CreateTime uint32 `protobuf:"varint,3,opt,name=createTime" json:"createTime,omitempty"` + FriendUser *UserInfo `protobuf:"bytes,4,opt,name=friendUser" json:"friendUser,omitempty"` + AddSource int32 `protobuf:"varint,5,opt,name=addSource" json:"addSource,omitempty"` + OperatorUserID string `protobuf:"bytes,6,opt,name=operatorUserID" json:"operatorUserID,omitempty"` + Ex string `protobuf:"bytes,7,opt,name=ex" json:"ex,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1724,7 +451,7 @@ func (m *FriendInfo) Reset() { *m = FriendInfo{} } func (m *FriendInfo) String() string { return proto.CompactTextString(m) } func (*FriendInfo) ProtoMessage() {} func (*FriendInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{25} + return fileDescriptor_ws_dd0597f97f3a9074, []int{4} } func (m *FriendInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendInfo.Unmarshal(m, b) @@ -1758,24 +485,1494 @@ func (m *FriendInfo) GetRemark() string { return "" } -func (m *FriendInfo) GetCreateTime() uint64 { +func (m *FriendInfo) GetCreateTime() uint32 { if m != nil { return m.CreateTime } return 0 } -func (m *FriendInfo) GetFriendUserInfo() *UserInfo { +func (m *FriendInfo) GetFriendUser() *UserInfo { if m != nil { - return m.FriendUserInfo + return m.FriendUser } return nil } +func (m *FriendInfo) GetAddSource() int32 { + if m != nil { + return m.AddSource + } + return 0 +} + +func (m *FriendInfo) GetOperatorUserID() string { + if m != nil { + return m.OperatorUserID + } + return "" +} + +func (m *FriendInfo) GetEx() string { + if m != nil { + return m.Ex + } + return "" +} + +type BlackInfo struct { + OwnerUserID string `protobuf:"bytes,1,opt,name=ownerUserID" json:"ownerUserID,omitempty"` + CreateTime uint32 `protobuf:"varint,2,opt,name=createTime" json:"createTime,omitempty"` + BlackUserInfo *PublicUserInfo `protobuf:"bytes,3,opt,name=blackUserInfo" json:"blackUserInfo,omitempty"` + AddSource int32 `protobuf:"varint,4,opt,name=addSource" json:"addSource,omitempty"` + OperatorUserID string `protobuf:"bytes,5,opt,name=operatorUserID" json:"operatorUserID,omitempty"` + Ex string `protobuf:"bytes,6,opt,name=ex" json:"ex,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BlackInfo) Reset() { *m = BlackInfo{} } +func (m *BlackInfo) String() string { return proto.CompactTextString(m) } +func (*BlackInfo) ProtoMessage() {} +func (*BlackInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{5} +} +func (m *BlackInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BlackInfo.Unmarshal(m, b) +} +func (m *BlackInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BlackInfo.Marshal(b, m, deterministic) +} +func (dst *BlackInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlackInfo.Merge(dst, src) +} +func (m *BlackInfo) XXX_Size() int { + return xxx_messageInfo_BlackInfo.Size(m) +} +func (m *BlackInfo) XXX_DiscardUnknown() { + xxx_messageInfo_BlackInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_BlackInfo proto.InternalMessageInfo + +func (m *BlackInfo) GetOwnerUserID() string { + if m != nil { + return m.OwnerUserID + } + return "" +} + +func (m *BlackInfo) GetCreateTime() uint32 { + if m != nil { + return m.CreateTime + } + return 0 +} + +func (m *BlackInfo) GetBlackUserInfo() *PublicUserInfo { + if m != nil { + return m.BlackUserInfo + } + return nil +} + +func (m *BlackInfo) GetAddSource() int32 { + if m != nil { + return m.AddSource + } + return 0 +} + +func (m *BlackInfo) GetOperatorUserID() string { + if m != nil { + return m.OperatorUserID + } + return "" +} + +func (m *BlackInfo) GetEx() string { + if m != nil { + return m.Ex + } + return "" +} + +type GroupRequest struct { + UserInfo *PublicUserInfo `protobuf:"bytes,1,opt,name=userInfo" json:"userInfo,omitempty"` + GroupInfo *GroupInfo `protobuf:"bytes,2,opt,name=groupInfo" json:"groupInfo,omitempty"` + HandleResult int32 `protobuf:"varint,3,opt,name=handleResult" json:"handleResult,omitempty"` + ReqMsg string `protobuf:"bytes,4,opt,name=reqMsg" json:"reqMsg,omitempty"` + HandleMsg string `protobuf:"bytes,5,opt,name=handleMsg" json:"handleMsg,omitempty"` + ReqTime uint32 `protobuf:"varint,6,opt,name=reqTime" json:"reqTime,omitempty"` + HandleUserID string `protobuf:"bytes,7,opt,name=handleUserID" json:"handleUserID,omitempty"` + HandleTime uint32 `protobuf:"varint,8,opt,name=handleTime" json:"handleTime,omitempty"` + Ex string `protobuf:"bytes,9,opt,name=ex" json:"ex,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GroupRequest) Reset() { *m = GroupRequest{} } +func (m *GroupRequest) String() string { return proto.CompactTextString(m) } +func (*GroupRequest) ProtoMessage() {} +func (*GroupRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{6} +} +func (m *GroupRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GroupRequest.Unmarshal(m, b) +} +func (m *GroupRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GroupRequest.Marshal(b, m, deterministic) +} +func (dst *GroupRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GroupRequest.Merge(dst, src) +} +func (m *GroupRequest) XXX_Size() int { + return xxx_messageInfo_GroupRequest.Size(m) +} +func (m *GroupRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GroupRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GroupRequest proto.InternalMessageInfo + +func (m *GroupRequest) GetUserInfo() *PublicUserInfo { + if m != nil { + return m.UserInfo + } + return nil +} + +func (m *GroupRequest) GetGroupInfo() *GroupInfo { + if m != nil { + return m.GroupInfo + } + return nil +} + +func (m *GroupRequest) GetHandleResult() int32 { + if m != nil { + return m.HandleResult + } + return 0 +} + +func (m *GroupRequest) GetReqMsg() string { + if m != nil { + return m.ReqMsg + } + return "" +} + +func (m *GroupRequest) GetHandleMsg() string { + if m != nil { + return m.HandleMsg + } + return "" +} + +func (m *GroupRequest) GetReqTime() uint32 { + if m != nil { + return m.ReqTime + } + return 0 +} + +func (m *GroupRequest) GetHandleUserID() string { + if m != nil { + return m.HandleUserID + } + return "" +} + +func (m *GroupRequest) GetHandleTime() uint32 { + if m != nil { + return m.HandleTime + } + return 0 +} + +func (m *GroupRequest) GetEx() string { + if m != nil { + return m.Ex + } + return "" +} + +type FriendRequest struct { + FromUserID string `protobuf:"bytes,1,opt,name=fromUserID" json:"fromUserID,omitempty"` + FromNickname string `protobuf:"bytes,2,opt,name=fromNickname" json:"fromNickname,omitempty"` + FromFaceURL string `protobuf:"bytes,3,opt,name=fromFaceURL" json:"fromFaceURL,omitempty"` + FromGender int32 `protobuf:"varint,4,opt,name=fromGender" json:"fromGender,omitempty"` + ToUserID string `protobuf:"bytes,5,opt,name=toUserID" json:"toUserID,omitempty"` + ToNickname string `protobuf:"bytes,6,opt,name=toNickname" json:"toNickname,omitempty"` + ToFaceURL string `protobuf:"bytes,7,opt,name=toFaceURL" json:"toFaceURL,omitempty"` + ToGender int32 `protobuf:"varint,8,opt,name=toGender" json:"toGender,omitempty"` + HandleResult int32 `protobuf:"varint,9,opt,name=handleResult" json:"handleResult,omitempty"` + ReqMsg string `protobuf:"bytes,10,opt,name=reqMsg" json:"reqMsg,omitempty"` + CreateTime uint32 `protobuf:"varint,11,opt,name=createTime" json:"createTime,omitempty"` + HandlerUserID string `protobuf:"bytes,12,opt,name=handlerUserID" json:"handlerUserID,omitempty"` + HandleMsg string `protobuf:"bytes,13,opt,name=handleMsg" json:"handleMsg,omitempty"` + HandleTime uint32 `protobuf:"varint,14,opt,name=handleTime" json:"handleTime,omitempty"` + Ex string `protobuf:"bytes,15,opt,name=ex" json:"ex,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FriendRequest) Reset() { *m = FriendRequest{} } +func (m *FriendRequest) String() string { return proto.CompactTextString(m) } +func (*FriendRequest) ProtoMessage() {} +func (*FriendRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{7} +} +func (m *FriendRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FriendRequest.Unmarshal(m, b) +} +func (m *FriendRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FriendRequest.Marshal(b, m, deterministic) +} +func (dst *FriendRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_FriendRequest.Merge(dst, src) +} +func (m *FriendRequest) XXX_Size() int { + return xxx_messageInfo_FriendRequest.Size(m) +} +func (m *FriendRequest) XXX_DiscardUnknown() { + xxx_messageInfo_FriendRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_FriendRequest proto.InternalMessageInfo + +func (m *FriendRequest) GetFromUserID() string { + if m != nil { + return m.FromUserID + } + return "" +} + +func (m *FriendRequest) GetFromNickname() string { + if m != nil { + return m.FromNickname + } + return "" +} + +func (m *FriendRequest) GetFromFaceURL() string { + if m != nil { + return m.FromFaceURL + } + return "" +} + +func (m *FriendRequest) GetFromGender() int32 { + if m != nil { + return m.FromGender + } + return 0 +} + +func (m *FriendRequest) GetToUserID() string { + if m != nil { + return m.ToUserID + } + return "" +} + +func (m *FriendRequest) GetToNickname() string { + if m != nil { + return m.ToNickname + } + return "" +} + +func (m *FriendRequest) GetToFaceURL() string { + if m != nil { + return m.ToFaceURL + } + return "" +} + +func (m *FriendRequest) GetToGender() int32 { + if m != nil { + return m.ToGender + } + return 0 +} + +func (m *FriendRequest) GetHandleResult() int32 { + if m != nil { + return m.HandleResult + } + return 0 +} + +func (m *FriendRequest) GetReqMsg() string { + if m != nil { + return m.ReqMsg + } + return "" +} + +func (m *FriendRequest) GetCreateTime() uint32 { + if m != nil { + return m.CreateTime + } + return 0 +} + +func (m *FriendRequest) GetHandlerUserID() string { + if m != nil { + return m.HandlerUserID + } + return "" +} + +func (m *FriendRequest) GetHandleMsg() string { + if m != nil { + return m.HandleMsg + } + return "" +} + +func (m *FriendRequest) GetHandleTime() uint32 { + if m != nil { + return m.HandleTime + } + return 0 +} + +func (m *FriendRequest) GetEx() string { + if m != nil { + return m.Ex + } + return "" +} + +type PullMessageBySeqListResp struct { + ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"` + ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"` + List []*MsgData `protobuf:"bytes,3,rep,name=list" json:"list,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PullMessageBySeqListResp) Reset() { *m = PullMessageBySeqListResp{} } +func (m *PullMessageBySeqListResp) String() string { return proto.CompactTextString(m) } +func (*PullMessageBySeqListResp) ProtoMessage() {} +func (*PullMessageBySeqListResp) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{8} +} +func (m *PullMessageBySeqListResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PullMessageBySeqListResp.Unmarshal(m, b) +} +func (m *PullMessageBySeqListResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PullMessageBySeqListResp.Marshal(b, m, deterministic) +} +func (dst *PullMessageBySeqListResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_PullMessageBySeqListResp.Merge(dst, src) +} +func (m *PullMessageBySeqListResp) XXX_Size() int { + return xxx_messageInfo_PullMessageBySeqListResp.Size(m) +} +func (m *PullMessageBySeqListResp) XXX_DiscardUnknown() { + xxx_messageInfo_PullMessageBySeqListResp.DiscardUnknown(m) +} + +var xxx_messageInfo_PullMessageBySeqListResp proto.InternalMessageInfo + +func (m *PullMessageBySeqListResp) GetErrCode() int32 { + if m != nil { + return m.ErrCode + } + return 0 +} + +func (m *PullMessageBySeqListResp) GetErrMsg() string { + if m != nil { + return m.ErrMsg + } + return "" +} + +func (m *PullMessageBySeqListResp) GetList() []*MsgData { + if m != nil { + return m.List + } + return nil +} + +type PullMessageBySeqListReq struct { + UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` + OperationID string `protobuf:"bytes,2,opt,name=operationID" json:"operationID,omitempty"` + SeqList []uint32 `protobuf:"varint,3,rep,packed,name=seqList" json:"seqList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *PullMessageBySeqListReq) Reset() { *m = PullMessageBySeqListReq{} } +func (m *PullMessageBySeqListReq) String() string { return proto.CompactTextString(m) } +func (*PullMessageBySeqListReq) ProtoMessage() {} +func (*PullMessageBySeqListReq) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{9} +} +func (m *PullMessageBySeqListReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_PullMessageBySeqListReq.Unmarshal(m, b) +} +func (m *PullMessageBySeqListReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_PullMessageBySeqListReq.Marshal(b, m, deterministic) +} +func (dst *PullMessageBySeqListReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_PullMessageBySeqListReq.Merge(dst, src) +} +func (m *PullMessageBySeqListReq) XXX_Size() int { + return xxx_messageInfo_PullMessageBySeqListReq.Size(m) +} +func (m *PullMessageBySeqListReq) XXX_DiscardUnknown() { + xxx_messageInfo_PullMessageBySeqListReq.DiscardUnknown(m) +} + +var xxx_messageInfo_PullMessageBySeqListReq proto.InternalMessageInfo + +func (m *PullMessageBySeqListReq) GetUserID() string { + if m != nil { + return m.UserID + } + return "" +} + +func (m *PullMessageBySeqListReq) GetOperationID() string { + if m != nil { + return m.OperationID + } + return "" +} + +func (m *PullMessageBySeqListReq) GetSeqList() []uint32 { + if m != nil { + return m.SeqList + } + return nil +} + +type GetMaxAndMinSeqReq struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetMaxAndMinSeqReq) Reset() { *m = GetMaxAndMinSeqReq{} } +func (m *GetMaxAndMinSeqReq) String() string { return proto.CompactTextString(m) } +func (*GetMaxAndMinSeqReq) ProtoMessage() {} +func (*GetMaxAndMinSeqReq) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{10} +} +func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b) +} +func (m *GetMaxAndMinSeqReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetMaxAndMinSeqReq.Marshal(b, m, deterministic) +} +func (dst *GetMaxAndMinSeqReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetMaxAndMinSeqReq.Merge(dst, src) +} +func (m *GetMaxAndMinSeqReq) XXX_Size() int { + return xxx_messageInfo_GetMaxAndMinSeqReq.Size(m) +} +func (m *GetMaxAndMinSeqReq) XXX_DiscardUnknown() { + xxx_messageInfo_GetMaxAndMinSeqReq.DiscardUnknown(m) +} + +var xxx_messageInfo_GetMaxAndMinSeqReq proto.InternalMessageInfo + +type GetMaxAndMinSeqResp struct { + MaxSeq uint32 `protobuf:"varint,1,opt,name=maxSeq" json:"maxSeq,omitempty"` + MinSeq uint32 `protobuf:"varint,2,opt,name=minSeq" json:"minSeq,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetMaxAndMinSeqResp) Reset() { *m = GetMaxAndMinSeqResp{} } +func (m *GetMaxAndMinSeqResp) String() string { return proto.CompactTextString(m) } +func (*GetMaxAndMinSeqResp) ProtoMessage() {} +func (*GetMaxAndMinSeqResp) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{11} +} +func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b) +} +func (m *GetMaxAndMinSeqResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetMaxAndMinSeqResp.Marshal(b, m, deterministic) +} +func (dst *GetMaxAndMinSeqResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetMaxAndMinSeqResp.Merge(dst, src) +} +func (m *GetMaxAndMinSeqResp) XXX_Size() int { + return xxx_messageInfo_GetMaxAndMinSeqResp.Size(m) +} +func (m *GetMaxAndMinSeqResp) XXX_DiscardUnknown() { + xxx_messageInfo_GetMaxAndMinSeqResp.DiscardUnknown(m) +} + +var xxx_messageInfo_GetMaxAndMinSeqResp proto.InternalMessageInfo + +func (m *GetMaxAndMinSeqResp) GetMaxSeq() uint32 { + if m != nil { + return m.MaxSeq + } + return 0 +} + +func (m *GetMaxAndMinSeqResp) GetMinSeq() uint32 { + if m != nil { + return m.MinSeq + } + return 0 +} + +type UserSendMsgResp struct { + ServerMsgID string `protobuf:"bytes,1,opt,name=serverMsgID" json:"serverMsgID,omitempty"` + ClientMsgID string `protobuf:"bytes,2,opt,name=clientMsgID" json:"clientMsgID,omitempty"` + SendTime int64 `protobuf:"varint,3,opt,name=sendTime" json:"sendTime,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UserSendMsgResp) Reset() { *m = UserSendMsgResp{} } +func (m *UserSendMsgResp) String() string { return proto.CompactTextString(m) } +func (*UserSendMsgResp) ProtoMessage() {} +func (*UserSendMsgResp) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{12} +} +func (m *UserSendMsgResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UserSendMsgResp.Unmarshal(m, b) +} +func (m *UserSendMsgResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UserSendMsgResp.Marshal(b, m, deterministic) +} +func (dst *UserSendMsgResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_UserSendMsgResp.Merge(dst, src) +} +func (m *UserSendMsgResp) XXX_Size() int { + return xxx_messageInfo_UserSendMsgResp.Size(m) +} +func (m *UserSendMsgResp) XXX_DiscardUnknown() { + xxx_messageInfo_UserSendMsgResp.DiscardUnknown(m) +} + +var xxx_messageInfo_UserSendMsgResp proto.InternalMessageInfo + +func (m *UserSendMsgResp) GetServerMsgID() string { + if m != nil { + return m.ServerMsgID + } + return "" +} + +func (m *UserSendMsgResp) GetClientMsgID() string { + if m != nil { + return m.ClientMsgID + } + return "" +} + +func (m *UserSendMsgResp) GetSendTime() int64 { + if m != nil { + return m.SendTime + } + return 0 +} + +type MsgData struct { + SendID string `protobuf:"bytes,1,opt,name=sendID" json:"sendID,omitempty"` + RecvID string `protobuf:"bytes,2,opt,name=recvID" json:"recvID,omitempty"` + GroupID string `protobuf:"bytes,3,opt,name=groupID" json:"groupID,omitempty"` + ClientMsgID string `protobuf:"bytes,4,opt,name=clientMsgID" json:"clientMsgID,omitempty"` + ServerMsgID string `protobuf:"bytes,5,opt,name=serverMsgID" json:"serverMsgID,omitempty"` + SenderPlatformID int32 `protobuf:"varint,6,opt,name=senderPlatformID" json:"senderPlatformID,omitempty"` + SenderNickname string `protobuf:"bytes,7,opt,name=senderNickname" json:"senderNickname,omitempty"` + SenderFaceURL string `protobuf:"bytes,8,opt,name=senderFaceURL" json:"senderFaceURL,omitempty"` + SessionType int32 `protobuf:"varint,9,opt,name=sessionType" json:"sessionType,omitempty"` + MsgFrom int32 `protobuf:"varint,10,opt,name=msgFrom" json:"msgFrom,omitempty"` + ContentType int32 `protobuf:"varint,11,opt,name=contentType" json:"contentType,omitempty"` + Content []byte `protobuf:"bytes,12,opt,name=content,proto3" json:"content,omitempty"` + Seq uint32 `protobuf:"varint,14,opt,name=seq" json:"seq,omitempty"` + SendTime int64 `protobuf:"varint,15,opt,name=sendTime" json:"sendTime,omitempty"` + CreateTime int64 `protobuf:"varint,16,opt,name=createTime" json:"createTime,omitempty"` + Status int32 `protobuf:"varint,17,opt,name=status" json:"status,omitempty"` + Options map[string]bool `protobuf:"bytes,18,rep,name=options" json:"options,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` + OfflinePushInfo *OfflinePushInfo `protobuf:"bytes,19,opt,name=offlinePushInfo" json:"offlinePushInfo,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MsgData) Reset() { *m = MsgData{} } +func (m *MsgData) String() string { return proto.CompactTextString(m) } +func (*MsgData) ProtoMessage() {} +func (*MsgData) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{13} +} +func (m *MsgData) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MsgData.Unmarshal(m, b) +} +func (m *MsgData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MsgData.Marshal(b, m, deterministic) +} +func (dst *MsgData) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgData.Merge(dst, src) +} +func (m *MsgData) XXX_Size() int { + return xxx_messageInfo_MsgData.Size(m) +} +func (m *MsgData) XXX_DiscardUnknown() { + xxx_messageInfo_MsgData.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgData proto.InternalMessageInfo + +func (m *MsgData) GetSendID() string { + if m != nil { + return m.SendID + } + return "" +} + +func (m *MsgData) GetRecvID() string { + if m != nil { + return m.RecvID + } + return "" +} + +func (m *MsgData) GetGroupID() string { + if m != nil { + return m.GroupID + } + return "" +} + +func (m *MsgData) GetClientMsgID() string { + if m != nil { + return m.ClientMsgID + } + return "" +} + +func (m *MsgData) GetServerMsgID() string { + if m != nil { + return m.ServerMsgID + } + return "" +} + +func (m *MsgData) GetSenderPlatformID() int32 { + if m != nil { + return m.SenderPlatformID + } + return 0 +} + +func (m *MsgData) GetSenderNickname() string { + if m != nil { + return m.SenderNickname + } + return "" +} + +func (m *MsgData) GetSenderFaceURL() string { + if m != nil { + return m.SenderFaceURL + } + return "" +} + +func (m *MsgData) GetSessionType() int32 { + if m != nil { + return m.SessionType + } + return 0 +} + +func (m *MsgData) GetMsgFrom() int32 { + if m != nil { + return m.MsgFrom + } + return 0 +} + +func (m *MsgData) GetContentType() int32 { + if m != nil { + return m.ContentType + } + return 0 +} + +func (m *MsgData) GetContent() []byte { + if m != nil { + return m.Content + } + return nil +} + +func (m *MsgData) GetSeq() uint32 { + if m != nil { + return m.Seq + } + return 0 +} + +func (m *MsgData) GetSendTime() int64 { + if m != nil { + return m.SendTime + } + return 0 +} + +func (m *MsgData) GetCreateTime() int64 { + if m != nil { + return m.CreateTime + } + return 0 +} + +func (m *MsgData) GetStatus() int32 { + if m != nil { + return m.Status + } + return 0 +} + +func (m *MsgData) GetOptions() map[string]bool { + if m != nil { + return m.Options + } + return nil +} + +func (m *MsgData) GetOfflinePushInfo() *OfflinePushInfo { + if m != nil { + return m.OfflinePushInfo + } + return nil +} + +type OfflinePushInfo struct { + Title string `protobuf:"bytes,1,opt,name=title" json:"title,omitempty"` + Desc string `protobuf:"bytes,2,opt,name=desc" json:"desc,omitempty"` + Ex string `protobuf:"bytes,3,opt,name=ex" json:"ex,omitempty"` + IOSPushSound string `protobuf:"bytes,4,opt,name=iOSPushSound" json:"iOSPushSound,omitempty"` + IOSBadgeCount bool `protobuf:"varint,5,opt,name=iOSBadgeCount" json:"iOSBadgeCount,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OfflinePushInfo) Reset() { *m = OfflinePushInfo{} } +func (m *OfflinePushInfo) String() string { return proto.CompactTextString(m) } +func (*OfflinePushInfo) ProtoMessage() {} +func (*OfflinePushInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{14} +} +func (m *OfflinePushInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OfflinePushInfo.Unmarshal(m, b) +} +func (m *OfflinePushInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OfflinePushInfo.Marshal(b, m, deterministic) +} +func (dst *OfflinePushInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_OfflinePushInfo.Merge(dst, src) +} +func (m *OfflinePushInfo) XXX_Size() int { + return xxx_messageInfo_OfflinePushInfo.Size(m) +} +func (m *OfflinePushInfo) XXX_DiscardUnknown() { + xxx_messageInfo_OfflinePushInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_OfflinePushInfo proto.InternalMessageInfo + +func (m *OfflinePushInfo) GetTitle() string { + if m != nil { + return m.Title + } + return "" +} + +func (m *OfflinePushInfo) GetDesc() string { + if m != nil { + return m.Desc + } + return "" +} + +func (m *OfflinePushInfo) GetEx() string { + if m != nil { + return m.Ex + } + return "" +} + +func (m *OfflinePushInfo) GetIOSPushSound() string { + if m != nil { + return m.IOSPushSound + } + return "" +} + +func (m *OfflinePushInfo) GetIOSBadgeCount() bool { + if m != nil { + return m.IOSBadgeCount + } + return false +} + +type TipsComm struct { + Detail []byte `protobuf:"bytes,1,opt,name=detail,proto3" json:"detail,omitempty"` + DefaultTips string `protobuf:"bytes,2,opt,name=defaultTips" json:"defaultTips,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TipsComm) Reset() { *m = TipsComm{} } +func (m *TipsComm) String() string { return proto.CompactTextString(m) } +func (*TipsComm) ProtoMessage() {} +func (*TipsComm) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{15} +} +func (m *TipsComm) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TipsComm.Unmarshal(m, b) +} +func (m *TipsComm) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TipsComm.Marshal(b, m, deterministic) +} +func (dst *TipsComm) XXX_Merge(src proto.Message) { + xxx_messageInfo_TipsComm.Merge(dst, src) +} +func (m *TipsComm) XXX_Size() int { + return xxx_messageInfo_TipsComm.Size(m) +} +func (m *TipsComm) XXX_DiscardUnknown() { + xxx_messageInfo_TipsComm.DiscardUnknown(m) +} + +var xxx_messageInfo_TipsComm proto.InternalMessageInfo + +func (m *TipsComm) GetDetail() []byte { + if m != nil { + return m.Detail + } + return nil +} + +func (m *TipsComm) GetDefaultTips() string { + if m != nil { + return m.DefaultTips + } + return "" +} + +// OnGroupCreated() +type GroupCreatedTips struct { + Group *GroupInfo `protobuf:"bytes,1,opt,name=group" json:"group,omitempty"` + OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser" json:"opUser,omitempty"` + MemberList []*GroupMemberFullInfo `protobuf:"bytes,3,rep,name=memberList" json:"memberList,omitempty"` + OperationTime int64 `protobuf:"varint,4,opt,name=operationTime" json:"operationTime,omitempty"` + GroupOwnerUser *GroupMemberFullInfo `protobuf:"bytes,5,opt,name=groupOwnerUser" json:"groupOwnerUser,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GroupCreatedTips) Reset() { *m = GroupCreatedTips{} } +func (m *GroupCreatedTips) String() string { return proto.CompactTextString(m) } +func (*GroupCreatedTips) ProtoMessage() {} +func (*GroupCreatedTips) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{16} +} +func (m *GroupCreatedTips) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GroupCreatedTips.Unmarshal(m, b) +} +func (m *GroupCreatedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GroupCreatedTips.Marshal(b, m, deterministic) +} +func (dst *GroupCreatedTips) XXX_Merge(src proto.Message) { + xxx_messageInfo_GroupCreatedTips.Merge(dst, src) +} +func (m *GroupCreatedTips) XXX_Size() int { + return xxx_messageInfo_GroupCreatedTips.Size(m) +} +func (m *GroupCreatedTips) XXX_DiscardUnknown() { + xxx_messageInfo_GroupCreatedTips.DiscardUnknown(m) +} + +var xxx_messageInfo_GroupCreatedTips proto.InternalMessageInfo + +func (m *GroupCreatedTips) GetGroup() *GroupInfo { + if m != nil { + return m.Group + } + return nil +} + +func (m *GroupCreatedTips) GetOpUser() *GroupMemberFullInfo { + if m != nil { + return m.OpUser + } + return nil +} + +func (m *GroupCreatedTips) GetMemberList() []*GroupMemberFullInfo { + if m != nil { + return m.MemberList + } + return nil +} + +func (m *GroupCreatedTips) GetOperationTime() int64 { + if m != nil { + return m.OperationTime + } + return 0 +} + +func (m *GroupCreatedTips) GetGroupOwnerUser() *GroupMemberFullInfo { + if m != nil { + return m.GroupOwnerUser + } + return nil +} + +// OnGroupInfoSet() +type GroupInfoSetTips struct { + OpUser *GroupMemberFullInfo `protobuf:"bytes,1,opt,name=opUser" json:"opUser,omitempty"` + MuteTime int64 `protobuf:"varint,2,opt,name=muteTime" json:"muteTime,omitempty"` + Group *GroupInfo `protobuf:"bytes,3,opt,name=group" json:"group,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GroupInfoSetTips) Reset() { *m = GroupInfoSetTips{} } +func (m *GroupInfoSetTips) String() string { return proto.CompactTextString(m) } +func (*GroupInfoSetTips) ProtoMessage() {} +func (*GroupInfoSetTips) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{17} +} +func (m *GroupInfoSetTips) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GroupInfoSetTips.Unmarshal(m, b) +} +func (m *GroupInfoSetTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GroupInfoSetTips.Marshal(b, m, deterministic) +} +func (dst *GroupInfoSetTips) XXX_Merge(src proto.Message) { + xxx_messageInfo_GroupInfoSetTips.Merge(dst, src) +} +func (m *GroupInfoSetTips) XXX_Size() int { + return xxx_messageInfo_GroupInfoSetTips.Size(m) +} +func (m *GroupInfoSetTips) XXX_DiscardUnknown() { + xxx_messageInfo_GroupInfoSetTips.DiscardUnknown(m) +} + +var xxx_messageInfo_GroupInfoSetTips proto.InternalMessageInfo + +func (m *GroupInfoSetTips) GetOpUser() *GroupMemberFullInfo { + if m != nil { + return m.OpUser + } + return nil +} + +func (m *GroupInfoSetTips) GetMuteTime() int64 { + if m != nil { + return m.MuteTime + } + return 0 +} + +func (m *GroupInfoSetTips) GetGroup() *GroupInfo { + if m != nil { + return m.Group + } + return nil +} + +// OnJoinGroupApplication() +type JoinGroupApplicationTips struct { + Group *GroupInfo `protobuf:"bytes,1,opt,name=group" json:"group,omitempty"` + Applicant *PublicUserInfo `protobuf:"bytes,2,opt,name=applicant" json:"applicant,omitempty"` + ReqMsg string `protobuf:"bytes,3,opt,name=reqMsg" json:"reqMsg,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *JoinGroupApplicationTips) Reset() { *m = JoinGroupApplicationTips{} } +func (m *JoinGroupApplicationTips) String() string { return proto.CompactTextString(m) } +func (*JoinGroupApplicationTips) ProtoMessage() {} +func (*JoinGroupApplicationTips) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{18} +} +func (m *JoinGroupApplicationTips) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_JoinGroupApplicationTips.Unmarshal(m, b) +} +func (m *JoinGroupApplicationTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_JoinGroupApplicationTips.Marshal(b, m, deterministic) +} +func (dst *JoinGroupApplicationTips) XXX_Merge(src proto.Message) { + xxx_messageInfo_JoinGroupApplicationTips.Merge(dst, src) +} +func (m *JoinGroupApplicationTips) XXX_Size() int { + return xxx_messageInfo_JoinGroupApplicationTips.Size(m) +} +func (m *JoinGroupApplicationTips) XXX_DiscardUnknown() { + xxx_messageInfo_JoinGroupApplicationTips.DiscardUnknown(m) +} + +var xxx_messageInfo_JoinGroupApplicationTips proto.InternalMessageInfo + +func (m *JoinGroupApplicationTips) GetGroup() *GroupInfo { + if m != nil { + return m.Group + } + return nil +} + +func (m *JoinGroupApplicationTips) GetApplicant() *PublicUserInfo { + if m != nil { + return m.Applicant + } + return nil +} + +func (m *JoinGroupApplicationTips) GetReqMsg() string { + if m != nil { + return m.ReqMsg + } + return "" +} + +// OnQuitGroup() +// Actively leave the group +type MemberQuitTips struct { + Group *GroupInfo `protobuf:"bytes,1,opt,name=group" json:"group,omitempty"` + QuitUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=quitUser" json:"quitUser,omitempty"` + OperationTime int64 `protobuf:"varint,3,opt,name=operationTime" json:"operationTime,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemberQuitTips) Reset() { *m = MemberQuitTips{} } +func (m *MemberQuitTips) String() string { return proto.CompactTextString(m) } +func (*MemberQuitTips) ProtoMessage() {} +func (*MemberQuitTips) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{19} +} +func (m *MemberQuitTips) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemberQuitTips.Unmarshal(m, b) +} +func (m *MemberQuitTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemberQuitTips.Marshal(b, m, deterministic) +} +func (dst *MemberQuitTips) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemberQuitTips.Merge(dst, src) +} +func (m *MemberQuitTips) XXX_Size() int { + return xxx_messageInfo_MemberQuitTips.Size(m) +} +func (m *MemberQuitTips) XXX_DiscardUnknown() { + xxx_messageInfo_MemberQuitTips.DiscardUnknown(m) +} + +var xxx_messageInfo_MemberQuitTips proto.InternalMessageInfo + +func (m *MemberQuitTips) GetGroup() *GroupInfo { + if m != nil { + return m.Group + } + return nil +} + +func (m *MemberQuitTips) GetQuitUser() *GroupMemberFullInfo { + if m != nil { + return m.QuitUser + } + return nil +} + +func (m *MemberQuitTips) GetOperationTime() int64 { + if m != nil { + return m.OperationTime + } + return 0 +} + +// OnApplicationGroupAccepted() +type GroupApplicationAcceptedTips struct { + Group *GroupInfo `protobuf:"bytes,1,opt,name=group" json:"group,omitempty"` + OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser" json:"opUser,omitempty"` + HandleMsg string `protobuf:"bytes,4,opt,name=handleMsg" json:"handleMsg,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GroupApplicationAcceptedTips) Reset() { *m = GroupApplicationAcceptedTips{} } +func (m *GroupApplicationAcceptedTips) String() string { return proto.CompactTextString(m) } +func (*GroupApplicationAcceptedTips) ProtoMessage() {} +func (*GroupApplicationAcceptedTips) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{20} +} +func (m *GroupApplicationAcceptedTips) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GroupApplicationAcceptedTips.Unmarshal(m, b) +} +func (m *GroupApplicationAcceptedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GroupApplicationAcceptedTips.Marshal(b, m, deterministic) +} +func (dst *GroupApplicationAcceptedTips) XXX_Merge(src proto.Message) { + xxx_messageInfo_GroupApplicationAcceptedTips.Merge(dst, src) +} +func (m *GroupApplicationAcceptedTips) XXX_Size() int { + return xxx_messageInfo_GroupApplicationAcceptedTips.Size(m) +} +func (m *GroupApplicationAcceptedTips) XXX_DiscardUnknown() { + xxx_messageInfo_GroupApplicationAcceptedTips.DiscardUnknown(m) +} + +var xxx_messageInfo_GroupApplicationAcceptedTips proto.InternalMessageInfo + +func (m *GroupApplicationAcceptedTips) GetGroup() *GroupInfo { + if m != nil { + return m.Group + } + return nil +} + +func (m *GroupApplicationAcceptedTips) GetOpUser() *GroupMemberFullInfo { + if m != nil { + return m.OpUser + } + return nil +} + +func (m *GroupApplicationAcceptedTips) GetHandleMsg() string { + if m != nil { + return m.HandleMsg + } + return "" +} + +// OnApplicationGroupRejected() +type GroupApplicationRejectedTips struct { + Group *GroupInfo `protobuf:"bytes,1,opt,name=group" json:"group,omitempty"` + OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser" json:"opUser,omitempty"` + HandleMsg string `protobuf:"bytes,4,opt,name=handleMsg" json:"handleMsg,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GroupApplicationRejectedTips) Reset() { *m = GroupApplicationRejectedTips{} } +func (m *GroupApplicationRejectedTips) String() string { return proto.CompactTextString(m) } +func (*GroupApplicationRejectedTips) ProtoMessage() {} +func (*GroupApplicationRejectedTips) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{21} +} +func (m *GroupApplicationRejectedTips) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GroupApplicationRejectedTips.Unmarshal(m, b) +} +func (m *GroupApplicationRejectedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GroupApplicationRejectedTips.Marshal(b, m, deterministic) +} +func (dst *GroupApplicationRejectedTips) XXX_Merge(src proto.Message) { + xxx_messageInfo_GroupApplicationRejectedTips.Merge(dst, src) +} +func (m *GroupApplicationRejectedTips) XXX_Size() int { + return xxx_messageInfo_GroupApplicationRejectedTips.Size(m) +} +func (m *GroupApplicationRejectedTips) XXX_DiscardUnknown() { + xxx_messageInfo_GroupApplicationRejectedTips.DiscardUnknown(m) +} + +var xxx_messageInfo_GroupApplicationRejectedTips proto.InternalMessageInfo + +func (m *GroupApplicationRejectedTips) GetGroup() *GroupInfo { + if m != nil { + return m.Group + } + return nil +} + +func (m *GroupApplicationRejectedTips) GetOpUser() *GroupMemberFullInfo { + if m != nil { + return m.OpUser + } + return nil +} + +func (m *GroupApplicationRejectedTips) GetHandleMsg() string { + if m != nil { + return m.HandleMsg + } + return "" +} + +// OnTransferGroupOwner() +type GroupOwnerTransferredTips struct { + Group *GroupInfo `protobuf:"bytes,1,opt,name=group" json:"group,omitempty"` + OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser" json:"opUser,omitempty"` + NewGroupOwner *GroupMemberFullInfo `protobuf:"bytes,3,opt,name=newGroupOwner" json:"newGroupOwner,omitempty"` + OperationTime int64 `protobuf:"varint,4,opt,name=operationTime" json:"operationTime,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GroupOwnerTransferredTips) Reset() { *m = GroupOwnerTransferredTips{} } +func (m *GroupOwnerTransferredTips) String() string { return proto.CompactTextString(m) } +func (*GroupOwnerTransferredTips) ProtoMessage() {} +func (*GroupOwnerTransferredTips) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{22} +} +func (m *GroupOwnerTransferredTips) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GroupOwnerTransferredTips.Unmarshal(m, b) +} +func (m *GroupOwnerTransferredTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GroupOwnerTransferredTips.Marshal(b, m, deterministic) +} +func (dst *GroupOwnerTransferredTips) XXX_Merge(src proto.Message) { + xxx_messageInfo_GroupOwnerTransferredTips.Merge(dst, src) +} +func (m *GroupOwnerTransferredTips) XXX_Size() int { + return xxx_messageInfo_GroupOwnerTransferredTips.Size(m) +} +func (m *GroupOwnerTransferredTips) XXX_DiscardUnknown() { + xxx_messageInfo_GroupOwnerTransferredTips.DiscardUnknown(m) +} + +var xxx_messageInfo_GroupOwnerTransferredTips proto.InternalMessageInfo + +func (m *GroupOwnerTransferredTips) GetGroup() *GroupInfo { + if m != nil { + return m.Group + } + return nil +} + +func (m *GroupOwnerTransferredTips) GetOpUser() *GroupMemberFullInfo { + if m != nil { + return m.OpUser + } + return nil +} + +func (m *GroupOwnerTransferredTips) GetNewGroupOwner() *GroupMemberFullInfo { + if m != nil { + return m.NewGroupOwner + } + return nil +} + +func (m *GroupOwnerTransferredTips) GetOperationTime() int64 { + if m != nil { + return m.OperationTime + } + return 0 +} + +// OnMemberKicked() +type MemberKickedTips struct { + Group *GroupInfo `protobuf:"bytes,1,opt,name=group" json:"group,omitempty"` + OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser" json:"opUser,omitempty"` + KickedUserList []*GroupMemberFullInfo `protobuf:"bytes,3,rep,name=kickedUserList" json:"kickedUserList,omitempty"` + OperationTime int64 `protobuf:"varint,4,opt,name=operationTime" json:"operationTime,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemberKickedTips) Reset() { *m = MemberKickedTips{} } +func (m *MemberKickedTips) String() string { return proto.CompactTextString(m) } +func (*MemberKickedTips) ProtoMessage() {} +func (*MemberKickedTips) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{23} +} +func (m *MemberKickedTips) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemberKickedTips.Unmarshal(m, b) +} +func (m *MemberKickedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemberKickedTips.Marshal(b, m, deterministic) +} +func (dst *MemberKickedTips) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemberKickedTips.Merge(dst, src) +} +func (m *MemberKickedTips) XXX_Size() int { + return xxx_messageInfo_MemberKickedTips.Size(m) +} +func (m *MemberKickedTips) XXX_DiscardUnknown() { + xxx_messageInfo_MemberKickedTips.DiscardUnknown(m) +} + +var xxx_messageInfo_MemberKickedTips proto.InternalMessageInfo + +func (m *MemberKickedTips) GetGroup() *GroupInfo { + if m != nil { + return m.Group + } + return nil +} + +func (m *MemberKickedTips) GetOpUser() *GroupMemberFullInfo { + if m != nil { + return m.OpUser + } + return nil +} + +func (m *MemberKickedTips) GetKickedUserList() []*GroupMemberFullInfo { + if m != nil { + return m.KickedUserList + } + return nil +} + +func (m *MemberKickedTips) GetOperationTime() int64 { + if m != nil { + return m.OperationTime + } + return 0 +} + +// OnMemberInvited() +type MemberInvitedTips struct { + Group *GroupInfo `protobuf:"bytes,1,opt,name=group" json:"group,omitempty"` + OpUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=opUser" json:"opUser,omitempty"` + InvitedUserList []*GroupMemberFullInfo `protobuf:"bytes,3,rep,name=invitedUserList" json:"invitedUserList,omitempty"` + OperationTime int64 `protobuf:"varint,4,opt,name=operationTime" json:"operationTime,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemberInvitedTips) Reset() { *m = MemberInvitedTips{} } +func (m *MemberInvitedTips) String() string { return proto.CompactTextString(m) } +func (*MemberInvitedTips) ProtoMessage() {} +func (*MemberInvitedTips) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{24} +} +func (m *MemberInvitedTips) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemberInvitedTips.Unmarshal(m, b) +} +func (m *MemberInvitedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemberInvitedTips.Marshal(b, m, deterministic) +} +func (dst *MemberInvitedTips) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemberInvitedTips.Merge(dst, src) +} +func (m *MemberInvitedTips) XXX_Size() int { + return xxx_messageInfo_MemberInvitedTips.Size(m) +} +func (m *MemberInvitedTips) XXX_DiscardUnknown() { + xxx_messageInfo_MemberInvitedTips.DiscardUnknown(m) +} + +var xxx_messageInfo_MemberInvitedTips proto.InternalMessageInfo + +func (m *MemberInvitedTips) GetGroup() *GroupInfo { + if m != nil { + return m.Group + } + return nil +} + +func (m *MemberInvitedTips) GetOpUser() *GroupMemberFullInfo { + if m != nil { + return m.OpUser + } + return nil +} + +func (m *MemberInvitedTips) GetInvitedUserList() []*GroupMemberFullInfo { + if m != nil { + return m.InvitedUserList + } + return nil +} + +func (m *MemberInvitedTips) GetOperationTime() int64 { + if m != nil { + return m.OperationTime + } + return 0 +} + +// Actively join the group +type MemberEnterTips struct { + Group *GroupInfo `protobuf:"bytes,1,opt,name=group" json:"group,omitempty"` + EntrantUser *GroupMemberFullInfo `protobuf:"bytes,2,opt,name=entrantUser" json:"entrantUser,omitempty"` + OperationTime int64 `protobuf:"varint,3,opt,name=operationTime" json:"operationTime,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemberEnterTips) Reset() { *m = MemberEnterTips{} } +func (m *MemberEnterTips) String() string { return proto.CompactTextString(m) } +func (*MemberEnterTips) ProtoMessage() {} +func (*MemberEnterTips) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{25} +} +func (m *MemberEnterTips) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MemberEnterTips.Unmarshal(m, b) +} +func (m *MemberEnterTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MemberEnterTips.Marshal(b, m, deterministic) +} +func (dst *MemberEnterTips) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemberEnterTips.Merge(dst, src) +} +func (m *MemberEnterTips) XXX_Size() int { + return xxx_messageInfo_MemberEnterTips.Size(m) +} +func (m *MemberEnterTips) XXX_DiscardUnknown() { + xxx_messageInfo_MemberEnterTips.DiscardUnknown(m) +} + +var xxx_messageInfo_MemberEnterTips proto.InternalMessageInfo + +func (m *MemberEnterTips) GetGroup() *GroupInfo { + if m != nil { + return m.Group + } + return nil +} + +func (m *MemberEnterTips) GetEntrantUser() *GroupMemberFullInfo { + if m != nil { + return m.EntrantUser + } + return nil +} + +func (m *MemberEnterTips) GetOperationTime() int64 { + if m != nil { + return m.OperationTime + } + return 0 +} + type FriendApplication struct { - AddTime uint64 `protobuf:"varint,4,opt,name=AddTime" json:"AddTime,omitempty"` - AddSource string `protobuf:"bytes,5,opt,name=AddSource" json:"AddSource,omitempty"` - AddWording string `protobuf:"bytes,6,opt,name=AddWording" json:"AddWording,omitempty"` + AddTime int64 `protobuf:"varint,1,opt,name=addTime" json:"addTime,omitempty"` + AddSource string `protobuf:"bytes,2,opt,name=addSource" json:"addSource,omitempty"` + AddWording string `protobuf:"bytes,3,opt,name=addWording" json:"addWording,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1785,7 +1982,7 @@ func (m *FriendApplication) Reset() { *m = FriendApplication{} } func (m *FriendApplication) String() string { return proto.CompactTextString(m) } func (*FriendApplication) ProtoMessage() {} func (*FriendApplication) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{26} + return fileDescriptor_ws_dd0597f97f3a9074, []int{26} } func (m *FriendApplication) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendApplication.Unmarshal(m, b) @@ -1805,7 +2002,7 @@ func (m *FriendApplication) XXX_DiscardUnknown() { var xxx_messageInfo_FriendApplication proto.InternalMessageInfo -func (m *FriendApplication) GetAddTime() uint64 { +func (m *FriendApplication) GetAddTime() int64 { if m != nil { return m.AddTime } @@ -1826,319 +2023,367 @@ func (m *FriendApplication) GetAddWording() string { return "" } -// user1 add user2 -type FriendApplicationListAddedTips struct { - OpUser *PublicUserInfo `protobuf:"bytes,1,opt,name=OpUser" json:"OpUser,omitempty"` - Application *FriendApplication `protobuf:"bytes,2,opt,name=Application" json:"Application,omitempty"` - OpedUser *PublicUserInfo `protobuf:"bytes,3,opt,name=OpedUser" json:"OpedUser,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +type FromToUserID struct { + FromUserID string `protobuf:"bytes,1,opt,name=fromUserID" json:"fromUserID,omitempty"` + ToUserID string `protobuf:"bytes,2,opt,name=toUserID" json:"toUserID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *FriendApplicationListAddedTips) Reset() { *m = FriendApplicationListAddedTips{} } -func (m *FriendApplicationListAddedTips) String() string { return proto.CompactTextString(m) } -func (*FriendApplicationListAddedTips) ProtoMessage() {} -func (*FriendApplicationListAddedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{27} +func (m *FromToUserID) Reset() { *m = FromToUserID{} } +func (m *FromToUserID) String() string { return proto.CompactTextString(m) } +func (*FromToUserID) ProtoMessage() {} +func (*FromToUserID) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{27} } -func (m *FriendApplicationListAddedTips) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FriendApplicationListAddedTips.Unmarshal(m, b) +func (m *FromToUserID) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FromToUserID.Unmarshal(m, b) } -func (m *FriendApplicationListAddedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FriendApplicationListAddedTips.Marshal(b, m, deterministic) +func (m *FromToUserID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FromToUserID.Marshal(b, m, deterministic) } -func (dst *FriendApplicationListAddedTips) XXX_Merge(src proto.Message) { - xxx_messageInfo_FriendApplicationListAddedTips.Merge(dst, src) +func (dst *FromToUserID) XXX_Merge(src proto.Message) { + xxx_messageInfo_FromToUserID.Merge(dst, src) } -func (m *FriendApplicationListAddedTips) XXX_Size() int { - return xxx_messageInfo_FriendApplicationListAddedTips.Size(m) +func (m *FromToUserID) XXX_Size() int { + return xxx_messageInfo_FromToUserID.Size(m) } -func (m *FriendApplicationListAddedTips) XXX_DiscardUnknown() { - xxx_messageInfo_FriendApplicationListAddedTips.DiscardUnknown(m) +func (m *FromToUserID) XXX_DiscardUnknown() { + xxx_messageInfo_FromToUserID.DiscardUnknown(m) } -var xxx_messageInfo_FriendApplicationListAddedTips proto.InternalMessageInfo +var xxx_messageInfo_FromToUserID proto.InternalMessageInfo -func (m *FriendApplicationListAddedTips) GetOpUser() *PublicUserInfo { +func (m *FromToUserID) GetFromUserID() string { if m != nil { - return m.OpUser + return m.FromUserID + } + return "" +} + +func (m *FromToUserID) GetToUserID() string { + if m != nil { + return m.ToUserID + } + return "" +} + +// FromUserID apply to add ToUserID +type FriendApplicationTips struct { + FromToUserID *FromToUserID `protobuf:"bytes,1,opt,name=fromToUserID" json:"fromToUserID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FriendApplicationTips) Reset() { *m = FriendApplicationTips{} } +func (m *FriendApplicationTips) String() string { return proto.CompactTextString(m) } +func (*FriendApplicationTips) ProtoMessage() {} +func (*FriendApplicationTips) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{28} +} +func (m *FriendApplicationTips) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FriendApplicationTips.Unmarshal(m, b) +} +func (m *FriendApplicationTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FriendApplicationTips.Marshal(b, m, deterministic) +} +func (dst *FriendApplicationTips) XXX_Merge(src proto.Message) { + xxx_messageInfo_FriendApplicationTips.Merge(dst, src) +} +func (m *FriendApplicationTips) XXX_Size() int { + return xxx_messageInfo_FriendApplicationTips.Size(m) +} +func (m *FriendApplicationTips) XXX_DiscardUnknown() { + xxx_messageInfo_FriendApplicationTips.DiscardUnknown(m) +} + +var xxx_messageInfo_FriendApplicationTips proto.InternalMessageInfo + +func (m *FriendApplicationTips) GetFromToUserID() *FromToUserID { + if m != nil { + return m.FromToUserID } return nil } -func (m *FriendApplicationListAddedTips) GetApplication() *FriendApplication { +// FromUserID accept or reject ToUserID +type FriendApplicationApprovedTips struct { + FromToUserID *FromToUserID `protobuf:"bytes,1,opt,name=fromToUserID" json:"fromToUserID,omitempty"` + HandleMsg string `protobuf:"bytes,2,opt,name=handleMsg" json:"handleMsg,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FriendApplicationApprovedTips) Reset() { *m = FriendApplicationApprovedTips{} } +func (m *FriendApplicationApprovedTips) String() string { return proto.CompactTextString(m) } +func (*FriendApplicationApprovedTips) ProtoMessage() {} +func (*FriendApplicationApprovedTips) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{29} +} +func (m *FriendApplicationApprovedTips) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FriendApplicationApprovedTips.Unmarshal(m, b) +} +func (m *FriendApplicationApprovedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FriendApplicationApprovedTips.Marshal(b, m, deterministic) +} +func (dst *FriendApplicationApprovedTips) XXX_Merge(src proto.Message) { + xxx_messageInfo_FriendApplicationApprovedTips.Merge(dst, src) +} +func (m *FriendApplicationApprovedTips) XXX_Size() int { + return xxx_messageInfo_FriendApplicationApprovedTips.Size(m) +} +func (m *FriendApplicationApprovedTips) XXX_DiscardUnknown() { + xxx_messageInfo_FriendApplicationApprovedTips.DiscardUnknown(m) +} + +var xxx_messageInfo_FriendApplicationApprovedTips proto.InternalMessageInfo + +func (m *FriendApplicationApprovedTips) GetFromToUserID() *FromToUserID { if m != nil { - return m.Application + return m.FromToUserID } return nil } -func (m *FriendApplicationListAddedTips) GetOpedUser() *PublicUserInfo { +func (m *FriendApplicationApprovedTips) GetHandleMsg() string { if m != nil { - return m.OpedUser + return m.HandleMsg + } + return "" +} + +// FromUserID accept or reject ToUserID +type FriendApplicationRejectedTips struct { + FromToUserID *FromToUserID `protobuf:"bytes,1,opt,name=fromToUserID" json:"fromToUserID,omitempty"` + HandleMsg string `protobuf:"bytes,2,opt,name=handleMsg" json:"handleMsg,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FriendApplicationRejectedTips) Reset() { *m = FriendApplicationRejectedTips{} } +func (m *FriendApplicationRejectedTips) String() string { return proto.CompactTextString(m) } +func (*FriendApplicationRejectedTips) ProtoMessage() {} +func (*FriendApplicationRejectedTips) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{30} +} +func (m *FriendApplicationRejectedTips) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FriendApplicationRejectedTips.Unmarshal(m, b) +} +func (m *FriendApplicationRejectedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FriendApplicationRejectedTips.Marshal(b, m, deterministic) +} +func (dst *FriendApplicationRejectedTips) XXX_Merge(src proto.Message) { + xxx_messageInfo_FriendApplicationRejectedTips.Merge(dst, src) +} +func (m *FriendApplicationRejectedTips) XXX_Size() int { + return xxx_messageInfo_FriendApplicationRejectedTips.Size(m) +} +func (m *FriendApplicationRejectedTips) XXX_DiscardUnknown() { + xxx_messageInfo_FriendApplicationRejectedTips.DiscardUnknown(m) +} + +var xxx_messageInfo_FriendApplicationRejectedTips proto.InternalMessageInfo + +func (m *FriendApplicationRejectedTips) GetFromToUserID() *FromToUserID { + if m != nil { + return m.FromToUserID } return nil } -// user2 accept -type FriendApplicationListAcceptTips struct { - OpUser *PublicUserInfo `protobuf:"bytes,1,opt,name=OpUser" json:"OpUser,omitempty"` - OpedUser *PublicUserInfo `protobuf:"bytes,2,opt,name=OpedUser" json:"OpedUser,omitempty"` +func (m *FriendApplicationRejectedTips) GetHandleMsg() string { + if m != nil { + return m.HandleMsg + } + return "" +} + +// FromUserID Added a friend ToUserID +type FriendAddedTips struct { + Friend *FriendInfo `protobuf:"bytes,1,opt,name=friend" json:"friend,omitempty"` + OperationTime int64 `protobuf:"varint,2,opt,name=operationTime" json:"operationTime,omitempty"` + OpUser *PublicUserInfo `protobuf:"bytes,3,opt,name=opUser" json:"opUser,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *FriendApplicationListAcceptTips) Reset() { *m = FriendApplicationListAcceptTips{} } -func (m *FriendApplicationListAcceptTips) String() string { return proto.CompactTextString(m) } -func (*FriendApplicationListAcceptTips) ProtoMessage() {} -func (*FriendApplicationListAcceptTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{28} +func (m *FriendAddedTips) Reset() { *m = FriendAddedTips{} } +func (m *FriendAddedTips) String() string { return proto.CompactTextString(m) } +func (*FriendAddedTips) ProtoMessage() {} +func (*FriendAddedTips) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{31} } -func (m *FriendApplicationListAcceptTips) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FriendApplicationListAcceptTips.Unmarshal(m, b) +func (m *FriendAddedTips) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FriendAddedTips.Unmarshal(m, b) } -func (m *FriendApplicationListAcceptTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FriendApplicationListAcceptTips.Marshal(b, m, deterministic) +func (m *FriendAddedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FriendAddedTips.Marshal(b, m, deterministic) } -func (dst *FriendApplicationListAcceptTips) XXX_Merge(src proto.Message) { - xxx_messageInfo_FriendApplicationListAcceptTips.Merge(dst, src) +func (dst *FriendAddedTips) XXX_Merge(src proto.Message) { + xxx_messageInfo_FriendAddedTips.Merge(dst, src) } -func (m *FriendApplicationListAcceptTips) XXX_Size() int { - return xxx_messageInfo_FriendApplicationListAcceptTips.Size(m) +func (m *FriendAddedTips) XXX_Size() int { + return xxx_messageInfo_FriendAddedTips.Size(m) } -func (m *FriendApplicationListAcceptTips) XXX_DiscardUnknown() { - xxx_messageInfo_FriendApplicationListAcceptTips.DiscardUnknown(m) +func (m *FriendAddedTips) XXX_DiscardUnknown() { + xxx_messageInfo_FriendAddedTips.DiscardUnknown(m) } -var xxx_messageInfo_FriendApplicationListAcceptTips proto.InternalMessageInfo +var xxx_messageInfo_FriendAddedTips proto.InternalMessageInfo -func (m *FriendApplicationListAcceptTips) GetOpUser() *PublicUserInfo { +func (m *FriendAddedTips) GetFriend() *FriendInfo { + if m != nil { + return m.Friend + } + return nil +} + +func (m *FriendAddedTips) GetOperationTime() int64 { + if m != nil { + return m.OperationTime + } + return 0 +} + +func (m *FriendAddedTips) GetOpUser() *PublicUserInfo { if m != nil { return m.OpUser } return nil } -func (m *FriendApplicationListAcceptTips) GetOpedUser() *PublicUserInfo { +// FromUserID deleted a friend ToUserID +type FriendDeletedTips struct { + FromToUserID *FromToUserID `protobuf:"bytes,1,opt,name=fromToUserID" json:"fromToUserID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FriendDeletedTips) Reset() { *m = FriendDeletedTips{} } +func (m *FriendDeletedTips) String() string { return proto.CompactTextString(m) } +func (*FriendDeletedTips) ProtoMessage() {} +func (*FriendDeletedTips) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{32} +} +func (m *FriendDeletedTips) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FriendDeletedTips.Unmarshal(m, b) +} +func (m *FriendDeletedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FriendDeletedTips.Marshal(b, m, deterministic) +} +func (dst *FriendDeletedTips) XXX_Merge(src proto.Message) { + xxx_messageInfo_FriendDeletedTips.Merge(dst, src) +} +func (m *FriendDeletedTips) XXX_Size() int { + return xxx_messageInfo_FriendDeletedTips.Size(m) +} +func (m *FriendDeletedTips) XXX_DiscardUnknown() { + xxx_messageInfo_FriendDeletedTips.DiscardUnknown(m) +} + +var xxx_messageInfo_FriendDeletedTips proto.InternalMessageInfo + +func (m *FriendDeletedTips) GetFromToUserID() *FromToUserID { if m != nil { - return m.OpedUser + return m.FromToUserID } return nil } -// user2 reject -type FriendApplicationListRejectTips struct { - OpUser *PublicUserInfo `protobuf:"bytes,1,opt,name=OpUser" json:"OpUser,omitempty"` - OpedUser *PublicUserInfo `protobuf:"bytes,2,opt,name=OpedUser" json:"OpedUser,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +type BlackAddedTips struct { + FromToUserID *FromToUserID `protobuf:"bytes,1,opt,name=fromToUserID" json:"fromToUserID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *FriendApplicationListRejectTips) Reset() { *m = FriendApplicationListRejectTips{} } -func (m *FriendApplicationListRejectTips) String() string { return proto.CompactTextString(m) } -func (*FriendApplicationListRejectTips) ProtoMessage() {} -func (*FriendApplicationListRejectTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{29} +func (m *BlackAddedTips) Reset() { *m = BlackAddedTips{} } +func (m *BlackAddedTips) String() string { return proto.CompactTextString(m) } +func (*BlackAddedTips) ProtoMessage() {} +func (*BlackAddedTips) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{33} } -func (m *FriendApplicationListRejectTips) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FriendApplicationListRejectTips.Unmarshal(m, b) +func (m *BlackAddedTips) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BlackAddedTips.Unmarshal(m, b) } -func (m *FriendApplicationListRejectTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FriendApplicationListRejectTips.Marshal(b, m, deterministic) +func (m *BlackAddedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BlackAddedTips.Marshal(b, m, deterministic) } -func (dst *FriendApplicationListRejectTips) XXX_Merge(src proto.Message) { - xxx_messageInfo_FriendApplicationListRejectTips.Merge(dst, src) +func (dst *BlackAddedTips) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlackAddedTips.Merge(dst, src) } -func (m *FriendApplicationListRejectTips) XXX_Size() int { - return xxx_messageInfo_FriendApplicationListRejectTips.Size(m) +func (m *BlackAddedTips) XXX_Size() int { + return xxx_messageInfo_BlackAddedTips.Size(m) } -func (m *FriendApplicationListRejectTips) XXX_DiscardUnknown() { - xxx_messageInfo_FriendApplicationListRejectTips.DiscardUnknown(m) +func (m *BlackAddedTips) XXX_DiscardUnknown() { + xxx_messageInfo_BlackAddedTips.DiscardUnknown(m) } -var xxx_messageInfo_FriendApplicationListRejectTips proto.InternalMessageInfo +var xxx_messageInfo_BlackAddedTips proto.InternalMessageInfo -func (m *FriendApplicationListRejectTips) GetOpUser() *PublicUserInfo { +func (m *BlackAddedTips) GetFromToUserID() *FromToUserID { if m != nil { - return m.OpUser + return m.FromToUserID } return nil } -func (m *FriendApplicationListRejectTips) GetOpedUser() *PublicUserInfo { +type BlackDeletedTips struct { + FromToUserID *FromToUserID `protobuf:"bytes,1,opt,name=fromToUserID" json:"fromToUserID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BlackDeletedTips) Reset() { *m = BlackDeletedTips{} } +func (m *BlackDeletedTips) String() string { return proto.CompactTextString(m) } +func (*BlackDeletedTips) ProtoMessage() {} +func (*BlackDeletedTips) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{34} +} +func (m *BlackDeletedTips) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BlackDeletedTips.Unmarshal(m, b) +} +func (m *BlackDeletedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BlackDeletedTips.Marshal(b, m, deterministic) +} +func (dst *BlackDeletedTips) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlackDeletedTips.Merge(dst, src) +} +func (m *BlackDeletedTips) XXX_Size() int { + return xxx_messageInfo_BlackDeletedTips.Size(m) +} +func (m *BlackDeletedTips) XXX_DiscardUnknown() { + xxx_messageInfo_BlackDeletedTips.DiscardUnknown(m) +} + +var xxx_messageInfo_BlackDeletedTips proto.InternalMessageInfo + +func (m *BlackDeletedTips) GetFromToUserID() *FromToUserID { if m != nil { - return m.OpedUser - } - return nil -} - -type FriendListAddedTips struct { - Friend *FriendInfo `protobuf:"bytes,1,opt,name=Friend" json:"Friend,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FriendListAddedTips) Reset() { *m = FriendListAddedTips{} } -func (m *FriendListAddedTips) String() string { return proto.CompactTextString(m) } -func (*FriendListAddedTips) ProtoMessage() {} -func (*FriendListAddedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{30} -} -func (m *FriendListAddedTips) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FriendListAddedTips.Unmarshal(m, b) -} -func (m *FriendListAddedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FriendListAddedTips.Marshal(b, m, deterministic) -} -func (dst *FriendListAddedTips) XXX_Merge(src proto.Message) { - xxx_messageInfo_FriendListAddedTips.Merge(dst, src) -} -func (m *FriendListAddedTips) XXX_Size() int { - return xxx_messageInfo_FriendListAddedTips.Size(m) -} -func (m *FriendListAddedTips) XXX_DiscardUnknown() { - xxx_messageInfo_FriendListAddedTips.DiscardUnknown(m) -} - -var xxx_messageInfo_FriendListAddedTips proto.InternalMessageInfo - -func (m *FriendListAddedTips) GetFriend() *FriendInfo { - if m != nil { - return m.Friend - } - return nil -} - -type FriendListDeletedTips struct { - Friend *FriendInfo `protobuf:"bytes,1,opt,name=Friend" json:"Friend,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *FriendListDeletedTips) Reset() { *m = FriendListDeletedTips{} } -func (m *FriendListDeletedTips) String() string { return proto.CompactTextString(m) } -func (*FriendListDeletedTips) ProtoMessage() {} -func (*FriendListDeletedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{31} -} -func (m *FriendListDeletedTips) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FriendListDeletedTips.Unmarshal(m, b) -} -func (m *FriendListDeletedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FriendListDeletedTips.Marshal(b, m, deterministic) -} -func (dst *FriendListDeletedTips) XXX_Merge(src proto.Message) { - xxx_messageInfo_FriendListDeletedTips.Merge(dst, src) -} -func (m *FriendListDeletedTips) XXX_Size() int { - return xxx_messageInfo_FriendListDeletedTips.Size(m) -} -func (m *FriendListDeletedTips) XXX_DiscardUnknown() { - xxx_messageInfo_FriendListDeletedTips.DiscardUnknown(m) -} - -var xxx_messageInfo_FriendListDeletedTips proto.InternalMessageInfo - -func (m *FriendListDeletedTips) GetFriend() *FriendInfo { - if m != nil { - return m.Friend - } - return nil -} - -type BlackListAddTips struct { - Friend *FriendInfo `protobuf:"bytes,1,opt,name=Friend" json:"Friend,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BlackListAddTips) Reset() { *m = BlackListAddTips{} } -func (m *BlackListAddTips) String() string { return proto.CompactTextString(m) } -func (*BlackListAddTips) ProtoMessage() {} -func (*BlackListAddTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{32} -} -func (m *BlackListAddTips) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BlackListAddTips.Unmarshal(m, b) -} -func (m *BlackListAddTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BlackListAddTips.Marshal(b, m, deterministic) -} -func (dst *BlackListAddTips) XXX_Merge(src proto.Message) { - xxx_messageInfo_BlackListAddTips.Merge(dst, src) -} -func (m *BlackListAddTips) XXX_Size() int { - return xxx_messageInfo_BlackListAddTips.Size(m) -} -func (m *BlackListAddTips) XXX_DiscardUnknown() { - xxx_messageInfo_BlackListAddTips.DiscardUnknown(m) -} - -var xxx_messageInfo_BlackListAddTips proto.InternalMessageInfo - -func (m *BlackListAddTips) GetFriend() *FriendInfo { - if m != nil { - return m.Friend - } - return nil -} - -type BlackListDeletedTips struct { - Friend *FriendInfo `protobuf:"bytes,1,opt,name=Friend" json:"Friend,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BlackListDeletedTips) Reset() { *m = BlackListDeletedTips{} } -func (m *BlackListDeletedTips) String() string { return proto.CompactTextString(m) } -func (*BlackListDeletedTips) ProtoMessage() {} -func (*BlackListDeletedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{33} -} -func (m *BlackListDeletedTips) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BlackListDeletedTips.Unmarshal(m, b) -} -func (m *BlackListDeletedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BlackListDeletedTips.Marshal(b, m, deterministic) -} -func (dst *BlackListDeletedTips) XXX_Merge(src proto.Message) { - xxx_messageInfo_BlackListDeletedTips.Merge(dst, src) -} -func (m *BlackListDeletedTips) XXX_Size() int { - return xxx_messageInfo_BlackListDeletedTips.Size(m) -} -func (m *BlackListDeletedTips) XXX_DiscardUnknown() { - xxx_messageInfo_BlackListDeletedTips.DiscardUnknown(m) -} - -var xxx_messageInfo_BlackListDeletedTips proto.InternalMessageInfo - -func (m *BlackListDeletedTips) GetFriend() *FriendInfo { - if m != nil { - return m.Friend + return m.FromToUserID } return nil } type FriendInfoChangedTips struct { - Friend *FriendInfo `protobuf:"bytes,1,opt,name=Friend" json:"Friend,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + FromToUserID *FromToUserID `protobuf:"bytes,1,opt,name=fromToUserID" json:"fromToUserID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *FriendInfoChangedTips) Reset() { *m = FriendInfoChangedTips{} } func (m *FriendInfoChangedTips) String() string { return proto.CompactTextString(m) } func (*FriendInfoChangedTips) ProtoMessage() {} func (*FriendInfoChangedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{34} + return fileDescriptor_ws_dd0597f97f3a9074, []int{35} } func (m *FriendInfoChangedTips) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_FriendInfoChangedTips.Unmarshal(m, b) @@ -2158,198 +2403,214 @@ func (m *FriendInfoChangedTips) XXX_DiscardUnknown() { var xxx_messageInfo_FriendInfoChangedTips proto.InternalMessageInfo -func (m *FriendInfoChangedTips) GetFriend() *FriendInfo { +func (m *FriendInfoChangedTips) GetFromToUserID() *FromToUserID { if m != nil { - return m.Friend + return m.FromToUserID } return nil } // ////////////////////user///////////////////// -type SelfInfoUpdatedTips struct { - SelfUserInfo *UserInfo `protobuf:"bytes,1,opt,name=SelfUserInfo" json:"SelfUserInfo,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +type UserInfoUpdatedTips struct { + UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *SelfInfoUpdatedTips) Reset() { *m = SelfInfoUpdatedTips{} } -func (m *SelfInfoUpdatedTips) String() string { return proto.CompactTextString(m) } -func (*SelfInfoUpdatedTips) ProtoMessage() {} -func (*SelfInfoUpdatedTips) Descriptor() ([]byte, []int) { - return fileDescriptor_ws_e632726fa8a2c9ae, []int{35} +func (m *UserInfoUpdatedTips) Reset() { *m = UserInfoUpdatedTips{} } +func (m *UserInfoUpdatedTips) String() string { return proto.CompactTextString(m) } +func (*UserInfoUpdatedTips) ProtoMessage() {} +func (*UserInfoUpdatedTips) Descriptor() ([]byte, []int) { + return fileDescriptor_ws_dd0597f97f3a9074, []int{36} } -func (m *SelfInfoUpdatedTips) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SelfInfoUpdatedTips.Unmarshal(m, b) +func (m *UserInfoUpdatedTips) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UserInfoUpdatedTips.Unmarshal(m, b) } -func (m *SelfInfoUpdatedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SelfInfoUpdatedTips.Marshal(b, m, deterministic) +func (m *UserInfoUpdatedTips) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UserInfoUpdatedTips.Marshal(b, m, deterministic) } -func (dst *SelfInfoUpdatedTips) XXX_Merge(src proto.Message) { - xxx_messageInfo_SelfInfoUpdatedTips.Merge(dst, src) +func (dst *UserInfoUpdatedTips) XXX_Merge(src proto.Message) { + xxx_messageInfo_UserInfoUpdatedTips.Merge(dst, src) } -func (m *SelfInfoUpdatedTips) XXX_Size() int { - return xxx_messageInfo_SelfInfoUpdatedTips.Size(m) +func (m *UserInfoUpdatedTips) XXX_Size() int { + return xxx_messageInfo_UserInfoUpdatedTips.Size(m) } -func (m *SelfInfoUpdatedTips) XXX_DiscardUnknown() { - xxx_messageInfo_SelfInfoUpdatedTips.DiscardUnknown(m) +func (m *UserInfoUpdatedTips) XXX_DiscardUnknown() { + xxx_messageInfo_UserInfoUpdatedTips.DiscardUnknown(m) } -var xxx_messageInfo_SelfInfoUpdatedTips proto.InternalMessageInfo +var xxx_messageInfo_UserInfoUpdatedTips proto.InternalMessageInfo -func (m *SelfInfoUpdatedTips) GetSelfUserInfo() *UserInfo { +func (m *UserInfoUpdatedTips) GetUserID() string { if m != nil { - return m.SelfUserInfo + return m.UserID } - return nil + return "" } func init() { - proto.RegisterType((*PullMessageBySeqListResp)(nil), "open_im_sdk.PullMessageBySeqListResp") - proto.RegisterType((*PullMessageBySeqListReq)(nil), "open_im_sdk.PullMessageBySeqListReq") - proto.RegisterType((*GetMaxAndMinSeqReq)(nil), "open_im_sdk.GetMaxAndMinSeqReq") - proto.RegisterType((*GetMaxAndMinSeqResp)(nil), "open_im_sdk.GetMaxAndMinSeqResp") - proto.RegisterType((*GatherFormat)(nil), "open_im_sdk.GatherFormat") - proto.RegisterType((*MsgFormat)(nil), "open_im_sdk.MsgFormat") - proto.RegisterType((*UserSendMsgReq)(nil), "open_im_sdk.UserSendMsgReq") - proto.RegisterMapType((map[string]int32)(nil), "open_im_sdk.UserSendMsgReq.OptionsEntry") - proto.RegisterType((*UserSendMsgResp)(nil), "open_im_sdk.UserSendMsgResp") - proto.RegisterType((*MsgData)(nil), "open_im_sdk.MsgData") - proto.RegisterType((*OfflinePushInfo)(nil), "open_im_sdk.OfflinePushInfo") - proto.RegisterType((*GroupInfo)(nil), "open_im_sdk.GroupInfo") - proto.RegisterType((*GroupMemberFullInfo)(nil), "open_im_sdk.GroupMemberFullInfo") - proto.RegisterType((*UserInfo)(nil), "open_im_sdk.UserInfo") - proto.RegisterType((*PublicUserInfo)(nil), "open_im_sdk.PublicUserInfo") - proto.RegisterType((*TipsComm)(nil), "open_im_sdk.TipsComm") - proto.RegisterType((*MemberEnterTips)(nil), "open_im_sdk.MemberEnterTips") - proto.RegisterType((*MemberLeaveTips)(nil), "open_im_sdk.MemberLeaveTips") - proto.RegisterType((*MemberInvitedTips)(nil), "open_im_sdk.MemberInvitedTips") - proto.RegisterType((*MemberKickedTips)(nil), "open_im_sdk.MemberKickedTips") - proto.RegisterType((*GroupMemberChangeInfo)(nil), "open_im_sdk.GroupMemberChangeInfo") - proto.RegisterType((*MemberInfoChangedTips)(nil), "open_im_sdk.MemberInfoChangedTips") - proto.RegisterType((*GroupCreatedTips)(nil), "open_im_sdk.GroupCreatedTips") - proto.RegisterType((*GroupInfoChangedTips)(nil), "open_im_sdk.GroupInfoChangedTips") - proto.RegisterType((*ReceiveJoinApplicationTips)(nil), "open_im_sdk.ReceiveJoinApplicationTips") - proto.RegisterType((*ApplicationProcessedTips)(nil), "open_im_sdk.ApplicationProcessedTips") - proto.RegisterType((*FriendInfo)(nil), "open_im_sdk.FriendInfo") - proto.RegisterType((*FriendApplication)(nil), "open_im_sdk.FriendApplication") - proto.RegisterType((*FriendApplicationListAddedTips)(nil), "open_im_sdk.FriendApplicationListAddedTips") - proto.RegisterType((*FriendApplicationListAcceptTips)(nil), "open_im_sdk.FriendApplicationListAcceptTips") - proto.RegisterType((*FriendApplicationListRejectTips)(nil), "open_im_sdk.FriendApplicationListRejectTips") - proto.RegisterType((*FriendListAddedTips)(nil), "open_im_sdk.FriendListAddedTips") - proto.RegisterType((*FriendListDeletedTips)(nil), "open_im_sdk.FriendListDeletedTips") - proto.RegisterType((*BlackListAddTips)(nil), "open_im_sdk.BlackListAddTips") - proto.RegisterType((*BlackListDeletedTips)(nil), "open_im_sdk.BlackListDeletedTips") - proto.RegisterType((*FriendInfoChangedTips)(nil), "open_im_sdk.FriendInfoChangedTips") - proto.RegisterType((*SelfInfoUpdatedTips)(nil), "open_im_sdk.SelfInfoUpdatedTips") + proto.RegisterType((*GroupInfo)(nil), "server_api_params.GroupInfo") + proto.RegisterType((*GroupMemberFullInfo)(nil), "server_api_params.GroupMemberFullInfo") + proto.RegisterType((*PublicUserInfo)(nil), "server_api_params.PublicUserInfo") + proto.RegisterType((*UserInfo)(nil), "server_api_params.UserInfo") + proto.RegisterType((*FriendInfo)(nil), "server_api_params.FriendInfo") + proto.RegisterType((*BlackInfo)(nil), "server_api_params.BlackInfo") + proto.RegisterType((*GroupRequest)(nil), "server_api_params.GroupRequest") + proto.RegisterType((*FriendRequest)(nil), "server_api_params.FriendRequest") + proto.RegisterType((*PullMessageBySeqListResp)(nil), "server_api_params.PullMessageBySeqListResp") + proto.RegisterType((*PullMessageBySeqListReq)(nil), "server_api_params.PullMessageBySeqListReq") + proto.RegisterType((*GetMaxAndMinSeqReq)(nil), "server_api_params.GetMaxAndMinSeqReq") + proto.RegisterType((*GetMaxAndMinSeqResp)(nil), "server_api_params.GetMaxAndMinSeqResp") + proto.RegisterType((*UserSendMsgResp)(nil), "server_api_params.UserSendMsgResp") + proto.RegisterType((*MsgData)(nil), "server_api_params.MsgData") + proto.RegisterMapType((map[string]bool)(nil), "server_api_params.MsgData.OptionsEntry") + proto.RegisterType((*OfflinePushInfo)(nil), "server_api_params.OfflinePushInfo") + proto.RegisterType((*TipsComm)(nil), "server_api_params.TipsComm") + proto.RegisterType((*GroupCreatedTips)(nil), "server_api_params.GroupCreatedTips") + proto.RegisterType((*GroupInfoSetTips)(nil), "server_api_params.GroupInfoSetTips") + proto.RegisterType((*JoinGroupApplicationTips)(nil), "server_api_params.JoinGroupApplicationTips") + proto.RegisterType((*MemberQuitTips)(nil), "server_api_params.MemberQuitTips") + proto.RegisterType((*GroupApplicationAcceptedTips)(nil), "server_api_params.GroupApplicationAcceptedTips") + proto.RegisterType((*GroupApplicationRejectedTips)(nil), "server_api_params.GroupApplicationRejectedTips") + proto.RegisterType((*GroupOwnerTransferredTips)(nil), "server_api_params.GroupOwnerTransferredTips") + proto.RegisterType((*MemberKickedTips)(nil), "server_api_params.MemberKickedTips") + proto.RegisterType((*MemberInvitedTips)(nil), "server_api_params.MemberInvitedTips") + proto.RegisterType((*MemberEnterTips)(nil), "server_api_params.MemberEnterTips") + proto.RegisterType((*FriendApplication)(nil), "server_api_params.FriendApplication") + proto.RegisterType((*FromToUserID)(nil), "server_api_params.FromToUserID") + proto.RegisterType((*FriendApplicationTips)(nil), "server_api_params.FriendApplicationTips") + proto.RegisterType((*FriendApplicationApprovedTips)(nil), "server_api_params.FriendApplicationApprovedTips") + proto.RegisterType((*FriendApplicationRejectedTips)(nil), "server_api_params.FriendApplicationRejectedTips") + proto.RegisterType((*FriendAddedTips)(nil), "server_api_params.FriendAddedTips") + proto.RegisterType((*FriendDeletedTips)(nil), "server_api_params.FriendDeletedTips") + proto.RegisterType((*BlackAddedTips)(nil), "server_api_params.BlackAddedTips") + proto.RegisterType((*BlackDeletedTips)(nil), "server_api_params.BlackDeletedTips") + proto.RegisterType((*FriendInfoChangedTips)(nil), "server_api_params.FriendInfoChangedTips") + proto.RegisterType((*UserInfoUpdatedTips)(nil), "server_api_params.UserInfoUpdatedTips") } -func init() { proto.RegisterFile("sdk_ws/ws.proto", fileDescriptor_ws_e632726fa8a2c9ae) } +func init() { proto.RegisterFile("sdk_ws/ws.proto", fileDescriptor_ws_dd0597f97f3a9074) } -var fileDescriptor_ws_e632726fa8a2c9ae = []byte{ - // 1649 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x58, 0xcd, 0x6e, 0x1b, 0x47, - 0x12, 0xc6, 0x70, 0x28, 0x8a, 0x2c, 0xea, 0xcf, 0xa3, 0x1f, 0x73, 0xb5, 0x0b, 0x2f, 0x31, 0x58, - 0x2c, 0x04, 0x63, 0x21, 0x63, 0xe5, 0x43, 0x1c, 0x07, 0x46, 0x2c, 0x89, 0x92, 0x4c, 0xc7, 0xb4, - 0x84, 0x91, 0x8c, 0x00, 0xb9, 0x18, 0xa3, 0x99, 0xa6, 0x34, 0xe1, 0xfc, 0x50, 0xd3, 0x43, 0x59, - 0x7a, 0x8a, 0xbc, 0x40, 0x82, 0xe4, 0x92, 0x4b, 0x8e, 0x39, 0xe4, 0x15, 0x02, 0xe4, 0x10, 0x24, - 0xd7, 0xe4, 0x9a, 0xd7, 0x08, 0x10, 0x54, 0x75, 0xcf, 0xb0, 0x9b, 0x54, 0x2c, 0x59, 0x4e, 0xec, - 0x20, 0xb7, 0xae, 0x8f, 0x55, 0xdd, 0x5f, 0xfd, 0x75, 0x17, 0x07, 0x66, 0xb9, 0xdf, 0x7b, 0xfe, - 0x82, 0xdf, 0x79, 0xc1, 0x57, 0xfb, 0x69, 0x92, 0x25, 0x56, 0x3d, 0xe9, 0xb3, 0xf8, 0x79, 0x10, - 0x3d, 0xe7, 0x7e, 0xcf, 0xfe, 0xce, 0x80, 0xc6, 0xde, 0x20, 0x0c, 0x3b, 0x8c, 0x73, 0xf7, 0x88, - 0x6d, 0x9c, 0xef, 0xb3, 0x93, 0x27, 0x01, 0xcf, 0x1c, 0xc6, 0xfb, 0xd6, 0x12, 0x54, 0x3a, 0xee, - 0xd9, 0x3e, 0x3b, 0x69, 0x18, 0x4d, 0x63, 0xc5, 0x74, 0xa4, 0x44, 0x78, 0x10, 0x23, 0x5e, 0x92, - 0x38, 0x49, 0xd6, 0xfb, 0x30, 0xbd, 0x1f, 0xc4, 0x47, 0x21, 0x7b, 0xc6, 0x59, 0xda, 0xe1, 0x47, - 0x0d, 0xb3, 0x69, 0xae, 0xd4, 0xd7, 0xfe, 0xb1, 0xaa, 0x9c, 0xb8, 0xba, 0xe3, 0x66, 0xc7, 0x2c, - 0xdd, 0x4e, 0xd2, 0xc8, 0xcd, 0x1c, 0x5d, 0xdf, 0x7a, 0x00, 0x53, 0x3b, 0x69, 0x32, 0xe8, 0xe7, - 0xf6, 0xe5, 0xcb, 0xec, 0x35, 0x75, 0xfb, 0x2e, 0xdc, 0xbc, 0xd8, 0x97, 0x13, 0xab, 0x01, 0x93, - 0x5c, 0x48, 0x0d, 0xa3, 0x69, 0xae, 0x98, 0x4e, 0x2e, 0xda, 0x0b, 0x60, 0xed, 0xb0, 0xac, 0xe3, - 0x9e, 0xad, 0xc7, 0xbe, 0xf0, 0xc3, 0x61, 0x27, 0xf6, 0x16, 0xcc, 0x8f, 0xa1, 0x22, 0x22, 0x91, - 0x16, 0x91, 0xa8, 0x88, 0x48, 0xa4, 0x45, 0x44, 0x48, 0xf6, 0x63, 0x98, 0x52, 0xf9, 0x5a, 0x33, - 0x50, 0x6a, 0xb7, 0xc8, 0xb6, 0xe6, 0x94, 0xda, 0x2d, 0xeb, 0x36, 0x94, 0x89, 0x53, 0x89, 0x1c, - 0x5d, 0xd2, 0x1c, 0xed, 0xf0, 0x23, 0xe9, 0x25, 0xe9, 0xd8, 0xbf, 0x96, 0xa0, 0x56, 0x60, 0x78, - 0xe2, 0x3e, 0x8b, 0xfd, 0x62, 0x37, 0x29, 0x21, 0xee, 0x30, 0xef, 0xb4, 0xdd, 0x22, 0x26, 0x35, - 0x47, 0x4a, 0x18, 0x00, 0x34, 0x4e, 0x93, 0xa8, 0x61, 0x36, 0x8d, 0x95, 0x09, 0x27, 0x17, 0xad, - 0x26, 0xd4, 0x37, 0x93, 0x38, 0x63, 0x71, 0x76, 0x70, 0xde, 0x67, 0x8d, 0x32, 0xfd, 0xaa, 0x42, - 0xa8, 0xb1, 0xcf, 0xd2, 0x53, 0x0a, 0x72, 0xbb, 0xd5, 0x98, 0xa0, 0x8d, 0x55, 0x08, 0x77, 0x97, - 0x06, 0x8d, 0x0a, 0xfd, 0x9a, 0x8b, 0xd6, 0x1c, 0x98, 0x18, 0x96, 0x49, 0x0a, 0x0b, 0x2e, 0xad, - 0x65, 0xa8, 0x22, 0xd7, 0x83, 0x20, 0x62, 0x8d, 0x2a, 0xc1, 0x85, 0x6c, 0xdd, 0x86, 0x39, 0x5c, - 0xb3, 0x74, 0x2f, 0x74, 0xb3, 0x6e, 0x92, 0x46, 0xed, 0x56, 0xa3, 0x46, 0x84, 0xc6, 0x70, 0xeb, - 0xbf, 0x30, 0x23, 0xb0, 0xa7, 0x81, 0xd7, 0x7b, 0xea, 0x46, 0xac, 0x01, 0x74, 0xf4, 0x08, 0x6a, - 0xfd, 0x07, 0xa6, 0x05, 0xb2, 0xed, 0x7a, 0xec, 0x99, 0xf3, 0xa4, 0x51, 0x27, 0x35, 0x1d, 0xa4, - 0x28, 0x84, 0x01, 0x8b, 0x33, 0xe1, 0xe3, 0x94, 0xf0, 0x51, 0x81, 0xec, 0xef, 0x4d, 0x98, 0xc1, - 0x4a, 0x43, 0xbb, 0x0e, 0x3f, 0xc2, 0xaa, 0xda, 0x80, 0xc9, 0xdd, 0x7e, 0x16, 0x24, 0x31, 0xa7, - 0xaa, 0xaa, 0xaf, 0xad, 0x68, 0x19, 0xd4, 0xb5, 0x57, 0xa5, 0xea, 0x56, 0x9c, 0xa5, 0xe7, 0x4e, - 0x6e, 0x78, 0x81, 0x1b, 0xa5, 0xab, 0xb9, 0x61, 0x5e, 0xe4, 0xc6, 0x2d, 0x00, 0x25, 0x74, 0x22, - 0x97, 0x0a, 0x22, 0x52, 0xc9, 0x79, 0x90, 0xc4, 0x94, 0xec, 0x09, 0x91, 0x6c, 0x05, 0x52, 0x0b, - 0xa5, 0xf2, 0xd2, 0x42, 0x99, 0x1c, 0x2f, 0x94, 0x61, 0xf1, 0x55, 0xb5, 0xe2, 0xfb, 0x17, 0xd4, - 0xb6, 0x93, 0xd4, 0x63, 0x54, 0xeb, 0xb5, 0xa6, 0xb9, 0x52, 0x73, 0x86, 0x80, 0x5a, 0x3c, 0xa0, - 0x17, 0xcf, 0x48, 0x52, 0xea, 0x63, 0x49, 0x59, 0xbe, 0x0f, 0x53, 0x6a, 0x58, 0xb1, 0xdc, 0x7a, - 0xec, 0x5c, 0xf6, 0x04, 0x2e, 0xad, 0x05, 0x98, 0x38, 0x75, 0xc3, 0x81, 0x08, 0xeb, 0x84, 0x23, - 0x84, 0xfb, 0xa5, 0x7b, 0x86, 0x7d, 0x02, 0xb3, 0x5a, 0x86, 0x78, 0x7f, 0xb4, 0xd2, 0x8d, 0xf1, - 0x4a, 0x1f, 0xa1, 0x54, 0x1a, 0xa3, 0x84, 0xf5, 0xcd, 0xf3, 0xfa, 0x36, 0x45, 0x7d, 0xe7, 0xb2, - 0xfd, 0x99, 0x49, 0xd1, 0x6d, 0xb9, 0x99, 0x8b, 0xc1, 0xe2, 0x5a, 0x07, 0xf3, 0xa2, 0x83, 0x53, - 0xad, 0x83, 0x85, 0x84, 0x27, 0x73, 0x25, 0x75, 0xa2, 0x8b, 0x55, 0x08, 0x03, 0x19, 0xc9, 0xd4, - 0x89, 0xcc, 0xe7, 0x22, 0xda, 0x7a, 0x4a, 0xea, 0x64, 0xda, 0x3d, 0xbd, 0xc7, 0xb9, 0xe2, 0xb9, - 0xe8, 0x62, 0x15, 0xc2, 0xdd, 0xa5, 0x01, 0xa5, 0xbe, 0xe6, 0xe4, 0xa2, 0xe6, 0x71, 0x55, 0xf7, - 0x18, 0x13, 0xc2, 0xd9, 0x09, 0x35, 0xb1, 0xe9, 0xe0, 0x12, 0x7b, 0x9c, 0x8f, 0xf6, 0x38, 0x88, - 0x1e, 0xe7, 0x17, 0xf4, 0x38, 0xd7, 0x9b, 0x43, 0xd4, 0xc0, 0x08, 0x8a, 0xcd, 0xc1, 0xb5, 0xe6, - 0x10, 0xfd, 0xab, 0x83, 0x14, 0x05, 0x25, 0x77, 0xd3, 0xc2, 0x47, 0x05, 0xb2, 0x3b, 0x30, 0xbb, - 0xdb, 0xed, 0x86, 0x41, 0xcc, 0xf6, 0x06, 0xfc, 0xb8, 0x1d, 0x77, 0x13, 0xac, 0x9f, 0x83, 0x20, - 0x0b, 0x99, 0xcc, 0x92, 0x10, 0x2c, 0x0b, 0xca, 0x2d, 0xc6, 0x3d, 0x99, 0x22, 0x5a, 0xa3, 0xab, - 0x5b, 0x67, 0x99, 0xec, 0x4b, 0x5c, 0xda, 0x5f, 0x95, 0xa0, 0x46, 0x2f, 0x14, 0xed, 0xd4, 0x80, - 0x49, 0x21, 0xe4, 0x19, 0xcf, 0x45, 0xec, 0x0f, 0x5a, 0x2a, 0xed, 0x3f, 0x04, 0x2c, 0x1b, 0xa6, - 0x9e, 0x26, 0x59, 0xd0, 0x0d, 0x3c, 0x17, 0x2b, 0x5d, 0x1e, 0xa0, 0x61, 0xa8, 0xd3, 0x8e, 0xb3, - 0x34, 0xf1, 0x07, 0x1e, 0xe9, 0x94, 0x85, 0x8e, 0x8a, 0xe1, 0xf9, 0x14, 0x89, 0x34, 0x94, 0x57, - 0x78, 0x2e, 0xe2, 0xb3, 0xb4, 0x75, 0x26, 0x73, 0x5e, 0xda, 0x3a, 0xb3, 0xfe, 0x0f, 0x13, 0xbb, - 0x2f, 0x62, 0x96, 0x52, 0xa2, 0xeb, 0x6b, 0xff, 0xd4, 0x6e, 0xb5, 0xbd, 0xc1, 0x61, 0x18, 0x78, - 0xd8, 0x39, 0xe8, 0x95, 0x23, 0x34, 0xf1, 0xe2, 0xd9, 0x4c, 0x99, 0x9b, 0xb1, 0xa2, 0x0a, 0xca, - 0x8e, 0x82, 0x60, 0xec, 0x3b, 0x2c, 0x3a, 0x64, 0xe9, 0x66, 0x32, 0x88, 0x33, 0xaa, 0x87, 0x69, - 0x47, 0x85, 0xec, 0x1f, 0x0d, 0x98, 0x27, 0xa7, 0x05, 0xb8, 0x3d, 0x08, 0xc3, 0x4b, 0xc2, 0xb6, - 0x04, 0x15, 0xa2, 0x51, 0x74, 0x8a, 0x90, 0x30, 0x39, 0x4e, 0x12, 0xe6, 0x2d, 0x42, 0x6b, 0xac, - 0xd1, 0xc7, 0x49, 0x10, 0x13, 0xbb, 0x32, 0xb1, 0x2b, 0x64, 0xfc, 0xad, 0xa8, 0x2f, 0x11, 0x99, - 0x42, 0x56, 0x83, 0x56, 0xd1, 0x83, 0x66, 0xc3, 0xd4, 0x76, 0x1a, 0xb0, 0xd8, 0x77, 0x58, 0xe4, - 0xa6, 0x3d, 0xd9, 0x14, 0x1a, 0x66, 0x7f, 0x63, 0x40, 0x35, 0x8f, 0x94, 0x42, 0xd7, 0x18, 0xa5, - 0xab, 0x24, 0x9e, 0xd6, 0x88, 0xb5, 0xbd, 0x22, 0xd7, 0xb4, 0x46, 0xfb, 0x1d, 0xaa, 0x67, 0xd9, - 0xdd, 0x52, 0xa2, 0x71, 0x2c, 0x39, 0x0c, 0xc2, 0x9c, 0xbc, 0x94, 0xb0, 0x72, 0x37, 0x82, 0x34, - 0x3b, 0x96, 0xc4, 0x85, 0x80, 0xe8, 0x56, 0xe4, 0x06, 0xa1, 0xe4, 0x2b, 0x04, 0x59, 0x01, 0xd5, - 0xbc, 0x02, 0xec, 0x63, 0x98, 0xd1, 0xf3, 0xfc, 0x67, 0xb1, 0xb7, 0x5b, 0x50, 0x3d, 0x08, 0xfa, - 0x7c, 0x33, 0x89, 0x22, 0xd4, 0x69, 0xb1, 0x0c, 0xc9, 0xc9, 0x33, 0x84, 0x84, 0xc5, 0xd3, 0x62, - 0x5d, 0x77, 0x10, 0x66, 0xa8, 0x9a, 0x5f, 0xba, 0x0a, 0x64, 0x7f, 0x6e, 0xc0, 0xac, 0xa8, 0x9b, - 0xad, 0x38, 0x63, 0x29, 0x62, 0xd6, 0xff, 0x60, 0x82, 0x2a, 0x85, 0x36, 0x1b, 0x9d, 0xae, 0x8a, - 0xb6, 0x74, 0x84, 0x92, 0x75, 0x0f, 0x2a, 0x62, 0x03, 0xda, 0xbe, 0xbe, 0xd6, 0x1c, 0x57, 0xd7, - 0x0b, 0xd3, 0x91, 0xfa, 0x78, 0xf9, 0xec, 0xf6, 0x59, 0x4a, 0x8d, 0x58, 0xdc, 0xfa, 0x65, 0x47, - 0x07, 0x15, 0x86, 0x4f, 0x98, 0x7b, 0xca, 0xfe, 0x82, 0x0c, 0x7f, 0x36, 0xe0, 0x86, 0x30, 0x68, - 0xc7, 0xa7, 0x41, 0xc6, 0xfc, 0xeb, 0x71, 0xdc, 0xa5, 0x79, 0xfc, 0xea, 0x1c, 0x85, 0xbe, 0xe2, - 0x9d, 0xf9, 0xba, 0xde, 0x95, 0x2f, 0xf2, 0xee, 0x27, 0x03, 0xe6, 0x84, 0xc1, 0x07, 0x81, 0xd7, - 0xfb, 0x9b, 0x39, 0xf7, 0xad, 0x01, 0x8b, 0xca, 0x2e, 0x9b, 0xc7, 0x6e, 0x7c, 0xc4, 0xa8, 0x6d, - 0xf1, 0x5e, 0x26, 0x89, 0x1e, 0x7e, 0x43, 0x0c, 0x84, 0x43, 0xe4, 0xad, 0xf8, 0xb4, 0x0c, 0xd5, - 0xce, 0x40, 0xbe, 0x14, 0xf2, 0x2e, 0xce, 0x65, 0xfb, 0x13, 0x03, 0x16, 0xf3, 0x22, 0xec, 0x26, - 0x82, 0xe8, 0x75, 0x72, 0xf5, 0x08, 0xa6, 0xd5, 0x58, 0xf8, 0xd2, 0x3d, 0xfb, 0xf7, 0x48, 0x0e, - 0x43, 0xe6, 0xe8, 0x86, 0xf6, 0x2f, 0x06, 0xcc, 0x91, 0xa2, 0x78, 0xcd, 0xae, 0x43, 0xe6, 0x3e, - 0x4c, 0x92, 0x71, 0x72, 0xf5, 0x28, 0xe7, 0x06, 0xd6, 0x43, 0x00, 0x79, 0x6d, 0xe0, 0xf0, 0x2c, - 0xfe, 0x51, 0x5f, 0x6e, 0xae, 0xd8, 0x5c, 0xb1, 0x84, 0xbe, 0x30, 0x60, 0xa1, 0x20, 0xae, 0xc6, - 0x1d, 0x27, 0x5e, 0x29, 0x0e, 0x4b, 0x48, 0x85, 0x86, 0xc1, 0x28, 0xbd, 0x5a, 0x17, 0x99, 0xaf, - 0x56, 0x71, 0xf6, 0xa7, 0x06, 0x2c, 0x3b, 0xcc, 0x63, 0xc1, 0x29, 0xc3, 0xb7, 0x7b, 0xbd, 0xdf, - 0x0f, 0xe5, 0xfc, 0xf3, 0x46, 0x6f, 0x53, 0xfa, 0x97, 0xe3, 0xf2, 0xe2, 0x7d, 0x93, 0x92, 0xfd, - 0xb5, 0x01, 0x0d, 0x85, 0xd3, 0x5e, 0x9a, 0x78, 0x8c, 0xf3, 0x37, 0x7c, 0xd3, 0x10, 0x39, 0x3e, - 0x08, 0x33, 0x39, 0xfd, 0x48, 0x49, 0x21, 0x5d, 0xd6, 0x48, 0x7f, 0x69, 0x00, 0x88, 0x91, 0x85, - 0xae, 0x8b, 0x26, 0xd4, 0x69, 0x9e, 0xd3, 0x9e, 0x7a, 0x15, 0x12, 0x1b, 0xd1, 0xc0, 0x53, 0x7c, - 0x60, 0x40, 0x69, 0x64, 0x00, 0x34, 0xc7, 0x06, 0xc0, 0x07, 0x30, 0x23, 0xce, 0xc9, 0x27, 0x0a, - 0x22, 0x52, 0x5f, 0x5b, 0x1c, 0xfb, 0xcb, 0x4c, 0xfe, 0x8c, 0x28, 0xdb, 0x3d, 0xb8, 0x21, 0x10, - 0x25, 0xc2, 0x38, 0x9c, 0xad, 0xfb, 0xbe, 0x52, 0xd3, 0xb9, 0x88, 0x13, 0xf5, 0xba, 0xef, 0xef, - 0x27, 0x83, 0xd4, 0xcb, 0xc7, 0xa2, 0x21, 0x80, 0x5c, 0xd7, 0x7d, 0xff, 0xc3, 0x24, 0xf5, 0x83, - 0xf8, 0x48, 0x8e, 0x47, 0x0a, 0x62, 0xff, 0x60, 0xc0, 0xad, 0xb1, 0xd3, 0xb0, 0x97, 0xd6, 0x7d, - 0x5f, 0xe6, 0xf3, 0x6e, 0x91, 0x21, 0xe3, 0xf2, 0x19, 0x39, 0x4f, 0xce, 0x43, 0xa8, 0x2b, 0x1b, - 0xca, 0xdc, 0xde, 0xd2, 0x2c, 0xc7, 0x8e, 0x75, 0x54, 0x13, 0xeb, 0x1d, 0xa8, 0xee, 0xf6, 0x99, - 0xaf, 0xb4, 0xcf, 0x4b, 0x0f, 0x2e, 0x94, 0xf1, 0x5e, 0xfd, 0xf7, 0xc5, 0x2e, 0x79, 0x1e, 0xeb, - 0x67, 0xd7, 0xf7, 0x49, 0x65, 0x54, 0xfa, 0x43, 0x18, 0x39, 0xec, 0x63, 0xe6, 0xbd, 0x0d, 0x46, - 0xdb, 0x30, 0x2f, 0x08, 0xe9, 0xa9, 0xbe, 0x03, 0x15, 0x01, 0x4b, 0x12, 0x37, 0x2f, 0x48, 0x98, - 0x20, 0x20, 0xd6, 0xf6, 0x23, 0x58, 0x1c, 0xee, 0xd3, 0x62, 0x21, 0xcb, 0xae, 0xbb, 0xd3, 0x26, - 0xcc, 0x6d, 0x84, 0xae, 0xd7, 0x93, 0x84, 0xae, 0xb7, 0xc9, 0x0e, 0x2c, 0x14, 0x9b, 0xbc, 0x16, - 0x9b, 0xc2, 0xaf, 0xd1, 0x27, 0xe2, 0x95, 0x77, 0xda, 0x83, 0xf9, 0x7d, 0x16, 0x76, 0x11, 0x7b, - 0xd6, 0xf7, 0x8b, 0x57, 0xf5, 0x5d, 0x98, 0x42, 0xb8, 0xb8, 0x21, 0x8c, 0x97, 0xdd, 0x10, 0x9a, - 0xea, 0xc6, 0xd2, 0x47, 0x0b, 0xab, 0x77, 0xc4, 0xa7, 0xee, 0xf7, 0x14, 0xf5, 0xc3, 0x0a, 0x7d, - 0xf4, 0xbe, 0xfb, 0x5b, 0x00, 0x00, 0x00, 0xff, 0xff, 0x47, 0x77, 0x52, 0x8c, 0x07, 0x17, 0x00, - 0x00, +var fileDescriptor_ws_dd0597f97f3a9074 = []byte{ + // 1901 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x59, 0x4f, 0x6f, 0x23, 0x4b, + 0x11, 0xd7, 0xd8, 0xb1, 0x63, 0x97, 0xe3, 0x38, 0x3b, 0xfb, 0x58, 0xcc, 0xb2, 0x6f, 0x09, 0xa3, + 0xa7, 0xc7, 0x0a, 0x89, 0x20, 0x2d, 0x42, 0x82, 0x45, 0x80, 0xb2, 0xc9, 0x26, 0xec, 0x23, 0x4e, + 0xc2, 0x38, 0xab, 0xc7, 0x01, 0x69, 0x35, 0xf1, 0xb4, 0x9d, 0x79, 0x19, 0x77, 0x8f, 0xbb, 0x67, + 0xb2, 0xbb, 0x12, 0x27, 0xf8, 0x0c, 0x70, 0xe4, 0xc0, 0x05, 0x71, 0x41, 0x5c, 0x10, 0x17, 0x8e, + 0x7c, 0x01, 0xce, 0x7c, 0x05, 0xae, 0x1c, 0x90, 0x90, 0x40, 0x5d, 0xdd, 0x33, 0xd3, 0x3d, 0x76, + 0xf2, 0x2c, 0x2b, 0xda, 0xbc, 0x9b, 0xab, 0xa6, 0xab, 0xba, 0xea, 0x57, 0x7f, 0xba, 0xba, 0x0d, + 0x3d, 0x11, 0x5e, 0xbe, 0x7e, 0x23, 0xbe, 0xfd, 0x46, 0xec, 0x24, 0x9c, 0xa5, 0xcc, 0xbd, 0x27, + 0x08, 0xbf, 0x22, 0xfc, 0x75, 0x90, 0x44, 0xaf, 0x93, 0x80, 0x07, 0x53, 0xe1, 0xfd, 0xbb, 0x06, + 0xed, 0x43, 0xce, 0xb2, 0xe4, 0x25, 0x1d, 0x33, 0xb7, 0x0f, 0xeb, 0x13, 0x24, 0xf6, 0xfb, 0xce, + 0xb6, 0xf3, 0xa4, 0xed, 0xe7, 0xa4, 0xfb, 0x08, 0xda, 0xf8, 0xf3, 0x38, 0x98, 0x92, 0x7e, 0x0d, + 0xbf, 0x95, 0x0c, 0xd7, 0x83, 0x0d, 0xca, 0xd2, 0x68, 0x1c, 0x8d, 0x82, 0x34, 0x62, 0xb4, 0x5f, + 0xc7, 0x05, 0x16, 0x4f, 0xae, 0x89, 0x68, 0xca, 0x59, 0x98, 0x8d, 0x70, 0xcd, 0x9a, 0x5a, 0x63, + 0xf2, 0xe4, 0xfe, 0xe3, 0x60, 0x44, 0x5e, 0xf9, 0x47, 0xfd, 0x86, 0xda, 0x5f, 0x93, 0xee, 0x36, + 0x74, 0xd8, 0x1b, 0x4a, 0xf8, 0x2b, 0x41, 0xf8, 0xcb, 0xfd, 0x7e, 0x13, 0xbf, 0x9a, 0x2c, 0xf7, + 0x31, 0xc0, 0x88, 0x93, 0x20, 0x25, 0x67, 0xd1, 0x94, 0xf4, 0xd7, 0xb7, 0x9d, 0x27, 0x5d, 0xdf, + 0xe0, 0x48, 0x0d, 0x53, 0x32, 0x3d, 0x27, 0x7c, 0x8f, 0x65, 0x34, 0xed, 0xb7, 0x70, 0x81, 0xc9, + 0x72, 0x37, 0xa1, 0x46, 0xde, 0xf6, 0xdb, 0xa8, 0xba, 0x46, 0xde, 0xba, 0x0f, 0xa0, 0x29, 0xd2, + 0x20, 0xcd, 0x44, 0x1f, 0xb6, 0x9d, 0x27, 0x0d, 0x5f, 0x53, 0xee, 0x47, 0xd0, 0x45, 0xbd, 0x2c, + 0xb7, 0xa6, 0x83, 0x22, 0x36, 0xb3, 0x40, 0xec, 0xec, 0x5d, 0x42, 0xfa, 0x1b, 0xa8, 0xa0, 0x64, + 0x78, 0x7f, 0xad, 0xc1, 0x7d, 0xc4, 0x7d, 0x80, 0x06, 0x1c, 0x64, 0x71, 0xfc, 0x39, 0x11, 0x78, + 0x00, 0xcd, 0x4c, 0x6d, 0xa7, 0xe0, 0xd7, 0x94, 0xdc, 0x87, 0xb3, 0x98, 0x1c, 0x91, 0x2b, 0x12, + 0x23, 0xf0, 0x0d, 0xbf, 0x64, 0xb8, 0x0f, 0xa1, 0xf5, 0x19, 0x8b, 0x28, 0x62, 0x22, 0x11, 0xaf, + 0xfb, 0x05, 0x2d, 0xbf, 0xd1, 0x68, 0x74, 0x49, 0x65, 0x48, 0x15, 0xdc, 0x05, 0x6d, 0x46, 0xa2, + 0x69, 0x47, 0xe2, 0x63, 0xd8, 0x0c, 0x92, 0x64, 0x10, 0xd0, 0x09, 0xe1, 0x6a, 0xd3, 0x75, 0xdc, + 0xb4, 0xc2, 0x95, 0xf1, 0x90, 0x3b, 0x0d, 0x59, 0xc6, 0x47, 0x04, 0xe1, 0x6e, 0xf8, 0x06, 0x47, + 0xea, 0x61, 0x09, 0xe1, 0x06, 0x8c, 0x0a, 0xf9, 0x0a, 0x57, 0x47, 0x05, 0xf2, 0xa8, 0x78, 0xbf, + 0x73, 0x60, 0xf3, 0x34, 0x3b, 0x8f, 0xa3, 0x11, 0x2e, 0x90, 0xa0, 0x95, 0xd0, 0x38, 0x16, 0x34, + 0xa6, 0x83, 0xb5, 0xeb, 0x1d, 0xac, 0xdb, 0x0e, 0x3e, 0x80, 0xe6, 0x84, 0xd0, 0x90, 0x70, 0x04, + 0xac, 0xe1, 0x6b, 0x6a, 0x81, 0xe3, 0x8d, 0x45, 0x8e, 0x7b, 0xbf, 0xad, 0x41, 0xeb, 0x3d, 0x9b, + 0xb6, 0x0d, 0x9d, 0xe4, 0x82, 0x51, 0x72, 0x9c, 0xc9, 0x64, 0xd2, 0xc1, 0x34, 0x59, 0xee, 0x07, + 0xd0, 0x38, 0x8f, 0x78, 0x7a, 0x81, 0xd1, 0xec, 0xfa, 0x8a, 0x90, 0x5c, 0x32, 0x0d, 0x22, 0x15, + 0xc2, 0xb6, 0xaf, 0x08, 0x8d, 0x78, 0xab, 0xa8, 0x03, 0xbb, 0xb2, 0xda, 0x73, 0x95, 0x35, 0x0f, + 0x0c, 0x2c, 0x04, 0xe6, 0x3f, 0x0e, 0xc0, 0x01, 0x8f, 0x08, 0x0d, 0x11, 0x9a, 0x4a, 0x49, 0x3b, + 0xf3, 0x25, 0xfd, 0x00, 0x9a, 0x9c, 0x4c, 0x03, 0x7e, 0x99, 0xa7, 0xbc, 0xa2, 0x2a, 0x06, 0xd5, + 0xe7, 0x0c, 0xfa, 0x01, 0xc0, 0x18, 0xf7, 0x91, 0x7a, 0x10, 0xaa, 0xce, 0xd3, 0xaf, 0xee, 0xcc, + 0x35, 0xbf, 0x9d, 0x3c, 0x4a, 0xbe, 0xb1, 0x5c, 0xd6, 0x53, 0x10, 0x86, 0x3a, 0x6d, 0x55, 0x84, + 0x4b, 0xc6, 0x82, 0xac, 0x6d, 0xde, 0x90, 0xb5, 0xeb, 0x45, 0xd6, 0xfe, 0xcb, 0x81, 0xf6, 0xf3, + 0x38, 0x18, 0x5d, 0x2e, 0xe9, 0xba, 0xed, 0x62, 0x6d, 0xce, 0xc5, 0x43, 0xe8, 0x9e, 0x4b, 0x75, + 0xb9, 0x0b, 0x88, 0x42, 0xe7, 0xe9, 0xd7, 0x17, 0x78, 0x69, 0x17, 0x8b, 0x6f, 0xcb, 0xd9, 0xee, + 0xae, 0x7d, 0xbe, 0xbb, 0x8d, 0x1b, 0xdc, 0x6d, 0x16, 0xee, 0xfe, 0xa3, 0x06, 0x1b, 0xd8, 0xde, + 0x7c, 0x32, 0xcb, 0x88, 0x48, 0xdd, 0x1f, 0x42, 0x2b, 0xcb, 0x4d, 0x75, 0x96, 0x35, 0xb5, 0x10, + 0x71, 0x9f, 0xe9, 0x66, 0x8a, 0xf2, 0x35, 0x94, 0x7f, 0xb4, 0x40, 0xbe, 0x38, 0xc9, 0xfc, 0x72, + 0xb9, 0x3c, 0x78, 0x2e, 0x02, 0x1a, 0xc6, 0xc4, 0x27, 0x22, 0x8b, 0x53, 0xdd, 0x23, 0x2d, 0x9e, + 0xca, 0xb4, 0xd9, 0x40, 0x4c, 0xf4, 0xb1, 0xa4, 0x29, 0x89, 0x8e, 0x5a, 0x27, 0x3f, 0x29, 0xd7, + 0x4b, 0x86, 0x2c, 0x54, 0x4e, 0x66, 0x18, 0x21, 0x55, 0x56, 0x39, 0x59, 0xee, 0xa9, 0x51, 0x53, + 0x89, 0x60, 0xf1, 0x64, 0x88, 0x15, 0x8d, 0x0a, 0xd4, 0x79, 0x64, 0x70, 0xaa, 0xc7, 0x91, 0xf7, + 0xcf, 0x3a, 0x74, 0x55, 0xf9, 0xe4, 0xa0, 0x3e, 0x96, 0x79, 0xce, 0xa6, 0x56, 0x16, 0x19, 0x1c, + 0x69, 0x85, 0xa4, 0x8e, 0xed, 0x46, 0x63, 0xf1, 0x64, 0x2a, 0x4a, 0xfa, 0xc0, 0x6a, 0x38, 0x26, + 0x2b, 0xdf, 0xe5, 0xd0, 0x6c, 0x3c, 0x06, 0x47, 0xb6, 0xb2, 0x94, 0x59, 0xd9, 0x51, 0xd0, 0x52, + 0x36, 0x65, 0xc5, 0xfe, 0x2a, 0x3f, 0x0c, 0x8e, 0xc4, 0x37, 0x65, 0xf9, 0xde, 0x0a, 0xa4, 0x92, + 0xa1, 0x34, 0xeb, 0x7d, 0xd5, 0x01, 0x52, 0xd0, 0x73, 0x51, 0x6d, 0xdf, 0x18, 0x55, 0xb0, 0xa2, + 0x6a, 0x17, 0x57, 0x67, 0xae, 0xb8, 0x3e, 0x82, 0xae, 0xd2, 0x93, 0x27, 0xfd, 0x86, 0x3a, 0xe0, + 0x2d, 0xa6, 0x9d, 0x1b, 0xdd, 0x6a, 0x6e, 0xd8, 0xd1, 0xdd, 0xbc, 0x26, 0xba, 0xbd, 0x22, 0xba, + 0xbf, 0x84, 0xfe, 0x69, 0x16, 0xc7, 0x03, 0x22, 0x44, 0x30, 0x21, 0xcf, 0xdf, 0x0d, 0xc9, 0xec, + 0x28, 0x12, 0xa9, 0x4f, 0x44, 0x22, 0xf3, 0x8c, 0x70, 0xbe, 0xc7, 0x42, 0x82, 0x41, 0x6e, 0xf8, + 0x39, 0x29, 0x3d, 0x24, 0x9c, 0x4b, 0x03, 0x74, 0x87, 0x54, 0x94, 0xbb, 0x03, 0x6b, 0x71, 0x24, + 0x64, 0xae, 0xd7, 0x9f, 0x74, 0x9e, 0x3e, 0x5c, 0x50, 0x2a, 0x03, 0x31, 0xd9, 0x0f, 0xd2, 0xc0, + 0xc7, 0x75, 0xde, 0x14, 0xbe, 0xbc, 0x78, 0xf7, 0xd9, 0xb5, 0x27, 0x98, 0xec, 0x61, 0xd8, 0x04, + 0x22, 0x46, 0x8b, 0xa1, 0xc4, 0x64, 0x49, 0xb3, 0x85, 0xd2, 0x83, 0x76, 0x74, 0xfd, 0x9c, 0xf4, + 0x3e, 0x00, 0xf7, 0x90, 0xa4, 0x83, 0xe0, 0xed, 0x2e, 0x0d, 0x07, 0x11, 0x1d, 0x92, 0x99, 0x4f, + 0x66, 0xde, 0x0b, 0xb8, 0x3f, 0xc7, 0x15, 0x89, 0x34, 0x60, 0x1a, 0xbc, 0x1d, 0x92, 0x19, 0x1a, + 0xd0, 0xf5, 0x35, 0x85, 0x7c, 0x5c, 0xa5, 0xdb, 0xa3, 0xa6, 0xbc, 0x19, 0xf4, 0x64, 0x84, 0x86, + 0x84, 0x86, 0x03, 0x31, 0x41, 0x15, 0xdb, 0xd0, 0x51, 0x08, 0x0c, 0xc4, 0xa4, 0xec, 0xb7, 0x06, + 0x4b, 0xae, 0x18, 0xc5, 0x11, 0xa1, 0xa9, 0x5a, 0xa1, 0xbd, 0x31, 0x58, 0x32, 0x19, 0x05, 0xa1, + 0x61, 0x71, 0xe4, 0xd4, 0xfd, 0x82, 0xf6, 0xfe, 0xd6, 0x80, 0x75, 0x0d, 0x28, 0x4e, 0x8d, 0xf2, + 0x88, 0x2b, 0xf0, 0x52, 0x94, 0x4a, 0xc6, 0xd1, 0x55, 0x39, 0xbf, 0x29, 0xca, 0x9c, 0xf8, 0xea, + 0xf6, 0xc4, 0x57, 0xb1, 0x69, 0x6d, 0xde, 0xa6, 0x8a, 0x5f, 0x8d, 0x79, 0xbf, 0xbe, 0x09, 0x5b, + 0x02, 0x0b, 0xe6, 0x34, 0x0e, 0xd2, 0x31, 0xe3, 0x53, 0x7d, 0x62, 0x35, 0xfc, 0x39, 0xbe, 0x6c, + 0xf6, 0x8a, 0x57, 0x14, 0xac, 0xaa, 0xc8, 0x0a, 0x57, 0x96, 0x87, 0xe2, 0xe4, 0x85, 0xab, 0x46, + 0x05, 0x9b, 0xa9, 0x6c, 0x13, 0x22, 0x62, 0x14, 0x27, 0x60, 0x55, 0x9f, 0x26, 0x4b, 0x7a, 0x3e, + 0x15, 0x93, 0x03, 0xce, 0xa6, 0x7a, 0x60, 0xc8, 0x49, 0xf4, 0x9c, 0xd1, 0x94, 0xd0, 0x14, 0x65, + 0x3b, 0x4a, 0xd6, 0x60, 0x49, 0x59, 0x4d, 0x62, 0x71, 0x6e, 0xf8, 0x39, 0xe9, 0x6e, 0x41, 0x5d, + 0x90, 0x99, 0xae, 0x38, 0xf9, 0xd3, 0x8a, 0x5c, 0xcf, 0x8e, 0x5c, 0xa5, 0x15, 0x6c, 0xe1, 0x57, + 0xb3, 0x15, 0x94, 0x77, 0x80, 0x7b, 0xd6, 0x1d, 0x60, 0x17, 0xd6, 0x59, 0x22, 0xf3, 0x5c, 0xf4, + 0x5d, 0xac, 0xb1, 0x6f, 0x5c, 0x5f, 0x63, 0x3b, 0x27, 0x6a, 0xe5, 0x0b, 0x9a, 0xf2, 0x77, 0x7e, + 0x2e, 0xe7, 0x1e, 0x41, 0x8f, 0x8d, 0xc7, 0x71, 0x44, 0xc9, 0x69, 0x26, 0x2e, 0xf0, 0x64, 0xbb, + 0x8f, 0x27, 0x9b, 0xb7, 0x40, 0xd5, 0x89, 0xbd, 0xd2, 0xaf, 0x8a, 0x3e, 0x7c, 0x06, 0x1b, 0xe6, + 0x36, 0x12, 0x86, 0x4b, 0xf2, 0x4e, 0xe7, 0xa0, 0xfc, 0x29, 0x87, 0xbd, 0xab, 0x20, 0xce, 0xd4, + 0x31, 0xd0, 0xf2, 0x15, 0xf1, 0xac, 0xf6, 0x3d, 0xc7, 0xfb, 0x8d, 0x03, 0xbd, 0xca, 0x06, 0x72, + 0x75, 0x1a, 0xa5, 0x31, 0xd1, 0x1a, 0x14, 0xe1, 0xba, 0xb0, 0x16, 0x12, 0x31, 0xd2, 0x29, 0x8c, + 0xbf, 0x75, 0x27, 0xab, 0x17, 0xe3, 0xa2, 0xbc, 0xe8, 0x9d, 0x0c, 0xa5, 0xa2, 0x21, 0xcb, 0x68, + 0x58, 0x5c, 0xf4, 0x0c, 0x9e, 0x4c, 0xa1, 0xe8, 0x64, 0xf8, 0x3c, 0x08, 0x27, 0x44, 0x5d, 0xc7, + 0x1a, 0x68, 0x93, 0xcd, 0xf4, 0xf6, 0xa1, 0x75, 0x16, 0x25, 0x62, 0x8f, 0x4d, 0xa7, 0x32, 0x10, + 0x21, 0x49, 0xe5, 0xac, 0xea, 0x60, 0xbc, 0x35, 0x25, 0x53, 0x25, 0x24, 0xe3, 0x20, 0x8b, 0x53, + 0xb9, 0x34, 0x2f, 0x5c, 0x83, 0xe5, 0xfd, 0xbd, 0x06, 0x5b, 0x38, 0x18, 0xec, 0x61, 0x58, 0x43, + 0xc9, 0x74, 0x9f, 0x42, 0x03, 0xcb, 0x4c, 0x0f, 0x23, 0x37, 0x0f, 0x13, 0x6a, 0xa9, 0xfb, 0x23, + 0x68, 0xb2, 0x04, 0x47, 0x4a, 0x35, 0x81, 0x7c, 0x7c, 0x9d, 0x90, 0x7d, 0xa7, 0xf3, 0xb5, 0x94, + 0x7b, 0x00, 0xa0, 0xae, 0x9b, 0x47, 0x65, 0x6b, 0x5e, 0x56, 0x87, 0x21, 0x29, 0xc1, 0x2b, 0xda, + 0xac, 0x71, 0xb1, 0xb3, 0x99, 0xee, 0x31, 0x6c, 0xa2, 0xd9, 0x27, 0xf9, 0x54, 0x89, 0x18, 0x2f, + 0xbf, 0x63, 0x45, 0xda, 0xfb, 0xbd, 0xa3, 0x61, 0x94, 0x5f, 0x87, 0x04, 0xb1, 0x35, 0x20, 0x71, + 0x56, 0x82, 0xe4, 0x21, 0xb4, 0xa6, 0x99, 0x31, 0xe4, 0xd6, 0xfd, 0x82, 0x2e, 0x43, 0x54, 0x5f, + 0x3a, 0x44, 0xde, 0x1f, 0x1c, 0xe8, 0x7f, 0xc2, 0x22, 0x8a, 0x1f, 0x76, 0x93, 0x24, 0xd6, 0xaf, + 0x0f, 0x2b, 0xc7, 0xfc, 0xc7, 0xd0, 0x0e, 0x94, 0x1a, 0x9a, 0xea, 0xb0, 0x2f, 0x31, 0xb8, 0x96, + 0x32, 0xc6, 0x0c, 0x52, 0x37, 0x67, 0x10, 0xef, 0x4f, 0x0e, 0x6c, 0x2a, 0x50, 0x7e, 0x96, 0x45, + 0xe9, 0xca, 0xf6, 0x3d, 0x87, 0xd6, 0x2c, 0x8b, 0xd2, 0x15, 0xb2, 0xb2, 0x90, 0x9b, 0xcf, 0xa7, + 0xfa, 0x82, 0x7c, 0xf2, 0xfe, 0xec, 0xc0, 0xa3, 0x2a, 0xac, 0xbb, 0xa3, 0x11, 0x49, 0xee, 0xb2, + 0xa4, 0xac, 0x19, 0x6c, 0xad, 0x32, 0x83, 0x2d, 0x34, 0xd9, 0x27, 0x9f, 0x91, 0xd1, 0x17, 0xd7, + 0xe4, 0x5f, 0xd7, 0xe0, 0x2b, 0x87, 0x45, 0xe1, 0x9d, 0xf1, 0x80, 0x8a, 0x31, 0xe1, 0xfc, 0x0e, + 0xed, 0x3d, 0x82, 0x2e, 0x25, 0x6f, 0x4a, 0x9b, 0x74, 0x39, 0x2e, 0xab, 0xc6, 0x16, 0x5e, 0xae, + 0x77, 0x79, 0xff, 0x75, 0x60, 0x4b, 0xe9, 0xf9, 0x69, 0x34, 0xba, 0xbc, 0x43, 0xe7, 0x8f, 0x61, + 0xf3, 0x12, 0x2d, 0x90, 0xd4, 0x0a, 0x6d, 0xbb, 0x22, 0xbd, 0xa4, 0xfb, 0xff, 0x73, 0xe0, 0x9e, + 0x52, 0xf4, 0x92, 0x5e, 0x45, 0x77, 0x99, 0xac, 0xa7, 0xd0, 0x8b, 0x94, 0x09, 0x2b, 0x02, 0x50, + 0x15, 0x5f, 0x12, 0x81, 0xbf, 0x38, 0xd0, 0x53, 0x9a, 0x5e, 0xd0, 0x94, 0xf0, 0x95, 0xfd, 0xff, + 0x09, 0x74, 0x08, 0x4d, 0x79, 0x40, 0x57, 0xe9, 0x90, 0xa6, 0xe8, 0x92, 0x4d, 0xf2, 0x12, 0xee, + 0xa9, 0x2b, 0xba, 0xd1, 0x71, 0xe4, 0xac, 0x1a, 0x84, 0x6a, 0xfc, 0x74, 0x50, 0x28, 0x27, 0xed, + 0xc7, 0x17, 0xfd, 0xaa, 0x5e, 0x3e, 0xbe, 0x3c, 0x06, 0x08, 0xc2, 0xf0, 0x53, 0xc6, 0xc3, 0x88, + 0xe6, 0xc7, 0x87, 0xc1, 0xf1, 0x3e, 0x81, 0x0d, 0x39, 0x2d, 0x9f, 0x19, 0x97, 0xed, 0x1b, 0x9f, + 0x03, 0xcc, 0x8b, 0x7a, 0xcd, 0xbe, 0xa8, 0x7b, 0xbf, 0x80, 0x2f, 0xcd, 0x19, 0x8e, 0xa8, 0xef, + 0xa9, 0x37, 0x84, 0x7c, 0x13, 0x0d, 0xfe, 0xd7, 0x16, 0x40, 0x68, 0xda, 0xe2, 0x5b, 0x42, 0xde, + 0xaf, 0x1c, 0xf8, 0x70, 0x4e, 0xfd, 0x6e, 0x92, 0x70, 0x76, 0xa5, 0x93, 0xfb, 0x36, 0xb6, 0xb1, + 0x5b, 0x6b, 0xad, 0xda, 0x5a, 0x17, 0x1a, 0x61, 0x1d, 0x07, 0xef, 0xc1, 0x88, 0x3f, 0x3a, 0xd0, + 0xd3, 0x46, 0x84, 0xa1, 0xde, 0xf6, 0xbb, 0xd0, 0x54, 0xef, 0x8f, 0x7a, 0xc3, 0x0f, 0x17, 0x6e, + 0x98, 0xbf, 0x9b, 0xfa, 0x7a, 0xf1, 0x7c, 0x46, 0xd6, 0x16, 0x8d, 0x81, 0xdf, 0x2f, 0x3a, 0xc0, + 0xd2, 0x2f, 0x84, 0x5a, 0xc0, 0xfb, 0x79, 0x9e, 0xcc, 0xfb, 0x24, 0x26, 0xb7, 0x89, 0x91, 0xf7, + 0x0a, 0x36, 0xf1, 0x31, 0xb4, 0xc4, 0xe0, 0x56, 0xd4, 0x7e, 0x0a, 0x5b, 0xa8, 0xf6, 0xd6, 0xed, + 0x2d, 0xaa, 0x43, 0xe2, 0xb3, 0x77, 0x11, 0xd0, 0xc9, 0x6d, 0x6a, 0xff, 0x16, 0xdc, 0xcf, 0xb1, + 0x7f, 0x95, 0x84, 0xc5, 0x15, 0xe5, 0x9a, 0x87, 0x97, 0xf3, 0x26, 0xfe, 0x99, 0xf7, 0x9d, 0xff, + 0x07, 0x00, 0x00, 0xff, 0xff, 0x5a, 0xb7, 0x8c, 0x6a, 0xdf, 0x1b, 0x00, 0x00, } diff --git a/pkg/proto/sdk_ws/ws.proto b/pkg/proto/sdk_ws/ws.proto index f2279873e..a3f018db3 100644 --- a/pkg/proto/sdk_ws/ws.proto +++ b/pkg/proto/sdk_ws/ws.proto @@ -1,269 +1,332 @@ syntax = "proto3"; -package open_im_sdk;//The package name to which the proto file belongs -option go_package = "./sdk_ws;open_im_sdk";//The generated go pb file is in the current directory, and the package name is open_im_sdk +package server_api_params;//The package name to which the proto file belongs +//option go_package = "./sdk_ws;open_im_sdk";//The generated go pb file is in the current directory, and the package name is open_im_sdk + +////////////////////////////////base/////////////////////////////// + + +message GroupInfo{ + string groupID = 1; + string groupName = 2; + string notification = 3; + string introduction = 4; + string faceURL = 5; + string ownerUserID = 6; + uint32 createTime = 7; + uint32 memberCount = 8; + string ex = 9; + int32 status = 10; + string creatorUserID = 11; + int32 groupType = 12; +} + + +message GroupMemberFullInfo { + string groupID = 1 ; + string userID = 2 ; + int32 roleLevel = 3; + int64 joinTime = 4; + string nickname = 5; + string faceURL = 6; + int32 appMangerLevel = 7; //if >0 + int32 joinSource = 8; + string operatorUserID = 9; + string ex = 10; +} + +message PublicUserInfo{ + string userID = 1; + string nickname = 2; + string faceURL = 3; + int32 gender = 4; + int32 appMangerLevel = 5; //if >0 +} + +message UserInfo{ + string userID = 1; + string nickname = 2; + string faceURL = 3; + int32 gender = 4; + string phoneNumber = 5; + uint32 birth = 6; + string email = 7; + string ex = 8; + uint32 createTime = 9; + int32 appMangerLevel = 10; +} + +message FriendInfo{ + string ownerUserID = 1; + string remark = 2; + uint32 createTime = 3; + UserInfo friendUser = 4; + int32 addSource = 5; + string operatorUserID = 6; + string ex = 7; +} + +message BlackInfo{ + string ownerUserID = 1; + uint32 createTime = 2; + PublicUserInfo blackUserInfo = 3; + int32 addSource = 4; + string operatorUserID = 5; + string ex = 6; +} + +message GroupRequest{ + PublicUserInfo userInfo = 1; + GroupInfo groupInfo = 2; + int32 handleResult = 3; + string reqMsg = 4; + string handleMsg = 5; + uint32 reqTime = 6; + string handleUserID = 7; + uint32 handleTime = 8; + string ex = 9; +} + +message FriendRequest{ + string fromUserID = 1; + string fromNickname = 2; + string fromFaceURL = 3; + int32 fromGender = 4; + string toUserID = 5; + string toNickname = 6; + string toFaceURL = 7; + int32 toGender = 8; + int32 handleResult = 9; + string reqMsg = 10; + uint32 createTime = 11; + string handlerUserID = 12; + string handleMsg = 13; + uint32 handleTime = 14; + string ex = 15; +} + +///////////////////////////////////base end///////////////////////////////////// message PullMessageBySeqListResp { - int64 MaxSeq = 1; - int64 MinSeq = 2; - repeated GatherFormat SingleUserMsg = 3; - repeated GatherFormat GroupUserMsg = 4; + int32 errCode = 1; + string errMsg = 2; + repeated MsgData list = 3; } message PullMessageBySeqListReq{ - repeated int64 seqList =1; + string userID = 1; + string operationID = 2; + repeated uint32 seqList = 3; } message GetMaxAndMinSeqReq { } message GetMaxAndMinSeqResp { - int64 maxSeq = 1; - int64 minSeq = 2; -} -message GatherFormat{ - // @inject_tag: json:"id" - string ID = 1; - // @inject_tag: json:"list" - repeated MsgFormat List = 2;//detail msg -} -message MsgFormat{ - // @inject_tag: json:"sendID" - string SendID = 1; - // @inject_tag: json:"recvID" - string RecvID = 2; - // @inject_tag: json:"msgFrom" - int32 MsgFrom = 3; - // @inject_tag: json:"contentType" - int32 ContentType = 4; - // @inject_tag: json:"serverMsgID" - string ServerMsgID = 5; - // @inject_tag: json:"content" - string Content = 6; - // @inject_tag: json:"seq" - int64 Seq = 7; - // @inject_tag: json:"sendTime" - int64 SendTime = 8; - // @inject_tag: json:"senderPlatformID" - int32 SenderPlatformID = 9; - // @inject_tag: json:"senderNickName" - string SenderNickName = 10; - // @inject_tag: json:"senderFaceUrl" - string SenderFaceURL = 11; - // @inject_tag: json:"clientMsgID" - string ClientMsgID = 12; -} - -message UserSendMsgReq { - map Options= 1; - string SenderNickName = 2; - string SenderFaceURL = 3; - int32 PlatformID = 4; - int32 SessionType = 5; - int32 MsgFrom = 6; - int32 ContentType = 7; - string RecvID = 8; - repeated string ForceList = 9; - string Content = 10; - string ClientMsgID = 11; + uint32 maxSeq = 1; + uint32 minSeq = 2; } message UserSendMsgResp { - string ServerMsgID = 1; - string ClientMsgID = 2; + string serverMsgID = 1; + string clientMsgID = 2; int64 sendTime = 3; } message MsgData { string sendID = 1; string recvID = 2; - int32 sessionType = 3; - int32 msgFrom = 4; - int32 contentType = 5; - string serverMsgID = 6; - string content =7; - int64 sendTime =8; - int64 seq =9; - int32 senderPlatformID =10; - string senderNickName =11; - string senderFaceURL =12; - string clientMsgID =13; + string groupID = 3; + string clientMsgID = 4; + string serverMsgID = 5; + int32 senderPlatformID = 6; + string senderNickname = 7; + string senderFaceURL = 8; + int32 sessionType = 9; + int32 msgFrom = 10; + int32 contentType = 11; + bytes content = 12; + uint32 seq = 14; + int64 sendTime = 15; + int64 createTime = 16; + int32 status = 17; + map options = 18; + OfflinePushInfo offlinePushInfo = 19; } message OfflinePushInfo{ - string Title = 1; - string Desc = 2; - string Ext = 3; -} - -//public -message GroupInfo{ - string GroupID = 1; - string GroupName = 2; - string Notification = 3; - string Introduction = 4; - string FaceUrl = 5; - string Ex = 6; - PublicUserInfo Owner = 7; - uint64 CreateTime = 8; - uint32 MemberCount = 9; + string title = 1; + string desc = 2; + string ex = 3; + string iOSPushSound = 4; + bool iOSBadgeCount = 5; } -//private, Group members have permission to view -message GroupMemberFullInfo { - string GroupID = 1 ; - string UserID = 2 ; - int32 Role = 3; - uint64 JoinTime = 4; - string NickName = 5; - string FaceUrl = 6; - string FriendRemark = 7; -} -//private, Friends have permission to view -message UserInfo{ - string UserID = 1; - string Name = 2; - string Icon = 3; - int32 Gender = 4; - string Mobile = 5; - string Birth = 6; - string Email = 7; - string Ex = 8; -} -//No permissions required -message PublicUserInfo{ - string UserID = 1; - string Name = 2; - string Icon = 3; - int32 Gender = 4; -} + + + + message TipsComm{ - string Detail = 1; - string DefaultTips = 2; + bytes detail = 1; + string defaultTips = 2; } //////////////////////group///////////////////// + + +// OnGroupCreated() +message GroupCreatedTips{ + GroupInfo group = 1; + GroupMemberFullInfo opUser = 2; + repeated GroupMemberFullInfo memberList = 3; + int64 operationTime = 4; + GroupMemberFullInfo groupOwnerUser = 5; +} + +// OnGroupInfoSet() +message GroupInfoSetTips{ + GroupMemberFullInfo opUser = 1; //who do this + int64 muteTime = 2; + GroupInfo group = 3; +} + +// OnJoinGroupApplication() +message JoinGroupApplicationTips{ + GroupInfo group = 1; + PublicUserInfo applicant = 2; + string reqMsg = 3; +} + +// OnQuitGroup() +//Actively leave the group +message MemberQuitTips{ + GroupInfo group = 1; + GroupMemberFullInfo quitUser = 2; + int64 operationTime = 3; +} + + +// OnApplicationGroupAccepted() +message GroupApplicationAcceptedTips{ + GroupInfo group = 1; + GroupMemberFullInfo opUser = 2; + string handleMsg = 4; +} + +// OnApplicationGroupRejected() +message GroupApplicationRejectedTips{ + GroupInfo group = 1; + GroupMemberFullInfo opUser = 2; + string handleMsg = 4; +} + +// OnTransferGroupOwner() +message GroupOwnerTransferredTips{ + GroupInfo group = 1; + GroupMemberFullInfo opUser = 2; + GroupMemberFullInfo newGroupOwner = 3; + int64 operationTime = 4; +} + + +// OnMemberKicked() +message MemberKickedTips{ + GroupInfo group = 1; + GroupMemberFullInfo opUser = 2; + repeated GroupMemberFullInfo kickedUserList = 3; + int64 operationTime = 4; +} + +// OnMemberInvited() +message MemberInvitedTips{ + GroupInfo group = 1; + GroupMemberFullInfo opUser = 2; + repeated GroupMemberFullInfo invitedUserList = 3; + int64 operationTime = 4; +} + //Actively join the group message MemberEnterTips{ - GroupInfo Group = 1; - GroupMemberFullInfo Member = 2; - uint64 OperationTime = 3; + GroupInfo group = 1; + GroupMemberFullInfo entrantUser = 2; + int64 operationTime = 3; } -//Actively leave the group -message MemberLeaveTips{ - GroupInfo Group = 1; - GroupMemberFullInfo Member = 2; - uint64 OperationTime = 3; -} -message MemberInvitedTips{ - GroupInfo Group = 1; - GroupMemberFullInfo OpUser = 2; - GroupMemberFullInfo Member = 3; - uint64 OperationTime = 4; -} -message MemberKickedTips{ - GroupInfo Group = 1; - GroupMemberFullInfo OpUser = 2; - GroupMemberFullInfo Member = 3; - uint64 OperationTime = 4; -} -message GroupMemberChangeInfo{ - int32 ChangeType = 1; //1:info changed; 2:mute - GroupMemberFullInfo OpUser = 2; //who do this - GroupMemberFullInfo Member = 3; - uint64 MuteTime = 4; -} -message MemberInfoChangedTips{ - GroupInfo Group = 1; - GroupMemberChangeInfo MemberChanged = 2; -} -message GroupCreatedTips{ - GroupInfo Group = 1; - GroupMemberFullInfo Creator = 2; - repeated GroupMemberFullInfo MemberList = 3; - uint64 OperationTime = 4; -} -message GroupInfoChangedTips{ - int32 ChangedType = 1; //1:name;2:Notification ... - GroupInfo Group = 2; - GroupMemberFullInfo OpUser = 3; -} -message ReceiveJoinApplicationTips{ - GroupInfo Group = 1; - GroupMemberFullInfo Member = 2; - string Reason = 3; -} -message ApplicationProcessedTips{ - GroupInfo Group = 1; - GroupMemberFullInfo OpUser = 2; - int32 Result = 3; - string Reason = 4; -} //////////////////////friend///////////////////// -message FriendInfo{ - string OwnerUserID = 1; - string Remark = 2; - uint64 CreateTime = 3; - UserInfo FriendUserInfo = 4; -} +//message FriendInfo{ +// UserInfo OwnerUser = 1; +// string Remark = 2; +// uint64 CreateTime = 3; +// UserInfo FriendUser = 4; +//} message FriendApplication{ - uint64 AddTime = 4; - string AddSource = 5; - string AddWording = 6; + int64 addTime = 1; + string addSource = 2; + string addWording = 3; } -//user1 add user2 -message FriendApplicationListAddedTips{ - PublicUserInfo OpUser = 1; //user1 - FriendApplication Application = 2; - PublicUserInfo OpedUser = 3; //user2 +message FromToUserID{ + string fromUserID = 1; + string toUserID = 2; } -// user2 accept -message FriendApplicationListAcceptTips{ - PublicUserInfo OpUser = 1; //user2 - PublicUserInfo OpedUser = 2; //user1 +//FromUserID apply to add ToUserID +message FriendApplicationTips{ + FromToUserID fromToUserID = 1; } -// user2 reject -message FriendApplicationListRejectTips{ - PublicUserInfo OpUser = 1; //user2 - PublicUserInfo OpedUser = 2; //user1 +//FromUserID accept or reject ToUserID +message FriendApplicationApprovedTips{ + FromToUserID fromToUserID = 1; + string handleMsg = 2; } -message FriendListAddedTips{ - FriendInfo Friend = 1; +//FromUserID accept or reject ToUserID +message FriendApplicationRejectedTips{ + FromToUserID fromToUserID = 1; + string handleMsg = 2; } -message FriendListDeletedTips{ - FriendInfo Friend = 1; + +// FromUserID Added a friend ToUserID +message FriendAddedTips{ + FriendInfo friend = 1; + int64 operationTime = 2; + PublicUserInfo opUser = 3; //who do this + } -message BlackListAddTips{ - FriendInfo Friend = 1; +// FromUserID deleted a friend ToUserID +message FriendDeletedTips{ + FromToUserID fromToUserID = 1; } -message BlackListDeletedTips{ - FriendInfo Friend = 1; + + +message BlackAddedTips{ + FromToUserID fromToUserID = 1; +} + +message BlackDeletedTips{ + FromToUserID fromToUserID = 1; } message FriendInfoChangedTips{ - FriendInfo Friend = 1; + FromToUserID fromToUserID = 1; } //////////////////////user///////////////////// -message SelfInfoUpdatedTips{ - UserInfo SelfUserInfo = 1; -} \ No newline at end of file +message UserInfoUpdatedTips{ + string userID = 1; +} diff --git a/pkg/proto/user/user.pb.go b/pkg/proto/user/user.pb.go index 7a6744c06..c9f85d568 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_9cd4aaf870b6d3b5, []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_9cd4aaf870b6d3b5, []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_9cd4aaf870b6d3b5, []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_9cd4aaf870b6d3b5, []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_9cd4aaf870b6d3b5, []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_9cd4aaf870b6d3b5, []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_9cd4aaf870b6d3b5, []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_9cd4aaf870b6d3b5, []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_9cd4aaf870b6d3b5, []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_9cd4aaf870b6d3b5, []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_9cd4aaf870b6d3b5, []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_9cd4aaf870b6d3b5, []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_9cd4aaf870b6d3b5, []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,116 +663,15 @@ 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 "" } type OptResult struct { - ConversationId string `protobuf:"bytes,1,opt,name=conversationId" json:"conversationId,omitempty"` + ConversationID string `protobuf:"bytes,1,opt,name=conversationID" json:"conversationID,omitempty"` Result int32 `protobuf:"varint,2,opt,name=result" json:"result,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -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_9cd4aaf870b6d3b5, []int{12} } func (m *OptResult) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_OptResult.Unmarshal(m, b) @@ -967,9 +702,9 @@ func (m *OptResult) XXX_DiscardUnknown() { var xxx_messageInfo_OptResult proto.InternalMessageInfo -func (m *OptResult) GetConversationId() string { +func (m *OptResult) GetConversationID() string { if m != nil { - return m.ConversationId + return m.ConversationID } return "" } @@ -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"` + ConversationOptResultList []*OptResult `protobuf:"bytes,2,rep,name=conversationOptResultList" json:"conversationOptResultList,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_9cd4aaf870b6d3b5, []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) GetConversationOptResultList() []*OptResult { + if m != nil { + return m.ConversationOptResultList + } + return nil +} + +type GetReceiveMessageOptReq struct { + FromUserID string `protobuf:"bytes,1,opt,name=FromUserID" json:"FromUserID,omitempty"` + ConversationIDList []string `protobuf:"bytes,2,rep,name=conversationIDList" json:"conversationIDList,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_9cd4aaf870b6d3b5, []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) GetConversationIDList() []string { + if m != nil { + return m.ConversationIDList + } + 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_9cd4aaf870b6d3b5, []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_9cd4aaf870b6d3b5, []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_9cd4aaf870b6d3b5, []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_9cd4aaf870b6d3b5) } -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_9cd4aaf870b6d3b5 = []byte{ + // 819 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcd, 0x6e, 0x13, 0x3b, + 0x14, 0xd6, 0x24, 0x69, 0x6f, 0x73, 0xd2, 0x26, 0xb9, 0x56, 0x6f, 0x3b, 0x77, 0x0a, 0x55, 0x6a, + 0x21, 0x88, 0xba, 0x48, 0x50, 0x59, 0x20, 0x81, 0x00, 0x95, 0x54, 0x8d, 0x2a, 0x88, 0x82, 0xa6, + 0xea, 0x86, 0x4d, 0x34, 0x24, 0x26, 0x44, 0x4d, 0xc6, 0xc6, 0x9e, 0xb4, 0x02, 0xb6, 0xac, 0x78, + 0x05, 0x16, 0x2c, 0x79, 0x06, 0x5e, 0x83, 0x17, 0xe0, 0x55, 0xd0, 0xd8, 0x33, 0x89, 0xe7, 0x27, + 0xd3, 0x12, 0x24, 0xc4, 0x66, 0x34, 0x3e, 0x3e, 0x3e, 0xfe, 0xbe, 0xef, 0x1c, 0xdb, 0x07, 0x2a, + 0x53, 0x41, 0x78, 0xd3, 0xff, 0x34, 0x18, 0xa7, 0x1e, 0x45, 0x05, 0xff, 0xdf, 0xda, 0xeb, 0x32, + 0xe2, 0xf6, 0x4e, 0x3a, 0x4d, 0x76, 0x3e, 0x6c, 0xca, 0x89, 0xa6, 0x18, 0x9c, 0xf7, 0x2e, 0x45, + 0xf3, 0x52, 0x28, 0x47, 0xfc, 0x18, 0xa0, 0x45, 0x27, 0x13, 0xea, 0xda, 0x44, 0x30, 0x64, 0xc2, + 0x3f, 0x84, 0xf3, 0x16, 0x1d, 0x10, 0xd3, 0xa8, 0x19, 0xf5, 0x15, 0x3b, 0x1c, 0xa2, 0x2d, 0x58, + 0x25, 0x9c, 0x77, 0xc4, 0xd0, 0xcc, 0xd5, 0x8c, 0x7a, 0xd1, 0x0e, 0x46, 0xf8, 0x3d, 0x94, 0x8f, + 0xc8, 0x98, 0x78, 0xe4, 0x4c, 0x10, 0x2e, 0x6c, 0xf2, 0x16, 0xed, 0x43, 0x75, 0x6e, 0x39, 0x39, + 0x7a, 0x3e, 0x12, 0x9e, 0x99, 0xab, 0xe5, 0xeb, 0x45, 0x3b, 0x61, 0x47, 0x16, 0xac, 0x75, 0x99, + 0x1a, 0x9b, 0x79, 0x19, 0x77, 0x36, 0x46, 0x35, 0x28, 0x75, 0x19, 0xe1, 0x8e, 0x37, 0xa2, 0xee, + 0xc9, 0x91, 0x59, 0x90, 0xd3, 0xba, 0x09, 0x53, 0xa8, 0x44, 0xf6, 0x16, 0x0c, 0xdd, 0xd5, 0xe9, + 0x48, 0x0e, 0xa5, 0x83, 0x6a, 0x43, 0x0a, 0x33, 0xb7, 0xdb, 0x3a, 0xe5, 0x7d, 0xa8, 0x1e, 0x3b, + 0xa3, 0x31, 0x19, 0x24, 0xe1, 0xc6, 0xed, 0xb8, 0x0b, 0x95, 0x36, 0xf1, 0x0e, 0xc7, 0x63, 0x65, + 0xf3, 0xd9, 0x5a, 0xb0, 0x46, 0x43, 0x06, 0x86, 0x62, 0x40, 0x35, 0x06, 0x54, 0x63, 0xa0, 0x84, + 0xd3, 0x4d, 0x78, 0x00, 0xd5, 0x68, 0xc0, 0xa5, 0x28, 0xec, 0x02, 0x24, 0xc0, 0x6b, 0x16, 0xfc, + 0x0e, 0x2a, 0x87, 0xfd, 0x3e, 0x9d, 0xba, 0x5e, 0xeb, 0x0d, 0xe9, 0x9f, 0xfb, 0xb0, 0xeb, 0x50, + 0x91, 0xff, 0xda, 0x3a, 0x43, 0xae, 0x8b, 0x9b, 0x23, 0x29, 0xca, 0x65, 0xa7, 0x28, 0x9f, 0x4c, + 0xd1, 0x0f, 0x03, 0xaa, 0xd1, 0xbd, 0x15, 0xc3, 0xfe, 0x35, 0x18, 0xce, 0x7d, 0x50, 0x1b, 0xc0, + 0x26, 0x62, 0x3a, 0xf6, 0x66, 0x0c, 0x4b, 0x07, 0x77, 0xd4, 0x8a, 0x78, 0xf4, 0xc6, 0xe9, 0xc8, + 0x1d, 0x8e, 0x65, 0x49, 0x9c, 0x7a, 0x8e, 0x37, 0x15, 0xb6, 0xb6, 0xd4, 0x7a, 0x01, 0xd5, 0xf8, + 0xbc, 0x5f, 0xda, 0x53, 0x3d, 0x81, 0xc1, 0x08, 0xdd, 0x82, 0x0d, 0x47, 0x05, 0x57, 0x8e, 0x01, + 0xfd, 0xa8, 0x11, 0xbb, 0x50, 0x6e, 0x13, 0x4f, 0x0a, 0xe2, 0xbe, 0xa6, 0xbe, 0xb6, 0xbb, 0x00, + 0xd3, 0xb8, 0xac, 0x9a, 0xe5, 0x37, 0x15, 0xfd, 0x68, 0xc8, 0x22, 0x9c, 0x6f, 0xb8, 0x94, 0xa0, + 0x4f, 0x60, 0x3d, 0x8c, 0x20, 0x51, 0xe6, 0xa5, 0xa4, 0x3b, 0x0d, 0x41, 0xf8, 0x05, 0xe1, 0x3d, + 0x87, 0x8d, 0x7a, 0xcc, 0xe1, 0xce, 0x44, 0x34, 0x66, 0x1b, 0x45, 0x16, 0xe0, 0x4f, 0x06, 0xfc, + 0x7b, 0xc6, 0x06, 0x4e, 0x70, 0x9c, 0x03, 0xea, 0xf7, 0x61, 0x2d, 0x1c, 0x06, 0x30, 0x32, 0x43, + 0xce, 0x9c, 0xaf, 0xd2, 0x84, 0x26, 0x35, 0xd1, 0x8f, 0xd1, 0x31, 0xa0, 0x38, 0x96, 0x65, 0x54, + 0xc1, 0xdf, 0x0c, 0xd8, 0x3e, 0x25, 0x9e, 0x4d, 0xfa, 0x64, 0x74, 0x41, 0x3a, 0x44, 0x08, 0x67, + 0x48, 0xba, 0xcc, 0x0b, 0xb2, 0x7a, 0xcc, 0xe9, 0x24, 0x72, 0xd4, 0x35, 0x0b, 0xaa, 0x42, 0x9e, + 0x32, 0x4f, 0x82, 0x5f, 0xb1, 0xfd, 0x5f, 0xd4, 0x00, 0xd4, 0xa7, 0xee, 0x05, 0xe1, 0x22, 0xc0, + 0x39, 0x53, 0xba, 0x68, 0xa7, 0xcc, 0xc4, 0x79, 0x16, 0x12, 0x3c, 0x23, 0x2a, 0xad, 0x44, 0x55, + 0xc2, 0xcf, 0xa0, 0x28, 0x91, 0xfa, 0xa5, 0x8e, 0x6e, 0x43, 0x39, 0xba, 0x41, 0x00, 0x38, 0x66, + 0xf5, 0x4b, 0x9f, 0xcb, 0x15, 0x01, 0xee, 0x60, 0x84, 0x3f, 0x1b, 0x60, 0xa6, 0x0b, 0xb1, 0x54, + 0xb5, 0x75, 0xe0, 0x7f, 0x7d, 0xe3, 0x19, 0x4e, 0xed, 0x34, 0x57, 0x54, 0x80, 0xd9, 0x94, 0xbd, + 0x78, 0x05, 0xfe, 0x6a, 0xc0, 0x76, 0x7b, 0xc9, 0x34, 0xa5, 0x27, 0x25, 0x77, 0xdd, 0xa4, 0xe4, + 0xb3, 0x93, 0x52, 0x88, 0x25, 0xc5, 0xd7, 0xb1, 0xfd, 0x87, 0x74, 0xcc, 0xff, 0xb2, 0x8e, 0x1f, + 0x60, 0x47, 0xbd, 0x3e, 0x2d, 0xcd, 0xa5, 0x23, 0x86, 0xd7, 0x94, 0xf2, 0xca, 0xe7, 0x2d, 0xeb, + 0x79, 0xc7, 0x5f, 0x0c, 0xb8, 0xb1, 0x78, 0xf7, 0xbf, 0x40, 0x9e, 0x83, 0xef, 0x05, 0x90, 0x6d, + 0x14, 0x7a, 0x00, 0x25, 0xed, 0xc6, 0x45, 0x9b, 0x2a, 0x46, 0xf4, 0xd6, 0xb7, 0xfe, 0x4b, 0xb1, + 0x0a, 0x86, 0x5a, 0x50, 0x8e, 0x5e, 0x4d, 0x68, 0x5b, 0x39, 0x26, 0x2e, 0x4f, 0xcb, 0x4c, 0x9f, + 0x10, 0xcc, 0x07, 0xa0, 0x35, 0x3a, 0x21, 0x80, 0x68, 0xdf, 0x15, 0x02, 0x88, 0x77, 0x44, 0x8f, + 0x60, 0x5d, 0x6f, 0x31, 0xd0, 0x1c, 0xa7, 0xde, 0xc7, 0x58, 0x5b, 0x69, 0x66, 0xc1, 0xd0, 0x19, + 0x6c, 0xa6, 0x5d, 0x04, 0xe8, 0xa6, 0xf2, 0x5f, 0x70, 0x5b, 0x5a, 0xbb, 0x59, 0xd3, 0x2a, 0x6c, + 0x3b, 0x23, 0x6c, 0x3b, 0x3b, 0xec, 0xc2, 0x23, 0xe5, 0xc8, 0xe3, 0x96, 0x5a, 0x53, 0x68, 0x4f, + 0x67, 0x98, 0x5a, 0xf1, 0x16, 0xbe, 0xca, 0x45, 0xe9, 0xa9, 0xb7, 0x1c, 0xa1, 0x9e, 0xb1, 0x06, + 0x2b, 0xd4, 0x33, 0xde, 0x9d, 0x3c, 0xdd, 0x78, 0x59, 0x6a, 0xc8, 0x46, 0xfd, 0xa1, 0xff, 0x79, + 0xb5, 0x2a, 0xbb, 0xf0, 0x7b, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x95, 0x5e, 0xfc, 0xe6, 0xc1, + 0x0b, 0x00, 0x00, } diff --git a/pkg/proto/user/user.proto b/pkg/proto/user/user.proto index e3c6ddffe..75455f7a0 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 server_api_params.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; + server_api_params.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 conversationOptResultList = 2; } message GetReceiveMessageOptReq{ - string uId = 1; - repeated string conversationId = 2; - string operationID = 3; + string FromUserID = 1; + repeated string conversationIDList = 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); diff --git a/pkg/utils/map.go b/pkg/utils/map.go index 4b8f9fa8d..fc24cc87d 100644 --- a/pkg/utils/map.go +++ b/pkg/utils/map.go @@ -115,12 +115,15 @@ func JsonStringToMap(str string) (tempMap map[string]int32) { _ = json.Unmarshal([]byte(str), &tempMap) return tempMap } -func GetSwitchFromOptions(Options map[string]int32, key string) (result bool) { - if flag, ok := Options[key]; !ok || flag == 1 { +func GetSwitchFromOptions(Options map[string]bool, key string) (result bool) { + if flag, ok := Options[key]; !ok || flag { return true } return false } -func SetSwitchFromOptions(Options map[string]int32, key string, value int32) { - Options[key] = value +func SetSwitchFromOptions(options map[string]bool, key string, value bool) { + if options == nil { + options = make(map[string]bool, 5) + } + options[key] = value } diff --git a/pkg/utils/strings.go b/pkg/utils/strings.go index 5ee2a6503..3265d2dc4 100644 --- a/pkg/utils/strings.go +++ b/pkg/utils/strings.go @@ -31,7 +31,6 @@ func Int32ToString(i int32) string { //judge a string whether in the string list func IsContain(target string, List []string) bool { - for _, element := range List { if target == element { @@ -39,7 +38,6 @@ func IsContain(target string, List []string) bool { } } return false - } func InterfaceArrayToStringArray(data []interface{}) (i []string) { @@ -54,6 +52,11 @@ func StructToJsonString(param interface{}) string { return dataString } +func StructToJsonBytes(param interface{}) []byte { + dataType, _ := json.Marshal(param) + return dataType +} + //The incoming parameter must be a pointer func JsonStringToStruct(s string, args interface{}) error { err := json.Unmarshal([]byte(s), args) diff --git a/pkg/utils/time_format.go b/pkg/utils/time_format.go index 3accd0567..b24d11398 100644 --- a/pkg/utils/time_format.go +++ b/pkg/utils/time_format.go @@ -30,6 +30,9 @@ func UnixSecondToTime(second int64) time.Time { func UnixNanoSecondToTime(nanoSecond int64) time.Time { return time.Unix(0, nanoSecond) } +func UnixMillSecondToTime(millSecond int64) time.Time { + return time.Unix(0, millSecond*1e6) +} //Get the current timestamp by Nano func GetCurrentTimestampByNano() int64 { diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 074712bc8..440d3a993 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -1,52 +1,73 @@ package utils import ( - "fmt" - "math/rand" - "reflect" + "github.com/jinzhu/copier" + "github.com/pkg/errors" + "runtime" "strconv" - "time" + "strings" ) // copy a by b b->a func CopyStructFields(a interface{}, b interface{}, fields ...string) (err error) { - at := reflect.TypeOf(a) - av := reflect.ValueOf(a) - bt := reflect.TypeOf(b) - bv := reflect.ValueOf(b) + return copier.Copy(a, b) +} - if at.Kind() != reflect.Ptr { - err = fmt.Errorf("a must be a struct pointer") - return err +func Wrap(err error, message string) error { + return errors.Wrap(err, "==> "+printCallerNameAndLine()+message) +} + +func WithMessage(err error, message string) error { + return errors.WithMessage(err, "==> "+printCallerNameAndLine()+message) +} + +func printCallerNameAndLine() string { + pc, _, line, _ := runtime.Caller(2) + return runtime.FuncForPC(pc).Name() + "()@" + strconv.Itoa(line) + ": " +} + +func GetSelfFuncName() string { + pc, _, _, _ := runtime.Caller(1) + return cleanUpFuncName(runtime.FuncForPC(pc).Name()) +} +func cleanUpFuncName(funcName string) string { + end := strings.LastIndex(funcName, ".") + if end == -1 { + return "" } - av = reflect.ValueOf(av.Interface()) - - _fields := make([]string, 0) - if len(fields) > 0 { - _fields = fields - } else { - for i := 0; i < bv.NumField(); i++ { - _fields = append(_fields, bt.Field(i).Name) + return funcName[end+1:] +} +func Intersect(slice1, slice2 []uint32) []uint32 { + m := make(map[uint32]bool) + n := make([]uint32, 0) + for _, v := range slice1 { + m[v] = true + } + for _, v := range slice2 { + flag, _ := m[v] + if flag { + n = append(n, v) + } + } + return n +} +func Difference(slice1, slice2 []uint32) []uint32 { + m := make(map[uint32]bool) + n := make([]uint32, 0) + inter := Intersect(slice1, slice2) + for _, v := range inter { + m[v] = true + } + for _, v := range slice1 { + if !m[v] { + n = append(n, v) } } - if len(_fields) == 0 { - err = fmt.Errorf("no fields to copy") - return err - } - - for i := 0; i < len(_fields); i++ { - name := _fields[i] - f := av.Elem().FieldByName(name) - bValue := bv.FieldByName(name) - - if f.IsValid() && f.Kind() == bValue.Kind() { - f.Set(bValue) + for _, v := range slice2 { + if !m[v] { + n = append(n, v) } } - return nil -} - -func OperationIDGenerator() string { - return strconv.FormatInt(time.Now().UnixNano()+int64(rand.Uint32()), 10) + return n }