添加rpc返回码

This commit is contained in:
liuxiaobo 2025-06-14 13:24:40 +08:00
parent 9784689c1e
commit a0d20b2d90
2 changed files with 32 additions and 23 deletions

View File

@ -16,13 +16,14 @@ enum MsgType
message InternalMsg
{
string service_name = 1; //
uint32 conn_id = 2; // user_idconn_id
int64 user_id = 3; // id
int32 msg_id = 4; // id
string serviceName = 1; //
uint32 connId = 2; // user_idconn_id
int64 userId = 3; // id
int32 msgId = 4; // id
bytes msg = 5; //
MsgType type = 6; //
string rpc_msg_id = 7; // rpc msg id
string rpcMsgId = 7; // rpc消息id
int32 rpcCode = 8; // rpc返回码
}

View File

@ -115,13 +115,14 @@ func (MsgType) EnumDescriptor() ([]byte, []int) {
type InternalMsg struct {
state protoimpl.MessageState `protogen:"open.v1"`
ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` // 该服务类型下的具体的服务节点名,需要保证该消息是该服务节点发的。否则可能会导致客户端出现路由错误
ConnId uint32 `protobuf:"varint,2,opt,name=conn_id,json=connId,proto3" json:"conn_id,omitempty"` // 刚登陆时没有user_id只有conn_id
UserId int64 `protobuf:"varint,3,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // 玩家id
MsgId int32 `protobuf:"varint,4,opt,name=msg_id,json=msgId,proto3" json:"msg_id,omitempty"` // 消息id
ServiceName string `protobuf:"bytes,1,opt,name=serviceName,proto3" json:"serviceName,omitempty"` // 该服务类型下的具体的服务节点名,需要保证该消息是该服务节点发的。否则可能会导致客户端出现路由错误
ConnId uint32 `protobuf:"varint,2,opt,name=connId,proto3" json:"connId,omitempty"` // 刚登陆时没有user_id只有conn_id
UserId int64 `protobuf:"varint,3,opt,name=userId,proto3" json:"userId,omitempty"` // 玩家id
MsgId int32 `protobuf:"varint,4,opt,name=msgId,proto3" json:"msgId,omitempty"` // 消息id
Msg []byte `protobuf:"bytes,5,opt,name=msg,proto3" json:"msg,omitempty"` // 消息
Type MsgType `protobuf:"varint,6,opt,name=type,proto3,enum=ipb.MsgType" json:"type,omitempty"` // 消息类型
RpcMsgId string `protobuf:"bytes,7,opt,name=rpc_msg_id,json=rpcMsgId,proto3" json:"rpc_msg_id,omitempty"` // rpc msg id
RpcMsgId string `protobuf:"bytes,7,opt,name=rpcMsgId,proto3" json:"rpcMsgId,omitempty"` // rpc消息id
RpcCode int32 `protobuf:"varint,8,opt,name=rpcCode,proto3" json:"rpcCode,omitempty"` // rpc返回码
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@ -205,20 +206,27 @@ func (x *InternalMsg) GetRpcMsgId() string {
return ""
}
func (x *InternalMsg) GetRpcCode() int32 {
if x != nil {
return x.RpcCode
}
return 0
}
var File_internal_proto protoreflect.FileDescriptor
const file_internal_proto_rawDesc = "" +
"\n" +
"\x0einternal.proto\x12\x03ipb\"\xcb\x01\n" +
"\vInternalMsg\x12!\n" +
"\fservice_name\x18\x01 \x01(\tR\vserviceName\x12\x17\n" +
"\aconn_id\x18\x02 \x01(\rR\x06connId\x12\x17\n" +
"\auser_id\x18\x03 \x01(\x03R\x06userId\x12\x15\n" +
"\x06msg_id\x18\x04 \x01(\x05R\x05msgId\x12\x10\n" +
"\x0einternal.proto\x12\x03ipb\"\xdf\x01\n" +
"\vInternalMsg\x12 \n" +
"\vserviceName\x18\x01 \x01(\tR\vserviceName\x12\x16\n" +
"\x06connId\x18\x02 \x01(\rR\x06connId\x12\x16\n" +
"\x06userId\x18\x03 \x01(\x03R\x06userId\x12\x14\n" +
"\x05msgId\x18\x04 \x01(\x05R\x05msgId\x12\x10\n" +
"\x03msg\x18\x05 \x01(\fR\x03msg\x12 \n" +
"\x04type\x18\x06 \x01(\x0e2\f.ipb.MsgTypeR\x04type\x12\x1c\n" +
"\n" +
"rpc_msg_id\x18\a \x01(\tR\brpcMsgId*+\n" +
"\x04type\x18\x06 \x01(\x0e2\f.ipb.MsgTypeR\x04type\x12\x1a\n" +
"\brpcMsgId\x18\a \x01(\tR\brpcMsgId\x12\x18\n" +
"\arpcCode\x18\b \x01(\x05R\arpcCode*+\n" +
"\x05MsgId\x12\v\n" +
"\aUnknown\x10\x00\x12\x15\n" +
"\bInternal\x10\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01*$\n" +