From 57f80f83c3f365e224701269ef59d23be1e8b007 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 12 Jun 2020 10:08:15 +0800 Subject: [PATCH] 1 --- server/tools/protobuild/cs_proto.proto | 232 +++++++++++++++---------- server/tools/protobuild/ss_proto.proto | 34 ++++ 2 files changed, 173 insertions(+), 93 deletions(-) diff --git a/server/tools/protobuild/cs_proto.proto b/server/tools/protobuild/cs_proto.proto index 3cd867d..fddb4d2 100644 --- a/server/tools/protobuild/cs_proto.proto +++ b/server/tools/protobuild/cs_proto.proto @@ -3,10 +3,10 @@ package cs; //常量 enum Constant_e { - ProtoVersion = 2019071501; //系统版本 + ProtoVersion = 2020061101; //协议版本 } -//心跳 +//心跳(每60秒上报) message CMPing { } @@ -23,68 +23,62 @@ message MFPaging optional int32 total_page = 3; //总页数(服务器填充该字段) } +//用户基础数据(可用于缓存,除下划线开头的字段会存储到db) +message MFBaseUserData +{ + optional string account_id = 1; //账号id + optional string nickname = 2; //昵称 + optional string avatar_url = 3; //头像 + optional int32 sex = 4; //性别 1:男 2:女 0:未知 + optional int32 last_login_time = 5; //最后登录时间 + + optional int64 user_value1 = 50; //用户字段1 + optional int64 user_value2 = 51; //用户字段2 + optional int64 user_value3 = 52; //用户字段3 + optional int64 base_data_version = 100; //数据版本号 + + optional int32 _online = 101; //是否在线 +} + +//临时用户自定义数据(不会存储每次上/下线时时都重置为0) +message MFUserTempCustomData +{ + optional int64 value1 = 1 [default = 0]; //自定义字段1 + optional int64 value2 = 2 [default = 0]; //自定义字段2 + optional int64 value3 = 3 [default = 0]; //自定义字段3 +} + +//用户信息 message MFUserInfo { - optional string account_id = 1; - optional string nickname = 2; - optional string avatar_url = 3; - optional int32 sex = 4; - optional int32 online = 5; -} - -message MFGroupMemberDB -{ - optional string account_id = 1; - optional string nickname = 2; - optional string avatar_url = 3; - optional int32 sex = 4; - optional int64 group_id = 5; - optional int32 data_version1 = 6; -} - -message MFGroupDB -{ - repeated MFGroupMemberDB members = 1; -} - -message MFFriendDB -{ - optional string account_id = 1; - optional string nickname = 2; - optional string avatar_url = 3; - optional int32 sex = 4; - optional int64 group_id = 5; - optional int32 data_version1 = 6; -} - -message MFUserDB -{ - repeated MFGroupMemberDB friends = 1; + optional MFBaseUserData base_data = 1; //基础数据 + optional MFUserTempCustomData temp_custom_data = 2; //临时用户自定义数据 } +//好友申请 message MFFriendApply { - optional int64 idx = 1; - optional int64 applyid = 2; - optional string account_id = 3; - optional string nickname = 4; - optional string avatar_url = 5; - optional int32 sex = 6; + optional int64 idx = 1; //唯一索引id + optional int64 applyid = 2; //唯一id + optional string account_id = 3; //账号id + optional string nickname = 4; //昵称 + optional string avatar_url = 5; //头像 + optional int32 sex = 6; //性别 } -// +//登录好友服 message CMLogin { - optional string account_id = 3; - optional string session_id = 20; - optional string nickname = 4; - optional string avatar_url = 5; - optional int32 sex = 6; + optional string account_id = 3; //账号id + optional string session_id = 20; //sessionid + optional string nickname = 4; //昵称 + optional string avatar_url = 5; //头像 + optional int32 sex = 6; //性别 } message SMLogin { - optional int32 error_code = 1; - optional string error_msg = 2; + optional int32 errcode = 1; //错误码 + optional string errmsg = 2; //错误信息 } //获取好友列表 @@ -94,8 +88,8 @@ message CMFriendList //好友列表回复 message SMFriendList { - optional int32 error_code = 1; //错误消息 - optional string error_msg = 2; //错误消息 + optional int32 errcode = 1; //错误消息 + optional string errmsg = 2; //错误消息 repeated MFUserInfo friend_list = 3; //好友列表 } @@ -108,8 +102,8 @@ message CMFriendApply //好友申请回复 message SMFriendApply { - optional int32 error_code = 1; //1:已经是好友 - optional string error_msg = 2; //消息描述 + optional int32 errcode = 1; //1:已经是好友 + optional string errmsg = 2; //消息描述 } //获取好友申请列表 @@ -120,8 +114,8 @@ message CMFriendApplyList //获取好友申请列表回复 message SMFriendApplyList { - optional int32 error_code = 1; // - optional string error_msg = 2; //错误消息 + optional int32 errcode = 1; // + optional string errmsg = 2; //错误消息 optional MFPaging paging = 3; //分页信息回传 repeated MFFriendApply apply_list = 4; //申请加好友列表 } @@ -134,8 +128,8 @@ message CMFriendAgree //同意申请回复 message SMFriendAgree { - optional int32 error_code = 1; // - optional string error_msg = 2; //错误消息 + optional int32 errcode = 1; //错误码 + optional string errmsg = 2; //错误消息 } //忽略好友申请 @@ -146,8 +140,8 @@ message CMFriendIgnore //忽略好友申请回复 message SMFriendIgnore { - optional int32 error_code = 1; // - optional string error_msg = 2; //错误消息 + optional int32 errcode = 1; //错误码 + optional string errmsg = 2; //错误消息 } //删除好友 @@ -158,8 +152,8 @@ message CMFriendDelete //删除好友回复 message SMFriendDelete { - optional int32 error_code = 1; // - optional string error_msg = 2; //错误消息 + optional int32 errcode = 1; //错误码 + optional string errmsg = 2; //错误消息 optional string friend_id = 3; //好友id } @@ -170,8 +164,8 @@ message CMFriendBlackList //获取黑名单回复 message SMFriendBlackList { - optional int32 error_code = 1; // - optional string error_msg = 2; //错误消息 + optional int32 errcode = 1; // + optional string errmsg = 2; //错误消息 } //添加黑名单 @@ -181,8 +175,8 @@ message CMFriendAddBlack //添加黑名单回复 message SMFriendAddBlack { - optional int32 error_code = 1; // - optional string error_msg = 2; //错误消息 + optional int32 errcode = 1; // + optional string errmsg = 2; //错误消息 } //删除黑名单 @@ -192,8 +186,8 @@ message CMFriendDeleteBlack //删除黑名单回复 message SMFriendDeleteBlack { - optional int32 error_code = 1; // - optional string error_msg = 2; //错误消息 + optional int32 errcode = 1; // + optional string errmsg = 2; //错误消息 } //建群 @@ -204,8 +198,8 @@ message CMGroupCreate //建群返回 message SMGroupCreate { - optional int32 error_code = 1; //1:群已存在 2: 你已经有群 - optional string error_msg = 2; //错误消息 + optional int32 errcode = 1; //1:群已存在 2: 你已经有群 + optional string errmsg = 2; //错误消息 } //加群 @@ -216,17 +210,18 @@ message CMGroupJoin //加群返回 message SMGroupJoin { - optional int32 error_code = 1; //1:群id不存在 2:群已满 - optional string error_msg = 2; //错误消息 + optional int32 errcode = 1; //1:群id不存在 2:群已满 + optional string errmsg = 2; //错误消息 } +//同意加群 message CMGroupAgree { } message SMGroupAgree { - optional int32 error_code = 1; - optional string error_msg = 2; + optional int32 errcode = 1; + optional string errmsg = 2; } //踢人 @@ -238,59 +233,110 @@ message CMGroupKick //踢人回复 message SMGroupKick { - optional int32 error_code = 1; //1:群id错误 - optional string error_msg = 2; //错误消息 + optional int32 errcode = 1; //1:群id错误 + optional string errmsg = 2; //错误消息 } +//退群 message CMGroupQuit { } message SMGroupQuit { - optional int32 error_code = 1; - optional string error_msg = 2; + optional int32 errcode = 1; //错误码 + optional string errmsg = 2; //错误消息 } +//解散群 message CMGroupDismiss { } message SMGroupDismiss { - optional int32 error_code = 1; - optional string error_msg = 2; + optional int32 errcode = 1; //错误码 + optional string errmsg = 2; //错误信息 } +//群改名 message CMGroupRename { - optional string new_group_name = 1; + optional string new_group_name = 1; //新群名 } message SMGroupRename { - optional int32 error_code = 1; - optional string error_msg = 2; + optional int32 errcode = 1; //错误码 + optional string errmsg = 2; //错误信息 } +//发送聊天消息 message CMSendChatMsg { - optional int32 chat_channel = 1; - optional string target = 2; - optional string msg = 3; + optional int32 chat_channel = 1; //聊天频道 + optional string target = 2; //目标 + optional string msg = 3; //消息内容 } +//发送自定义消息 +message CMSendCustomMsg +{ + repeated string target_list = 1; //目标列表 + optional string msg = 2; //消息内容 + optional int64 param1 = 3; //透传参数1 + optional int64 param2 = 4; //透传参数2 + optional int64 param3 = 5; //透传参数3 +} + +//更新临时自定义数据 +message CMUpdateTempCustomData +{ + /* + 更新方式 + 0: 覆盖 + 1: 用新数据和服务器数据做或运算 + 2: 用新数据和服务器数据做与运算 + + !!!注意 + MFUserRaltimeData走的是增量更新如果不需要处理的字段不传就行 + 服务器对未传的自动不做任何处理 + */ + optional int32 update_type = 1; //更新方式 + optional MFUserTempCustomData temp_custom_data = 2; //临时自定义数据 +} + +//用户上/下线通知 message SMUserStatusNotify { - repeated string online_users = 1; - repeated string offline_users = 2; + repeated string online_users = 1; //上线用户 + repeated string offline_users = 2; //下线用户 } +//聊天消息通知 message SMChatMsgNotify { - optional string sender = 1; - optional int32 chat_channel = 2; - optional string msg = 3; + optional string sender = 1; //发送者 + optional int32 chat_channel = 2; //聊天频道 + optional string msg = 3; //消息内容 } +//发送自定义消息 +message SMCustomMsgNotify +{ + optional string sender = 1; //发送者 + optional string msg = 2; //消息内容 + optional int64 param1 = 3; //透传参数1 + optional int64 param2 = 4; //透传参数2 + optional int64 param3 = 5; //透传参数3 +} + +//更新用户信息 message SMUserInfoUpdate { - repeated MFUserInfo user_infos = 1; + repeated MFUserInfo user_infos = 1; //用户信息列表 +} + +//更新用户临时自定义信息 +message SMUserTempCustomDataUpdate +{ + optional string account_id = 1; //账号id + optional MFUserTempCustomData temp_custom_data = 2; //用户临时自定义数据 } diff --git a/server/tools/protobuild/ss_proto.proto b/server/tools/protobuild/ss_proto.proto index a8fdce0..918393a 100755 --- a/server/tools/protobuild/ss_proto.proto +++ b/server/tools/protobuild/ss_proto.proto @@ -13,6 +13,40 @@ message MFIMMsgConext optional int32 data_version1 = 9; } +message MFBaseUserDataDB +{ + optional string account_id = 1; //账号id + optional string nickname = 2; //昵称 + optional string avatar_url = 3; //头像 + optional int32 sex = 4; //性别 1:男 2:女 0:未知 + optional int32 last_login_time = 5; //最后登录时间 + + optional int64 user_value1 = 50; //用户字段1 + optional int64 user_value2 = 51; //用户字段2 + optional int64 user_value3 = 52; //用户字段3 + optional int64 base_data_version = 100; //数据版本号 +} + +message MFGroupMemberDB +{ + optional MFBaseUserDataDB base_data = 1; //基础数据 +} + +message MFGroupDB +{ + repeated MFGroupMemberDB members = 1; +} + +message MFFriendDB +{ + optional MFBaseUserDataDB base_data = 1; //基础数据 +} + +message MFUserDB +{ + repeated MFFriendDB friends = 1; +} + message SS_WSP_SocketDisconnect { }