From 7730929c47be673774e2391121558589e185827d Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 1 Sep 2022 15:26:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=A1=B5=E9=9D=A2=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pb/proto.js | 57 ++++++++++++++++++++++++------ src/pb/proto/chat_db.proto | 43 +++++++++++++--------- src/pb/proto/chat_msg.proto | 42 +++++++++++++--------- src/pb/proto/moonfantasy_msg.proto | 6 +++- 4 files changed, 103 insertions(+), 45 deletions(-) diff --git a/src/pb/proto.js b/src/pb/proto.js index 1d3fce9..6ebcb33 100644 --- a/src/pb/proto.js +++ b/src/pb/proto.js @@ -17,6 +17,12 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr System: 4 } }, + ChatType: { + values: { + Text: 0, + Moonfantasy: 1 + } + }, DBChat: { fields: { id: { @@ -27,45 +33,61 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr type: "ChatChannel", id: 2 }, + ctype: { + type: "ChatType", + id: 3 + }, suid: { type: "string", - id: 3 + id: 4 }, slv: { type: "int32", - id: 4 + id: 5 }, ruid: { type: "string", - id: 5 + id: 6 }, channelId: { type: "int32", - id: 6 + id: 7 }, unionId: { type: "string", - id: 7 + id: 8 }, stag: { type: "string", - id: 8 + id: 9 }, avatar: { type: "string", - id: 9 + id: 10 }, uname: { type: "string", - id: 10 + id: 11 }, content: { type: "string", - id: 11 + id: 12 }, ctime: { type: "int64", - id: 12 + id: 13 + }, + appendInt: { + type: "int64", + id: 14 + }, + appendStr: { + type: "string", + id: 15 + }, + appendBool: { + type: "string", + id: 16 } } }, @@ -2457,7 +2479,20 @@ var $root = ($protobuf.roots["default"] || ($protobuf.roots["default"] = new $pr } }, MoonfantasyTriggerReq: { - fields: {} + fields: { + avatar: { + type: "string", + id: 1 + }, + uname: { + type: "string", + id: 2 + }, + ulv: { + type: "int32", + id: 3 + } + } }, MoonfantasyTriggerResp: { fields: { diff --git a/src/pb/proto/chat_db.proto b/src/pb/proto/chat_db.proto index 3fd9cb2..8e664f1 100644 --- a/src/pb/proto/chat_db.proto +++ b/src/pb/proto/chat_db.proto @@ -2,25 +2,34 @@ syntax = "proto3"; option go_package = ".;pb"; enum ChatChannel { - World = 0; //世界频道 - Union = 1; //工会频道 - Private = 2; //私有频道 - CrossServer = 3; //跨服频道 - System = 4; //系统频道 + World = 0; //世界频道 + Union = 1; //工会频道 + Private = 2; //私有频道 + CrossServer = 3; //跨服频道 + System = 4; //系统频道 } +//聊天消息类型 +enum ChatType { + Text = 0; //文泵聊天消息 + Moonfantasy = 1; //月子秘境消息 +} message DBChat { - string id =1; //主键id - ChatChannel channel = 2; //频道 - string suid =3; //发送用户id - int32 slv = 4; //发送者等级 - string ruid = 5; //接收用户id channel == Private 有效 - int32 channelId = 6; //跨服频道 频道Id - string unionId = 7; //工会id - string stag = 8; //区服id - string avatar = 9; //用户头像 - string uname = 10; //用户名 - string content = 11; //内容 - int64 ctime = 12; //创建时间 + string id = 1; //@go_tags(`bson:"_id"`) ID + ChatChannel channel = 2; //频道 + ChatType ctype = 3; //消息类型 + string suid = 4; //发送用户id + int32 slv = 5; //发送者等级 + string ruid = 6; //接收用户id channel == Private 有效 + int32 channelId = 7; //跨服频道 频道Id + string unionId = 8; //工会id + string stag = 9; //区服id + string avatar = 10; //用户头像 + string uname = 11; //用户名 + string content = 12; //内容 + int64 ctime = 13; //创建时间 + int64 appendInt = 14; //@go_tags(`bson:"appendInt"`) 聊天附加数据 + string appendStr = 15; //@go_tags(`bson:"appendStr"`) 聊天附加数据 + string appendBool = 16; //@go_tags(`bson:"appendBool"`) 聊天附加数据 } \ No newline at end of file diff --git a/src/pb/proto/chat_msg.proto b/src/pb/proto/chat_msg.proto index b4b1f55..040bf31 100644 --- a/src/pb/proto/chat_msg.proto +++ b/src/pb/proto/chat_msg.proto @@ -3,41 +3,51 @@ option go_package = ".;pb"; import "chat_db.proto"; //聊天消息推送 -message ChatMessagePush { DBChat chat = 1; } +message ChatMessagePush{ + DBChat chat = 1; +} //申请跨服频道号 -message ChatCrossChannelReq {} +message ChatCrossChannelReq { + +} //申请跨服频道号 回应 -message ChatCrossChannelResp { int32 channelId = 1; } +message ChatCrossChannelResp { + int32 channelId = 1; +} //申请切换频道 -message ChatChanageChannelReq { int32 channelId = 1; } +message ChatChanageChannelReq { + int32 channelId = 1; +} //申请切换频道 回应 message ChatChanageChannelResp { - int32 channelId = 1; - bool isSucc = 2; + int32 channelId = 1; + bool isSucc = 2; } //请求聊天消息 message ChatGetListReq { - ChatChannel channel = 1; //频道 - int32 channelId = 2; //跨服频道id + ChatChannel channel = 1; //频道 + int32 channelId = 2; //跨服频道id } //请求聊天消息 回应 -message ChatGetListResp { repeated DBChat chats = 1; } +message ChatGetListResp { + repeated DBChat chats = 1; +} //消息发送请求 message ChatSendReq { - string avatar = 1; //用户头像 - string uname = 2; //用户名 - int32 ulv = 3; //用户等级 - ChatChannel channel = 4; //频道 - string targetId = 5; //目标用户id - string content = 6; //内容 + string avatar = 1; //用户头像 + string uname = 2; //用户名 + int32 ulv = 3; //用户等级 + ChatChannel channel = 4; //频道 + string targetId = 5; //目标用户id + string content = 6; //内容 } //消息发送请求 回应 message ChatSendResp { - bool issucc = 1; //是否成功 + bool issucc = 1; //是否成功 } diff --git a/src/pb/proto/moonfantasy_msg.proto b/src/pb/proto/moonfantasy_msg.proto index 43c9626..661a54f 100644 --- a/src/pb/proto/moonfantasy_msg.proto +++ b/src/pb/proto/moonfantasy_msg.proto @@ -2,7 +2,11 @@ syntax = "proto3"; option go_package = ".;pb"; ///触发秘境 -message MoonfantasyTriggerReq {} +message MoonfantasyTriggerReq { + string avatar = 1; //用户头像 + string uname = 2; //用户名 + int32 ulv = 3; //用户等级 +} ///触发秘境 message MoonfantasyTriggerResp {