From e8c9f63901800bda79ef927fbcd4580764aa3027 Mon Sep 17 00:00:00 2001 From: zhaocy Date: Mon, 6 Jun 2022 18:42:03 +0800 Subject: [PATCH] update Robot --- cmd/cmd.go | 6 +- cmd/robot/login.go | 41 ++++++--- cmd/robot/readme.md | 12 +++ cmd/robot/robot.go | 62 +++++-------- cmd/robot/user.go | 38 ++++++++ comm/core.go | 8 +- comm/usersession.go | 8 +- go.mod | 2 +- modules/core.go | 4 +- modules/gateway/agent.go | 5 +- modules/gateway/agentmgr_comp.go | 15 +-- modules/gateway/client_test.go | 5 +- modules/modulebase.go | 14 +-- modules/{login => user}/login_comp.go | 10 +- modules/{login => user}/module.go | 14 +-- modules/user/user_comp.go | 17 ++++ modules/web/api_comp.go | 3 +- pb/comm.pb.go | 128 +++++++++++++++++--------- pb/proto/comm.proto | 20 ++-- pb/proto/user_msg.proto | 16 ++++ pb/user_msg.pb.go | 117 +++++++++++++++++++---- 21 files changed, 380 insertions(+), 165 deletions(-) create mode 100644 cmd/robot/readme.md rename modules/{login => user}/login_comp.go (87%) rename modules/{login => user}/module.go (51%) create mode 100644 modules/user/user_comp.go diff --git a/cmd/cmd.go b/cmd/cmd.go index a1e6bed68..87dcd8dd9 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -43,10 +43,8 @@ var runCmd = &cobra.Command{ Run: func(cmd *cobra.Command, args []string) { opts := robot.DefaultOpts() - opts.Create = *create - if *create { - opts.Account = *account - } + opts.Create = *create + opts.Account = *account r := robot.NewRobot(opts) r.Run() diff --git a/cmd/robot/login.go b/cmd/robot/login.go index 654e4361a..7e0f2d049 100644 --- a/cmd/robot/login.go +++ b/cmd/robot/login.go @@ -1,38 +1,49 @@ package robot import ( - "fmt" "go_dreamfactory/comm" "go_dreamfactory/pb" "log" - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" ) -func (r *Robot) handleLogin(methodName string) { - switch methodName { +func (r *Robot) handleLogin(msg *pb.UserMessage) { + switch msg.SubType { case "login": - handleLogin(r) + handleLogin(r, msg) default: log.Fatal("methodName no exist") } } -func handleLogin(r *Robot) { - loginreq := &pb.UserLoginReq{ - Name: "aaa", +//处理接口响应数据 +func handleLogin(r *Robot, msg *pb.UserMessage) { + rsp := &pb.UserLoginResp{} + if !comm.ProtoDecode(msg, rsp) { + return } - logindata, _ := proto.Marshal(loginreq) - head := &pb.UserMessage{ - ServiceMethod: "login.login", - Data: logindata, + log.Printf("to client: %v", rsp.Data) +} + +//处理登录请求 +func (r *Robot) AccountLogin() { + //登录 + loginReg := &pb.UserLoginReq{ + Name: r.Opts.Account, } - if comm.ProtoEncode(loginreq, head) { - err := r.SendToClient(head.Data) + head := &pb.UserMessage{ + MainType: "login", + SubType: "login", + } + if comm.ProtoEncode(loginReg, head) { + data, _ := proto.Marshal(head) + err := r.SendToClient(data) if err != nil { - fmt.Printf("err:%v\n", err) + log.Fatal(err) } } + log.Printf("%s login ", r.Opts.Account) } diff --git a/cmd/robot/readme.md b/cmd/robot/readme.md new file mode 100644 index 000000000..345e2fc58 --- /dev/null +++ b/cmd/robot/readme.md @@ -0,0 +1,12 @@ +# Robot使用 + +## 命令行 +```sh +#使用已存在的账号测试接口 +go run cmd.go run --account yourAccount +``` + +```sh +#使用新账号测试接口 +go run cmd.go run --account newAccount --create true +``` diff --git a/cmd/robot/robot.go b/cmd/robot/robot.go index 5ca3a97c9..9f83a1a19 100644 --- a/cmd/robot/robot.go +++ b/cmd/robot/robot.go @@ -5,7 +5,6 @@ import ( "encoding/json" "go_dreamfactory/comm" "go_dreamfactory/pb" - "go_dreamfactory/utils" "io/ioutil" "log" "net/http" @@ -44,33 +43,40 @@ func (r *Robot) Run() { r.AccountLogin() } - for { - var msg *pb.UserMessage = &pb.UserMessage{} - _, data, err := r.ws.ReadMessage() - if err != nil { - log.Fatal(err) - } + //处理响应 + go func() { + for { + var msg *pb.UserMessage = &pb.UserMessage{} + _, data, err := r.ws.ReadMessage() + if err != nil { + log.Println(err) + } - if err = proto.Unmarshal(data, msg); err != nil { - log.Fatal(err) + if err = proto.Unmarshal(data, msg); err != nil { + log.Fatal(err) + } + r.handleMsg(msg) } - r.handleMsg(msg) - } + }() + + select {} } func (r *Robot) handleMsg(msg *pb.UserMessage) { - m, f, ok := utils.ParseP(msg.ServiceMethod) - if !ok { - log.Fatal("route error") - } - switch m { + switch msg.MainType { case "login": - r.handleLogin(f) + r.handleLogin(msg) + case "user": + r.handleUserMsg(msg) default: log.Fatal("module route no exist") } } +func (r *Robot) onUserLoaded() { + +} + func (r *Robot) SendToClient(data []byte) error { return r.ws.WriteMessage(websocket.BinaryMessage, data) } @@ -103,7 +109,8 @@ func (r *Robot) AccountRegister() { } head := &pb.UserMessage{ - ServiceMethod: "login.login", + MainType: "login", + SubType: "login", } if comm.ProtoEncode(loginReg, head) { err = r.SendToClient(head.Data) @@ -113,23 +120,4 @@ func (r *Robot) AccountRegister() { } } - -} - -//登录认证 -func (r *Robot) AccountLogin() { - //登录 - loginReg := &pb.UserLoginReq{ - Name: r.Opts.Account, - } - - head := &pb.UserMessage{ - ServiceMethod: "login.login", - } - if comm.ProtoEncode(loginReg, head) { - err := r.SendToClient(head.Data) - if err != nil { - log.Fatal(err) - } - } } diff --git a/cmd/robot/user.go b/cmd/robot/user.go index 8e1a8faab..ced98e66f 100644 --- a/cmd/robot/user.go +++ b/cmd/robot/user.go @@ -1 +1,39 @@ package robot + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + + "github.com/liwei1dao/lego/sys/log" +) + +func (r *Robot) handleUserMsg(msg *pb.UserMessage) { + + switch msg.SubType { + //创建账号 + case "create": + case "load": + + } + + //加载玩家数据 + if msg.SubType == "load" { + rsp := &pb.UserLoadRsp{} + if !comm.ProtoDecode(msg, rsp) { + log.Fatal("load user err") + } + + if rsp.Data.UserData.UserId != 0 { + r.onUserLoaded() + } else { + log.Debugf("%s不存在", r.Opts.Account) + //创建 + + } + + } +} + +func (r *Robot) CreateUser() { + +} diff --git a/comm/core.go b/comm/core.go index 76763383f..3d4ac5d45 100644 --- a/comm/core.go +++ b/comm/core.go @@ -16,7 +16,7 @@ const ( const ( SM_GateModule core.M_Modules = "gateway" //gate模块 网关服务模块 SM_WebModule core.M_Modules = "web" //web模块 - SM_LoginModule core.M_Modules = "login" //web模块 + SM_LoginModule core.M_Modules = "login" ) const ( //Rpc @@ -42,7 +42,7 @@ type IUserSession interface { GetGatewayServiceId() string Build(uid uint32) (err error) UnBuild(ServiceMethod string, msg proto.Message) (err error) - SendMsg(ServiceMethod string, msg proto.Message) (err error) + SendMsg(mainType, subType string, msg proto.Message) (err error) Close() (err error) ToString() string } @@ -61,7 +61,7 @@ type Message struct { func ProtoDecode(msg *pb.UserMessage, req proto.Message) (ok bool) { err := proto.Unmarshal(msg.Data, req) if err != nil { - log.Errorf("%s %v", msg.ServiceMethod, err) + log.Errorf("%s.%s %v", msg.MainType, msg.SubType, err) return } return true @@ -70,7 +70,7 @@ func ProtoDecode(msg *pb.UserMessage, req proto.Message) (ok bool) { func ProtoEncode(rsp proto.Message, msg *pb.UserMessage) (ok bool) { data, err := proto.Marshal(rsp) if err != nil { - log.Errorf("%s %v", msg.ServiceMethod, err) + log.Errorf("%s.%s %v", msg.MainType, msg.SubType, err) return } msg.Data = data diff --git a/comm/usersession.go b/comm/usersession.go index 4fa7c2eff..13c07b350 100644 --- a/comm/usersession.go +++ b/comm/usersession.go @@ -63,15 +63,17 @@ func (this *UserSession) UnBuild(ServiceMethod string, msg proto.Message) (err e return } -func (this *UserSession) SendMsg(ServiceMethod string, msg proto.Message) (err error) { +func (this *UserSession) SendMsg(mainType, subType string, msg proto.Message) (err error) { reply := &pb.RPCMessageReply{} data, _ := proto.Marshal(msg) + log.Debugf("SendMsg Data: %v", msg) if err := this.service.RpcCallById(this.GatewayServiceId, string(Rpc_GatewayAgentSendMsg), context.Background(), &pb.AgentSendMessageReq{ UserSessionId: this.SessionId, - ServiceMethod: ServiceMethod, + MainType: mainType, + SubType: subType, Data: data, }, reply); err != nil { - log.Errorf("UserSession:%s UserId:%d SendMsg:%s err:%v", this.SessionId, this.UserId, ServiceMethod, err) + log.Errorf("UserSession:%s UserId:%d SendMsg:%s err:%v", this.SessionId, this.UserId, mainType, err) } return } diff --git a/go.mod b/go.mod index daf1be6cd..d3a36b9cb 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,7 @@ require ( github.com/json-iterator/go v1.1.12 github.com/liwei1dao/lego v0.0.0-20220531091126-a21bb3766fbc github.com/spf13/cobra v1.2.1 + github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.7.1 go.mongodb.org/mongo-driver v1.5.1 google.golang.org/protobuf v1.28.0 @@ -95,7 +96,6 @@ require ( github.com/smallnest/quick v0.0.0-20220103065406-780def6371e6 // indirect github.com/smallnest/rpcx v1.7.4 // indirect github.com/soheilhy/cmux v0.1.5 // indirect - github.com/spf13/pflag v1.0.5 // indirect github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 // indirect github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b // indirect github.com/tinylib/msgp v1.1.6 // indirect diff --git a/modules/core.go b/modules/core.go index 3740cd5f0..64a62035e 100644 --- a/modules/core.go +++ b/modules/core.go @@ -10,7 +10,7 @@ import ( type ( IModule interface { core.IModule - SendMsgToUser(ServiceMethod string, msg proto.Message, user *pb.Cache_UserData) (err error) - SendMsgToUsers(ServiceMethod string, msg proto.Message, user ...*pb.Cache_UserData) (err error) + SendMsgToUser(mainType, subType string, msg proto.Message, user *pb.Cache_UserData) (err error) + SendMsgToUsers(mainType, subType string, msg proto.Message, user ...*pb.Cache_UserData) (err error) } ) diff --git a/modules/gateway/agent.go b/modules/gateway/agent.go index 768bf5b9d..bc79f4c86 100644 --- a/modules/gateway/agent.go +++ b/modules/gateway/agent.go @@ -2,6 +2,7 @@ package gateway import ( "context" + "fmt" "go_dreamfactory/comm" "go_dreamfactory/pb" "sync" @@ -134,13 +135,13 @@ func (this *Agent) Close() { //分发用户消息 func (this *Agent) messageDistribution(msg *pb.UserMessage) { reply := &pb.RPCMessageReply{} - log.Debugf("agent:%s uId:%d MessageDistribution msg:%s", this.sessionId, this.uId, msg.ServiceMethod) + log.Debugf("agent:%s uId:%d MessageDistribution msg:%s.%s", this.sessionId, this.uId, msg.MainType, msg.SubType) if err := this.gateway.Service().RpcCallByType("worker", string(comm.Rpc_GatewayRoute), context.Background(), &pb.AgentMessage{ Ip: this.IP(), UserSessionId: this.sessionId, UserId: this.uId, GatewayServiceId: this.gateway.Service().GetId(), - Method: msg.ServiceMethod, + Method: fmt.Sprintf("%s.%s", msg.MainType, msg.SubType), Message: msg.Data, }, reply); err != nil { log.Errorf("agent:%s uId:%d MessageDistribution err:%v", this.sessionId, this.uId, err) diff --git a/modules/gateway/agentmgr_comp.go b/modules/gateway/agentmgr_comp.go index 2cf811d0e..804e57a8b 100644 --- a/modules/gateway/agentmgr_comp.go +++ b/modules/gateway/agentmgr_comp.go @@ -53,8 +53,9 @@ func (this *AgentMgr_Comp) UnBuild(ctx context.Context, args *pb.AgentUnBuildReq func (this *AgentMgr_Comp) SendMsgToAgent(ctx context.Context, args *pb.AgentSendMessageReq, reply *pb.RPCMessageReply) error { if a, ok := this.agents.Load(args.UserSessionId); ok { a.(IAgent).WriteMsg(&pb.UserMessage{ - ServiceMethod: args.ServiceMethod, - Data: args.Data, + MainType: args.MainType, + SubType: args.SubType, + Data: args.Data, }) } else { reply.Code = int32(comm.ErrorCode_UserSessionNobeing) @@ -66,8 +67,9 @@ func (this *AgentMgr_Comp) SendMsgToAgent(ctx context.Context, args *pb.AgentSen //向多个户发送消息 func (this *AgentMgr_Comp) SendMsgToAgents(ctx context.Context, args *pb.BatchMessageReq, reply *pb.RPCMessageReply) error { msg := &pb.UserMessage{ - ServiceMethod: args.ServiceMethod, - Data: args.Data, + MainType: args.MainType, + SubType: args.SubType, + Data: args.Data, } for _, v := range args.UserSessionIds { if a, ok := this.agents.Load(v); ok { @@ -80,8 +82,9 @@ func (this *AgentMgr_Comp) SendMsgToAgents(ctx context.Context, args *pb.BatchMe //向所有户发送消息 func (this *AgentMgr_Comp) SendMsgToAllAgent(ctx context.Context, args *pb.BroadCastMessageReq, reply *pb.RPCMessageReply) error { msg := &pb.UserMessage{ - ServiceMethod: args.ServiceMethod, - Data: args.Data, + MainType: args.MainType, + SubType: args.SubType, + Data: args.Data, } this.agents.Range(func(key, value any) bool { value.(IAgent).WriteMsg(msg) diff --git a/modules/gateway/client_test.go b/modules/gateway/client_test.go index 4f94db495..921e3590b 100644 --- a/modules/gateway/client_test.go +++ b/modules/gateway/client_test.go @@ -40,8 +40,9 @@ func Test_WebSocket(t *testing.T) { } logindata, _ := proto.Marshal(loginreq) message := &pb.UserMessage{ - ServiceMethod: "login.login", - Data: logindata, + MainType: "login", + SubType: "login", + Data: logindata, } data, _ := proto.Marshal(message) err = ws.WriteMessage(websocket.BinaryMessage, data) diff --git a/modules/modulebase.go b/modules/modulebase.go index 4edccae72..253916490 100644 --- a/modules/modulebase.go +++ b/modules/modulebase.go @@ -23,20 +23,21 @@ func (this *ModuleBase) Init(service core.IService, module core.IModule, options return } -func (this *ModuleBase) SendMsgToUser(ServiceMethod string, msg proto.Message, user *pb.Cache_UserData) (err error) { +func (this *ModuleBase) SendMsgToUser(mainType, subType string, msg proto.Message, user *pb.Cache_UserData) (err error) { reply := &pb.RPCMessageReply{} data, _ := proto.Marshal(msg) if _, err = this.service.RpcGoById(user.GatewayServiceId, string(comm.Rpc_GatewayAgentSendMsg), context.Background(), &pb.AgentSendMessageReq{ UserSessionId: user.SessionId, - ServiceMethod: ServiceMethod, + MainType: mainType, + SubType: subType, Data: data, }, reply); err != nil { - log.Errorf("SendMsgToUser%d:%s [%s] err:%v", user.UserData.UserId, user.SessionId, ServiceMethod, err) + log.Errorf("SendMsgToUser%d:%s [%s.%s] err:%v", user.UserData.UserId, user.SessionId, mainType, subType, err) } return } -func (this *ModuleBase) SendMsgToUsers(ServiceMethod string, msg proto.Message, user ...*pb.Cache_UserData) (err error) { +func (this *ModuleBase) SendMsgToUsers(mainType, subType string, msg proto.Message, user ...*pb.Cache_UserData) (err error) { var ( gateways map[string][]string = make(map[string][]string) gateway []string @@ -54,10 +55,11 @@ func (this *ModuleBase) SendMsgToUsers(ServiceMethod string, msg proto.Message, for k, v := range gateways { if _, err = this.service.RpcGoById(k, string(comm.Rpc_GatewayAgentSendMsg), context.Background(), &pb.BatchMessageReq{ UserSessionIds: v, - ServiceMethod: ServiceMethod, + MainType: mainType, + SubType: subType, Data: data, }, reply); err != nil { - log.Errorf("SendMsgToUsers:%s->%s err:%v", k, ServiceMethod, err) + log.Errorf("SendMsgToUsers:%s->%s.%s err:%v", k, mainType, subType, err) } } return diff --git a/modules/login/login_comp.go b/modules/user/login_comp.go similarity index 87% rename from modules/login/login_comp.go rename to modules/user/login_comp.go index b7eee99cd..eca7fde70 100644 --- a/modules/login/login_comp.go +++ b/modules/user/login_comp.go @@ -1,4 +1,4 @@ -package login +package user import ( "context" @@ -47,13 +47,19 @@ func (this *LoginComp) Login(ctx context.Context, session comm.IUserSession, req return err } - session.SendMsg("loginRsp", &pb.UserLoginResp{ + session.SendMsg("login", "login", &pb.UserLoginResp{ Code: comm.ErrorCode_Success, + Data: &pb.Cache_UserData{ + UserData: &pb.DB_UserData{ + UserId: db_user.UserId, + }, + }, }) return nil } +//注销 func (this *LoginComp) Logout(ctx context.Context, session comm.IUserSession, rsp *pb.UserLoginReq) error { log.Debugf("User - Logout: session:%v rsp:%v", session.ToString(), rsp) diff --git a/modules/login/module.go b/modules/user/module.go similarity index 51% rename from modules/login/module.go rename to modules/user/module.go index 282d94a0f..47afe980f 100644 --- a/modules/login/module.go +++ b/modules/user/module.go @@ -1,4 +1,4 @@ -package login +package user import ( "go_dreamfactory/comm" @@ -8,20 +8,20 @@ import ( ) func NewModule() core.IModule { - m := new(Login) + m := new(User) return m } -type Login struct { +type User struct { modules.ModuleBase - user_comp *LoginComp + login_comp *LoginComp } -func (this *Login) GetType() core.M_Modules { +func (this *User) GetType() core.M_Modules { return comm.SM_LoginModule } -func (this *Login) OnInstallComp() { +func (this *User) OnInstallComp() { this.ModuleBase.OnInstallComp() - this.user_comp = this.RegisterComp(new(LoginComp)).(*LoginComp) + this.login_comp = this.RegisterComp(new(LoginComp)).(*LoginComp) } diff --git a/modules/user/user_comp.go b/modules/user/user_comp.go new file mode 100644 index 000000000..64b51ba9b --- /dev/null +++ b/modules/user/user_comp.go @@ -0,0 +1,17 @@ +package user + +import ( + "context" + "go_dreamfactory/comm" + "go_dreamfactory/modules" + "go_dreamfactory/pb" +) + +type UserComp struct { + modules.MComp_GateComp +} + +//创角 +func (this *UserComp) CreateUser(ctx context.Context, session comm.IUserSession, req *pb.UserLoginReq) error { + return nil +} diff --git a/modules/web/api_comp.go b/modules/web/api_comp.go index 2193112d4..2f9fa9334 100644 --- a/modules/web/api_comp.go +++ b/modules/web/api_comp.go @@ -16,6 +16,7 @@ import ( type Api_Comp struct { cbase.ModuleCompBase options *Options + module *Web gin gin.ISys } @@ -33,7 +34,7 @@ func (this *Api_Comp) Register(c *engine.Context) { rsp := &pb.UserRegisterRsp{} err := c.BindJSON(&req) if err == nil { - err := db.Defsys.CreateUser(&pb.DB_UserData{ + err := db.Defsys.User_CreateUser(&pb.DB_UserData{ Account: req.Account, }) if err != nil { diff --git a/pb/comm.pb.go b/pb/comm.pb.go index 74f718a8a..e69fe29bf 100644 --- a/pb/comm.pb.go +++ b/pb/comm.pb.go @@ -26,8 +26,9 @@ type UserMessage struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ServiceMethod string `protobuf:"bytes,1,opt,name=ServiceMethod,proto3" json:"ServiceMethod,omitempty"` //服务名 - Data []byte `protobuf:"bytes,2,opt,name=Data,proto3" json:"Data,omitempty"` + MainType string `protobuf:"bytes,1,opt,name=MainType,proto3" json:"MainType,omitempty"` + SubType string `protobuf:"bytes,2,opt,name=SubType,proto3" json:"SubType,omitempty"` + Data []byte `protobuf:"bytes,3,opt,name=Data,proto3" json:"Data,omitempty"` } func (x *UserMessage) Reset() { @@ -62,9 +63,16 @@ func (*UserMessage) Descriptor() ([]byte, []int) { return file_comm_proto_rawDescGZIP(), []int{0} } -func (x *UserMessage) GetServiceMethod() string { +func (x *UserMessage) GetMainType() string { if x != nil { - return x.ServiceMethod + return x.MainType + } + return "" +} + +func (x *UserMessage) GetSubType() string { + if x != nil { + return x.SubType } return "" } @@ -331,8 +339,9 @@ type AgentSendMessageReq struct { unknownFields protoimpl.UnknownFields UserSessionId string `protobuf:"bytes,1,opt,name=UserSessionId,proto3" json:"UserSessionId,omitempty"` - ServiceMethod string `protobuf:"bytes,2,opt,name=ServiceMethod,proto3" json:"ServiceMethod,omitempty"` //服务名 - Data []byte `protobuf:"bytes,3,opt,name=Data,proto3" json:"Data,omitempty"` + MainType string `protobuf:"bytes,2,opt,name=MainType,proto3" json:"MainType,omitempty"` + SubType string `protobuf:"bytes,3,opt,name=SubType,proto3" json:"SubType,omitempty"` + Data []byte `protobuf:"bytes,4,opt,name=Data,proto3" json:"Data,omitempty"` } func (x *AgentSendMessageReq) Reset() { @@ -374,9 +383,16 @@ func (x *AgentSendMessageReq) GetUserSessionId() string { return "" } -func (x *AgentSendMessageReq) GetServiceMethod() string { +func (x *AgentSendMessageReq) GetMainType() string { if x != nil { - return x.ServiceMethod + return x.MainType + } + return "" +} + +func (x *AgentSendMessageReq) GetSubType() string { + if x != nil { + return x.SubType } return "" } @@ -395,8 +411,9 @@ type BatchMessageReq struct { unknownFields protoimpl.UnknownFields UserSessionIds []string `protobuf:"bytes,1,rep,name=UserSessionIds,proto3" json:"UserSessionIds,omitempty"` - ServiceMethod string `protobuf:"bytes,2,opt,name=ServiceMethod,proto3" json:"ServiceMethod,omitempty"` - Data []byte `protobuf:"bytes,3,opt,name=Data,proto3" json:"Data,omitempty"` + MainType string `protobuf:"bytes,2,opt,name=MainType,proto3" json:"MainType,omitempty"` + SubType string `protobuf:"bytes,3,opt,name=SubType,proto3" json:"SubType,omitempty"` + Data []byte `protobuf:"bytes,4,opt,name=Data,proto3" json:"Data,omitempty"` } func (x *BatchMessageReq) Reset() { @@ -438,9 +455,16 @@ func (x *BatchMessageReq) GetUserSessionIds() []string { return nil } -func (x *BatchMessageReq) GetServiceMethod() string { +func (x *BatchMessageReq) GetMainType() string { if x != nil { - return x.ServiceMethod + return x.MainType + } + return "" +} + +func (x *BatchMessageReq) GetSubType() string { + if x != nil { + return x.SubType } return "" } @@ -458,8 +482,9 @@ type BroadCastMessageReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ServiceMethod string `protobuf:"bytes,1,opt,name=ServiceMethod,proto3" json:"ServiceMethod,omitempty"` //服务名 - Data []byte `protobuf:"bytes,2,opt,name=Data,proto3" json:"Data,omitempty"` + MainType string `protobuf:"bytes,1,opt,name=MainType,proto3" json:"MainType,omitempty"` //服务名 + SubType string `protobuf:"bytes,2,opt,name=SubType,proto3" json:"SubType,omitempty"` + Data []byte `protobuf:"bytes,3,opt,name=Data,proto3" json:"Data,omitempty"` } func (x *BroadCastMessageReq) Reset() { @@ -494,9 +519,16 @@ func (*BroadCastMessageReq) Descriptor() ([]byte, []int) { return file_comm_proto_rawDescGZIP(), []int{7} } -func (x *BroadCastMessageReq) GetServiceMethod() string { +func (x *BroadCastMessageReq) GetMainType() string { if x != nil { - return x.ServiceMethod + return x.MainType + } + return "" +} + +func (x *BroadCastMessageReq) GetSubType() string { + if x != nil { + return x.SubType } return "" } @@ -559,11 +591,12 @@ func (x *AgentCloseeReq) GetUserSessionId() string { var File_comm_proto protoreflect.FileDescriptor var file_comm_proto_rawDesc = []byte{ - 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x47, 0x0a, 0x0b, - 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x57, 0x0a, 0x0b, + 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x4d, + 0x61, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4d, + 0x61, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x75, 0x62, 0x54, 0x79, + 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0xba, 0x01, 0x0a, 0x0c, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x70, 0x12, 0x24, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, @@ -588,31 +621,34 @@ var file_comm_proto_rawDesc = []byte{ 0x65, 0x6e, 0x74, 0x55, 0x6e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x49, 0x64, 0x22, 0x75, 0x0a, 0x13, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x6e, 0x64, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, 0x0d, 0x55, 0x73, - 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, - 0x12, 0x24, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0x73, 0x0a, 0x0f, 0x42, 0x61, - 0x74, 0x63, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x26, 0x0a, - 0x0e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x49, 0x64, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x44, - 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, - 0x4f, 0x0a, 0x13, 0x42, 0x72, 0x6f, 0x61, 0x64, 0x43, 0x61, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x12, 0x0a, 0x04, - 0x44, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, - 0x22, 0x36, 0x0a, 0x0e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x65, 0x52, - 0x65, 0x71, 0x12, 0x24, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x49, 0x64, 0x22, 0x85, 0x01, 0x0a, 0x13, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x6e, + 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, 0x0d, 0x55, + 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, + 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x61, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x4d, 0x61, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, + 0x07, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0x83, 0x01, 0x0a, 0x0f, + 0x42, 0x61, 0x74, 0x63, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, + 0x26, 0x0a, 0x0e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x61, 0x69, 0x6e, 0x54, + 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4d, 0x61, 0x69, 0x6e, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, + 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, 0x74, + 0x61, 0x22, 0x5f, 0x0a, 0x13, 0x42, 0x72, 0x6f, 0x61, 0x64, 0x43, 0x61, 0x73, 0x74, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x61, 0x69, 0x6e, + 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4d, 0x61, 0x69, 0x6e, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x53, 0x75, 0x62, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, + 0x74, 0x61, 0x22, 0x36, 0x0a, 0x0e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x43, 0x6c, 0x6f, 0x73, 0x65, + 0x65, 0x52, 0x65, 0x71, 0x12, 0x24, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x55, 0x73, 0x65, + 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, + 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pb/proto/comm.proto b/pb/proto/comm.proto index 5c9efaa36..72d2136f3 100644 --- a/pb/proto/comm.proto +++ b/pb/proto/comm.proto @@ -3,8 +3,9 @@ option go_package = ".;pb"; //用户消息流结构 message UserMessage { - string ServiceMethod =1; //服务名 - bytes Data = 2; + string MainType =1; + string SubType = 2; + bytes Data = 3; } //代理用户转发消息结构 @@ -36,21 +37,24 @@ message AgentUnBuildReq { //向用户代理发送消息请求 message AgentSendMessageReq { string UserSessionId = 1; - string ServiceMethod = 2; //服务名 - bytes Data = 3; + string MainType = 2; + string SubType = 3; + bytes Data = 4; } //发送批量消息 message BatchMessageReq { repeated string UserSessionIds = 1; - string ServiceMethod = 2; - bytes Data = 3; + string MainType = 2; + string SubType = 3; + bytes Data = 4; } //发送广播消息 message BroadCastMessageReq { - string ServiceMethod = 1; //服务名 - bytes Data = 2; + string MainType = 1; //服务名 + string SubType = 2; + bytes Data = 3; } //关闭用户代理 diff --git a/pb/proto/user_msg.proto b/pb/proto/user_msg.proto index fad4a93b6..76b03d3eb 100644 --- a/pb/proto/user_msg.proto +++ b/pb/proto/user_msg.proto @@ -1,12 +1,15 @@ syntax = "proto3"; option go_package = ".;pb"; +import "user_db.proto"; + message UserLoginReq { string Name = 1; } message UserLoginResp { int32 Code = 1; + Cache_UserData data = 2; } @@ -16,4 +19,17 @@ message UserRegisterReq{ message UserRegisterRsp{ int32 Code = 1; +} + +message UserLoadRsp { + Cache_UserData data = 1; +} + +message UserCreateReq{ + string NickName = 1;//昵称 + int32 gender = 2; //性别 +} + +message UserCreateRsp{ + } \ No newline at end of file diff --git a/pb/user_msg.pb.go b/pb/user_msg.pb.go index 69042d7a9..ecf0e49fd 100644 --- a/pb/user_msg.pb.go +++ b/pb/user_msg.pb.go @@ -72,7 +72,8 @@ type UserLoginResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Code int32 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"` + Code int32 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"` + Data *Cache_UserData `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` } func (x *UserLoginResp) Reset() { @@ -114,6 +115,13 @@ func (x *UserLoginResp) GetCode() int32 { return 0 } +func (x *UserLoginResp) GetData() *Cache_UserData { + if x != nil { + return x.Data + } + return nil +} + type UserRegisterReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -208,21 +216,75 @@ func (x *UserRegisterRsp) GetCode() int32 { return 0 } +type UserLoadRsp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data *Cache_UserData `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *UserLoadRsp) Reset() { + *x = UserLoadRsp{} + if protoimpl.UnsafeEnabled { + mi := &file_user_msg_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserLoadRsp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserLoadRsp) ProtoMessage() {} + +func (x *UserLoadRsp) ProtoReflect() protoreflect.Message { + mi := &file_user_msg_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserLoadRsp.ProtoReflect.Descriptor instead. +func (*UserLoadRsp) Descriptor() ([]byte, []int) { + return file_user_msg_proto_rawDescGZIP(), []int{4} +} + +func (x *UserLoadRsp) GetData() *Cache_UserData { + if x != nil { + return x.Data + } + return nil +} + var File_user_msg_proto protoreflect.FileDescriptor var file_user_msg_proto_rawDesc = []byte{ 0x0a, 0x0e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x22, 0x0a, 0x0c, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, - 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x23, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x69, - 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x2b, 0x0a, 0x0f, 0x55, 0x73, 0x65, - 0x72, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, - 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x25, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, - 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x42, 0x06, 0x5a, - 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x1a, 0x0d, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x22, 0x0a, 0x0c, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, + 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, + 0x61, 0x6d, 0x65, 0x22, 0x48, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x69, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x43, 0x61, 0x63, 0x68, 0x65, 0x5f, 0x55, + 0x73, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x2b, 0x0a, + 0x0f, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x12, 0x18, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x25, 0x0a, 0x0f, 0x55, 0x73, + 0x65, 0x72, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x73, 0x70, 0x12, 0x12, 0x0a, + 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x43, 0x6f, 0x64, + 0x65, 0x22, 0x32, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x6f, 0x61, 0x64, 0x52, 0x73, 0x70, + 0x12, 0x23, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, + 0x2e, 0x43, 0x61, 0x63, 0x68, 0x65, 0x5f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -237,19 +299,23 @@ func file_user_msg_proto_rawDescGZIP() []byte { return file_user_msg_proto_rawDescData } -var file_user_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_user_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_user_msg_proto_goTypes = []interface{}{ (*UserLoginReq)(nil), // 0: UserLoginReq (*UserLoginResp)(nil), // 1: UserLoginResp (*UserRegisterReq)(nil), // 2: UserRegisterReq (*UserRegisterRsp)(nil), // 3: UserRegisterRsp + (*UserLoadRsp)(nil), // 4: UserLoadRsp + (*Cache_UserData)(nil), // 5: Cache_UserData } var file_user_msg_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 5, // 0: UserLoginResp.data:type_name -> Cache_UserData + 5, // 1: UserLoadRsp.data:type_name -> Cache_UserData + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_user_msg_proto_init() } @@ -257,6 +323,7 @@ func file_user_msg_proto_init() { if File_user_msg_proto != nil { return } + file_user_db_proto_init() if !protoimpl.UnsafeEnabled { file_user_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UserLoginReq); i { @@ -306,6 +373,18 @@ func file_user_msg_proto_init() { return nil } } + file_user_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserLoadRsp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -313,7 +392,7 @@ func file_user_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_user_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 5, NumExtensions: 0, NumServices: 0, },