Commit 564441523f2a69a4efeb2116addae2ed926d6e53
1 parent
a01eb6ed
添加空消息请求,token放在context中,message请求中加入uid
Showing
3 changed files
with
26 additions
and
27 deletions
Show diff stats
account.proto
@@ -2,7 +2,6 @@ syntax = "proto3"; | @@ -2,7 +2,6 @@ syntax = "proto3"; | ||
2 | option go_package = "./pb;pb"; | 2 | option go_package = "./pb;pb"; |
3 | 3 | ||
4 | package account; | 4 | package account; |
5 | -import "public.proto"; | ||
6 | 5 | ||
7 | message ServiceInfo { | 6 | message ServiceInfo { |
8 | string id = 1; | 7 | string id = 1; |
@@ -10,17 +9,17 @@ message ServiceInfo { | @@ -10,17 +9,17 @@ message ServiceInfo { | ||
10 | string address = 3; | 9 | string address = 3; |
11 | } | 10 | } |
12 | 11 | ||
13 | -message AccountInfo{ | 12 | +message Account{ |
14 | string phone = 2; // @inject_tag: index:"unique" pri:"1" | 13 | string phone = 2; // @inject_tag: index:"unique" pri:"1" |
15 | string password = 3; | 14 | string password = 3; |
16 | string uid = 4; | 15 | string uid = 4; |
17 | - string device = 5; | ||
18 | } | 16 | } |
19 | 17 | ||
20 | message CreateTokenRsp { | 18 | message CreateTokenRsp { |
21 | - public.PubRsp rsp = 1; | ||
22 | - string token = 2; | ||
23 | - repeated ServiceInfo game_service = 3; | 19 | + int64 code = 1; |
20 | + string uid = 2; | ||
21 | + string token = 3; | ||
22 | + repeated ServiceInfo game_service = 4; | ||
24 | } | 23 | } |
25 | 24 | ||
26 | message Register { | 25 | message Register { |
@@ -29,7 +28,11 @@ message Register { | @@ -29,7 +28,11 @@ message Register { | ||
29 | int32 code = 3; | 28 | int32 code = 3; |
30 | } | 29 | } |
31 | 30 | ||
32 | -service Account{ | ||
33 | - rpc RegisterHandler(Register) returns (public.PubRsp) {} | ||
34 | - rpc CreateTokenHandler(AccountInfo) returns (CreateTokenRsp) {} | 31 | +message RegisterRsp{ |
32 | + int64 code = 1; | ||
33 | +} | ||
34 | + | ||
35 | +service Login{ | ||
36 | + rpc RegisterHandler(Register) returns (RegisterRsp) {} | ||
37 | + rpc CreateTokenHandler(Account) returns (CreateTokenRsp) {} | ||
35 | } | 38 | } |
36 | \ No newline at end of file | 39 | \ No newline at end of file |
game.proto
@@ -2,7 +2,7 @@ syntax = "proto3"; | @@ -2,7 +2,7 @@ syntax = "proto3"; | ||
2 | option go_package = "./pb;pb"; | 2 | option go_package = "./pb;pb"; |
3 | 3 | ||
4 | package game; | 4 | package game; |
5 | -import "public.proto"; | 5 | +import "google/protobuf/empty.proto"; |
6 | 6 | ||
7 | message Hero { | 7 | message Hero { |
8 | int64 id = 1; // @inject_tag: index:"unique" pri:"1" | 8 | int64 id = 1; // @inject_tag: index:"unique" pri:"1" |
@@ -51,16 +51,25 @@ message Token { | @@ -51,16 +51,25 @@ message Token { | ||
51 | string token = 1; | 51 | string token = 1; |
52 | } | 52 | } |
53 | 53 | ||
54 | +message HeartRsp { | ||
55 | + int64 code = 1; | ||
56 | +} | ||
57 | + | ||
54 | message RoleRsp { | 58 | message RoleRsp { |
55 | - public.PubRsp rsp = 1; | 59 | + int64 code = 1; |
56 | Role role = 2; | 60 | Role role = 2; |
57 | map<string, Hero> hero = 3; | 61 | map<string, Hero> hero = 3; |
58 | Team team = 4; | 62 | Team team = 4; |
59 | repeated Equipment equips = 5; | 63 | repeated Equipment equips = 5; |
60 | } | 64 | } |
61 | 65 | ||
66 | +message LoginReq { | ||
67 | + string uid = 1; | ||
68 | + string device = 2; | ||
69 | +} | ||
70 | + | ||
62 | service Game{ | 71 | service Game{ |
63 | - rpc HeartBeatHandler(Token) returns (public.PubRsp) {} | ||
64 | - rpc LoginHandler(Token) returns (RoleRsp) {} | ||
65 | - rpc CreateRoleHandler(Token) returns (RoleRsp) {} | 72 | + rpc HeartBeatHandler(google.protobuf.Empty) returns (HeartRsp) {} |
73 | + rpc LoginHandler(LoginReq) returns (RoleRsp) {} | ||
74 | + rpc CreateRoleHandler(LoginReq) returns (RoleRsp) {} | ||
66 | } | 75 | } |
67 | \ No newline at end of file | 76 | \ No newline at end of file |
public.proto deleted
@@ -1,13 +0,0 @@ | @@ -1,13 +0,0 @@ | ||
1 | -syntax = "proto3"; | ||
2 | -package public; | ||
3 | - | ||
4 | -option go_package = "./pb;pb"; | ||
5 | - | ||
6 | -message PubRsp { | ||
7 | - int32 code = 1; | ||
8 | - string msg = 2; | ||
9 | -} | ||
10 | - | ||
11 | -message GenerateToken { | ||
12 | - string phone = 1; | ||
13 | -} | ||
14 | \ No newline at end of file | 0 | \ No newline at end of file |