Commit 8d983031318209d7e26d72354aada45ef9c1d251
1 parent
436e0af4
loginReq uid -> token; model is ISchema
Showing
24 changed files
with
376 additions
and
168 deletions
Show diff stats
cmd/gameserver/action/RoleAction.go
... | ... | @@ -31,6 +31,7 @@ func CreateRpc(msg components.IMessage) (int32, interface{}) { |
31 | 31 | logger.Error("CreateRpc role create err: %v", err) |
32 | 32 | return 3, nil |
33 | 33 | } |
34 | + role.InitRole() | |
34 | 35 | return 0, nil |
35 | 36 | } |
36 | 37 | |
... | ... | @@ -48,10 +49,5 @@ func LoginRpc(msg components.IMessage) (int32, interface{}) { |
48 | 49 | } |
49 | 50 | role.SetProperty("Device", req.Device) |
50 | 51 | |
51 | - return 0, &pb.RoleRsp{ | |
52 | - Role: role.Role, | |
53 | - Hero: role.GetAllHero(), | |
54 | - Team: role.Teams.Team, | |
55 | - Equips: []*pb.Equipment{role.Equip.Equip}, | |
56 | - } | |
52 | + return 0, role | |
57 | 53 | } | ... | ... |
cmd/gameserver/action/protocode.go
cmd/gameserver/agent.go
... | ... | @@ -3,10 +3,12 @@ package main |
3 | 3 | import ( |
4 | 4 | "github.com/golang/protobuf/proto" |
5 | 5 | "math" |
6 | + "pro2d/cmd/gameserver/action" | |
6 | 7 | "pro2d/common" |
7 | 8 | "pro2d/common/components" |
8 | 9 | "pro2d/common/logger" |
9 | 10 | "pro2d/models" |
11 | + "pro2d/pb" | |
10 | 12 | "pro2d/utils" |
11 | 13 | "sync" |
12 | 14 | "sync/atomic" |
... | ... | @@ -38,8 +40,38 @@ func (c *Agent) OnConnection(conn components.IConnection) { |
38 | 40 | c.IConnection = conn |
39 | 41 | } |
40 | 42 | |
43 | +func (c *Agent) OnLogin(msg components.IMessage) { | |
44 | + //第一次登录 | |
45 | + errCode, irole := action.LoginRpc(msg) | |
46 | + if errCode != 0 { | |
47 | + c.Send(errCode, msg.GetHeader().GetMsgID(), nil) | |
48 | + return | |
49 | + } | |
50 | + | |
51 | + role := irole.(*models.RoleModel) | |
52 | + protoMsg := &pb.RoleRsp{ | |
53 | + Role: role.Role, | |
54 | + Hero: role.GetAllHero(), | |
55 | + Team: role.GetAllTeam(), | |
56 | + } | |
57 | + rsp, err := proto.Marshal(protoMsg) | |
58 | + if err != nil { | |
59 | + c.Send(-100, msg.GetHeader().GetMsgID(), nil) | |
60 | + return | |
61 | + } | |
62 | + c.Send(errCode, msg.GetHeader().GetMsgID(), rsp) | |
63 | + //登录成功,存储agent role | |
64 | + c.Role = role | |
65 | +} | |
66 | + | |
41 | 67 | func (c *Agent) OnMessage(msg components.IMessage) { |
42 | 68 | atomic.StoreInt64(&c.lastHeartCheckTime, utils.Timex()) |
69 | + | |
70 | + if msg.GetHeader().GetMsgID() == uint32(pb.ProtoCode_LoginReq) { | |
71 | + c.OnLogin(msg) | |
72 | + return | |
73 | + } | |
74 | + | |
43 | 75 | md := c.Server.GetAction(msg.GetHeader().GetMsgID()) |
44 | 76 | if md == nil { |
45 | 77 | logger.Debug("cmd: %d, handler is nil", msg.GetHeader().GetMsgID()) |
... | ... | @@ -50,24 +82,18 @@ func (c *Agent) OnMessage(msg components.IMessage) { |
50 | 82 | |
51 | 83 | f := md.(func (msg components.IMessage) (int32, interface{})) |
52 | 84 | errCode, protoMsg := f(msg) |
85 | + | |
53 | 86 | if protoMsg == nil { |
87 | + c.Send(errCode, msg.GetHeader().GetMsgID(), nil) | |
54 | 88 | return |
55 | 89 | } |
56 | 90 | |
57 | 91 | rsp, err := proto.Marshal(protoMsg.(proto.Message)) |
58 | 92 | if err != nil { |
59 | - conn := msg.GetSession() | |
60 | - if conn != nil { | |
61 | - conn.Send(-100, msg.GetHeader().GetMsgID(), nil) | |
62 | - } | |
63 | - return | |
64 | - } | |
65 | - conn := msg.GetSession() | |
66 | - if conn != nil { | |
67 | - conn.Send(errCode, msg.GetHeader().GetMsgID(), rsp) | |
93 | + c.Send(-100, msg.GetHeader().GetMsgID(), nil) | |
68 | 94 | return |
69 | 95 | } |
70 | - logger.Error("protocol not handler: %d", msg.GetHeader().GetMsgID()) | |
96 | + c.Send(errCode, msg.GetHeader().GetMsgID(), rsp) | |
71 | 97 | } |
72 | 98 | |
73 | 99 | func (c *Agent) OnTimer() { |
... | ... | @@ -91,6 +117,7 @@ func (c *Agent) OnClose() { |
91 | 117 | } |
92 | 118 | |
93 | 119 | func (c *Agent) Close() { |
120 | + c.Role = nil | |
94 | 121 | agentPool.Put(c) |
95 | 122 | |
96 | 123 | if c.Role == nil { | ... | ... |
cmd/gameserver/game.go
cmd/gameserver/plugin/plugin.go
... | ... | @@ -37,7 +37,7 @@ func LoginRpc(msg components.IMessage) (int32, interface{}) { |
37 | 37 | return 0, &pb.RoleRsp{ |
38 | 38 | Role: role.Role, |
39 | 39 | Hero: role.GetAllHero(), |
40 | - Team: role.Teams.Team, | |
40 | + Team: role.GetAllTeam(), | |
41 | 41 | Equips: []*pb.Equipment{role.Equip.Equip}, |
42 | 42 | } |
43 | 43 | } | ... | ... |
cmd/httpserver/http.go
... | ... | @@ -9,6 +9,7 @@ import ( |
9 | 9 | "pro2d/common/db/mongoproxy" |
10 | 10 | "pro2d/common/etcd" |
11 | 11 | "pro2d/common/logger" |
12 | + "pro2d/models" | |
12 | 13 | "syscall" |
13 | 14 | ) |
14 | 15 | |
... | ... | @@ -30,6 +31,7 @@ func (s *AccountServer) Init() error { |
30 | 31 | if err != nil { |
31 | 32 | return err |
32 | 33 | } |
34 | + models.InitGameModels() | |
33 | 35 | |
34 | 36 | //Etcd 初始化 |
35 | 37 | s.EtcdClient, err = etcd.NewEtcdClient(common.GlobalConf.Etcd) | ... | ... |
cmd/test/client.go
common/components/icompontents.go
common/db/mongoproxy/mongo.go
... | ... | @@ -49,6 +49,14 @@ func (m *MgoColl) Create() (interface{}, error){ |
49 | 49 | return m.coll.InsertOne(context.TODO(), m.Schema.GetSchema()) |
50 | 50 | } |
51 | 51 | |
52 | +func (m *MgoColl) Save() error{ | |
53 | + _, err := m.coll.UpdateOne(context.TODO(), m.Schema.GetPri(), m.Schema.GetSchema()) | |
54 | + if err != nil { | |
55 | + return err | |
56 | + } | |
57 | + return nil | |
58 | +} | |
59 | + | |
52 | 60 | func (m *MgoColl) Load() error{ |
53 | 61 | r := m.coll.FindOne(context.TODO(), m.Schema.GetPri()) |
54 | 62 | err := r.Decode(m.Schema.GetSchema()) | ... | ... |
common/db/mongoproxy/mongoplugin.go
... | ... | @@ -71,6 +71,14 @@ func FindOne(pri interface{}, schema interface{}) error { |
71 | 71 | return r.Decode(schema) |
72 | 72 | } |
73 | 73 | |
74 | +func FindMany(coll string, key string, val interface{}, schema interface{}) error { | |
75 | + r, err := mongoDatabase.Collection(coll).Find(context.TODO(), bson.M{key:val}) | |
76 | + if err != nil { | |
77 | + return err | |
78 | + } | |
79 | + return r.All(context.TODO(), schema) | |
80 | +} | |
81 | + | |
74 | 82 | func GetBsonD(key string, value interface{}) interface{} { |
75 | 83 | return bson.D{ {key, value}} |
76 | 84 | } | ... | ... |
conf/conf.yaml
models/account.go
1 | 1 | package models |
2 | 2 | |
3 | 3 | import ( |
4 | + "pro2d/common/components" | |
4 | 5 | "pro2d/pb" |
5 | 6 | ) |
6 | 7 | |
7 | 8 | type AccountModel struct { |
8 | - *Schema | |
9 | + components.ISchema | |
9 | 10 | *pb.Account |
10 | 11 | } |
11 | 12 | |
... | ... | @@ -24,7 +25,7 @@ func NewAccount(phone string) *AccountModel { |
24 | 25 | } |
25 | 26 | |
26 | 27 | account := &AccountModel{ |
27 | - Schema: NewSchema(phone, ac), | |
28 | + ISchema: NewSchema(phone, ac), | |
28 | 29 | Account: ac, |
29 | 30 | } |
30 | 31 | ... | ... |
models/equip.go
1 | 1 | package models |
2 | 2 | |
3 | 3 | import ( |
4 | + "pro2d/common/components" | |
4 | 5 | "pro2d/pb" |
5 | 6 | ) |
6 | 7 | |
7 | 8 | type EquipModel struct { |
8 | - *Schema | |
9 | + components.ISchema | |
9 | 10 | Equip *pb.Equipment |
10 | 11 | } |
11 | 12 | |
... | ... | @@ -14,7 +15,7 @@ func NewEquip(id string) *EquipModel { |
14 | 15 | Id: id, |
15 | 16 | } |
16 | 17 | m := &EquipModel{ |
17 | - Schema: NewSchema(id, data), | |
18 | + ISchema: NewSchema(id, data), | |
18 | 19 | Equip: data, |
19 | 20 | } |
20 | 21 | ... | ... |
models/hero.go
1 | 1 | package models |
2 | 2 | |
3 | 3 | import ( |
4 | + "pro2d/common/components" | |
4 | 5 | "pro2d/pb" |
5 | 6 | ) |
6 | 7 | |
7 | 8 | type HeroModel struct { |
8 | - *Schema | |
9 | + components.ISchema | |
9 | 10 | Hero *pb.Hero |
10 | 11 | } |
11 | -type HeroMap map[string]*HeroModel | |
12 | - | |
13 | -func GetHeros(hm HeroMap) map[string]*pb.Hero { | |
14 | - h := make(map[string]*pb.Hero) | |
15 | - for k, v := range hm { | |
16 | - h[k] = v.Hero | |
17 | - } | |
18 | - return h | |
19 | -} | |
20 | - | |
21 | -func NewHero(id string) *HeroModel { | |
22 | - h := &pb.Hero{ | |
23 | - Id: id, | |
24 | - } | |
12 | +type HeroMap map[string]components.ISchema | |
13 | +func NewHero(hero *pb.Hero) *HeroModel { | |
25 | 14 | m := &HeroModel{ |
26 | - Schema: NewSchema(id, h), | |
27 | - Hero: h, | |
15 | + ISchema: NewSchema(hero.Id, hero), | |
16 | + Hero: hero, | |
28 | 17 | } |
29 | 18 | return m |
30 | 19 | } | ... | ... |
models/init.go
... | ... | @@ -5,9 +5,15 @@ import ( |
5 | 5 | "pro2d/pb" |
6 | 6 | ) |
7 | 7 | |
8 | -func InitModels() { | |
9 | - var schema []interface{} = []interface{}{ | |
8 | +func InitAccountModels() { | |
9 | + var schema = []interface{}{ | |
10 | 10 | pb.Account{}, |
11 | + } | |
12 | + mongoproxy.InitDoc(schema...) | |
13 | +} | |
14 | + | |
15 | +func InitGameModels() { | |
16 | + var schema = []interface{}{ | |
11 | 17 | pb.Equipment{}, |
12 | 18 | pb.Hero{}, |
13 | 19 | pb.Prop{}, | ... | ... |
models/prop.go
1 | 1 | package models |
2 | 2 | |
3 | 3 | import ( |
4 | + "pro2d/common/components" | |
4 | 5 | "pro2d/pb" |
5 | 6 | ) |
6 | 7 | |
7 | 8 | type PropModel struct { |
8 | - *Schema | |
9 | + components.ISchema | |
9 | 10 | Prop *pb.Prop |
10 | 11 | } |
11 | 12 | |
... | ... | @@ -14,7 +15,7 @@ func NewProp(id string) *PropModel { |
14 | 15 | Id: id, |
15 | 16 | } |
16 | 17 | m := &PropModel{ |
17 | - Schema: NewSchema(id, data), | |
18 | + ISchema: NewSchema(id, data), | |
18 | 19 | Prop: data, |
19 | 20 | } |
20 | 21 | ... | ... |
models/role.go
1 | 1 | package models |
2 | 2 | |
3 | 3 | import ( |
4 | - "fmt" | |
5 | 4 | "pro2d/common" |
5 | + "pro2d/common/components" | |
6 | 6 | "pro2d/common/db/mongoproxy" |
7 | 7 | "pro2d/common/logger" |
8 | 8 | "pro2d/pb" |
... | ... | @@ -11,11 +11,10 @@ import ( |
11 | 11 | ) |
12 | 12 | |
13 | 13 | type RoleModel struct { |
14 | - *Schema | |
14 | + components.ISchema | |
15 | 15 | Role *pb.Role |
16 | 16 | Heros HeroMap |
17 | - Teams *TeamModel | |
18 | - Equip *EquipModel | |
17 | + Teams TeamMap | |
19 | 18 | Prop *PropModel |
20 | 19 | |
21 | 20 | lastSaveTs int64 |
... | ... | @@ -31,11 +30,10 @@ func RoleExistByUid(uid string) *RoleModel { |
31 | 30 | |
32 | 31 | |
33 | 32 | r := &RoleModel{ |
34 | - Schema: NewSchema(data.Id, data), | |
33 | + ISchema: NewSchema(data.Id, data), | |
35 | 34 | Role: data, |
36 | 35 | Heros: make(HeroMap), |
37 | - Teams: new(TeamModel), | |
38 | - Equip: new(EquipModel), | |
36 | + Teams: make(TeamMap), | |
39 | 37 | Prop: new(PropModel), |
40 | 38 | } |
41 | 39 | r.LoadAll() |
... | ... | @@ -45,72 +43,127 @@ func RoleExistByUid(uid string) *RoleModel { |
45 | 43 | func NewRole(id string) *RoleModel { |
46 | 44 | data := &pb.Role{Id: id} |
47 | 45 | m := &RoleModel{ |
48 | - Schema: NewSchema(id, data), | |
46 | + ISchema: NewSchema(id, data), | |
49 | 47 | Role: data, |
50 | 48 | Heros: make(HeroMap), |
51 | - Teams: new(TeamModel), | |
52 | - Equip: new(EquipModel), | |
53 | - Prop: new(PropModel), | |
49 | + Teams: make(TeamMap), | |
54 | 50 | } |
55 | 51 | return m |
56 | 52 | } |
57 | 53 | |
58 | -func (m *RoleModel) LoadHero() { | |
59 | - m.Heros["test"] = NewHero("") | |
60 | - m.Heros["test"].Hero = &pb.Hero{ | |
61 | - Id: "1", | |
54 | +func (m *RoleModel) InitRole() { | |
55 | + //init hero | |
56 | + h1 := pb.Hero{ | |
57 | + Id: common.SnowFlack.NextValStr(), | |
62 | 58 | RoleId: m.Role.Id, |
63 | 59 | Type: 1, |
64 | 60 | Level: 1, |
65 | 61 | ReinCount: 0, |
66 | 62 | ReinPoint: 0, |
67 | - Equipments: "123123", | |
63 | + Equipments: "", | |
68 | 64 | } |
65 | + m.AddHero(&h1) | |
66 | + | |
67 | + h2 := h1 | |
68 | + h2.Id = common.SnowFlack.NextValStr() | |
69 | + h2.Type = 2 | |
70 | + m.AddHero(&h2) | |
71 | + | |
72 | + h3 := h1 | |
73 | + h3.Id = common.SnowFlack.NextValStr() | |
74 | + h3.Type = 3 | |
75 | + m.AddHero(&h3) | |
76 | + | |
77 | + h4 := h1 | |
78 | + h4.Id = common.SnowFlack.NextValStr() | |
79 | + h4.Type = 4 | |
80 | + m.AddHero(&h4) | |
81 | + | |
82 | + //init team | |
83 | + t1 := pb.Team{ | |
84 | + Id: common.SnowFlack.NextValStr(), | |
85 | + RoleId: m.Role.Id, | |
86 | + HeroId1: h1.Id, | |
87 | + HeroId2: h2.Id, | |
88 | + HeroId3: h3.Id, | |
89 | + } | |
90 | + m.AddTeam(&t1) | |
91 | + | |
92 | + t2 := t1 | |
93 | + t2.Id = common.SnowFlack.NextValStr() | |
94 | + m.AddTeam(&t2) | |
95 | + | |
96 | + t3 := t1 | |
97 | + t3.Id = common.SnowFlack.NextValStr() | |
98 | + m.AddTeam(&t3) | |
99 | + | |
100 | + t4 := t1 | |
101 | + t4.Id = common.SnowFlack.NextValStr() | |
102 | + m.AddTeam(&t4) | |
69 | 103 | } |
70 | 104 | |
71 | -func (m *RoleModel) LoadTeams() { | |
72 | - m.Teams = NewTeam("0") | |
73 | - m.Teams.Team = &pb.Team{ | |
74 | - Id: "1", | |
75 | - HeroIds: "1", | |
105 | +func (m *RoleModel) LoadHero() { | |
106 | + heros := make([]*pb.Hero, 10) | |
107 | + err := mongoproxy.FindMany("hero", "role_id", m.Role.Id, &heros) | |
108 | + if err != nil { | |
109 | + logger.Error(err) | |
110 | + return | |
111 | + } | |
112 | + for _, hero := range heros { | |
113 | + m.Heros[hero.Id] = NewHero(hero) | |
76 | 114 | } |
77 | 115 | } |
78 | 116 | |
79 | -func (m *RoleModel) LoadEquips() { | |
80 | - m.Equip = NewEquip("0") | |
81 | - m.Equip.Equip = &pb.Equipment{ | |
82 | - Id: "0", | |
83 | - RoleId: m.Role.Id, | |
84 | - Type: 0, | |
85 | - Equip: false, | |
86 | - EnhanceLevel: false, | |
117 | +func (m *RoleModel) LoadTeams() { | |
118 | + teams := make([]*pb.Team, 4) | |
119 | + err := mongoproxy.FindMany("hero", "role_id", m.Role.Id, &teams) | |
120 | + if err != nil { | |
121 | + logger.Error(err) | |
122 | + return | |
123 | + } | |
124 | + for _, team:= range teams { | |
125 | + m.Teams[team.Id] = NewTeam(team) | |
87 | 126 | } |
88 | 127 | } |
89 | 128 | |
90 | 129 | func (m *RoleModel) LoadAll() { |
91 | 130 | m.LoadHero() |
92 | 131 | m.LoadTeams() |
93 | - m.LoadEquips() | |
94 | 132 | } |
95 | 133 | |
96 | 134 | func (m *RoleModel) updateProperty(property map[string]interface{}) { |
97 | 135 | } |
98 | 136 | |
99 | -func (m *RoleModel) AddHero(hero *pb.Hero) { | |
100 | - h := NewHero(hero.Id) | |
101 | - h.Hero = hero | |
102 | - h.Create() | |
103 | - m.Heros[fmt.Sprintf("%s%s", m.Role.Id, h.Hero.Id)] = h | |
104 | -} | |
105 | - | |
106 | 137 | func (m *RoleModel) GetAllHero() []*pb.Hero { |
107 | 138 | var h []*pb.Hero |
108 | 139 | for _, hero := range m.Heros { |
109 | - h = append(h, hero.Hero) | |
140 | + h = append(h, hero.(*HeroModel).Hero) | |
110 | 141 | } |
111 | 142 | return h |
112 | 143 | } |
113 | 144 | |
145 | +func (m *RoleModel) GetAllTeam() []*pb.Team{ | |
146 | + var t []*pb.Team | |
147 | + for _, team := range m.Teams{ | |
148 | + t = append(t, team.Team) | |
149 | + } | |
150 | + return t | |
151 | +} | |
152 | + | |
153 | + | |
154 | +func (m *RoleModel) AddHero(hero *pb.Hero) { | |
155 | + h := NewHero(hero) | |
156 | + h .Create() | |
157 | + m.Heros[hero.Id] = h | |
158 | +} | |
159 | + | |
160 | +func (m *RoleModel) AddTeam(team *pb.Team) { | |
161 | + t := NewTeam(team) | |
162 | + t.Create() | |
163 | + m.Teams[team.Id] = t | |
164 | +} | |
165 | + | |
166 | + | |
114 | 167 | func (m *RoleModel) OnRecoverTimer(now int64) { |
115 | 168 | m.saveRoleData(now) |
116 | 169 | } |
... | ... | @@ -126,4 +179,20 @@ func (m *RoleModel) saveRoleData(now int64) { |
126 | 179 | } |
127 | 180 | atomic.StoreInt64(&m.lastSaveTs, now) |
128 | 181 | m.Update() |
182 | + | |
183 | + tbObjs := []components.ISchema{} | |
184 | + for _, tbObj := range tbObjs { | |
185 | + if tbObj != nil { | |
186 | + tbObj.Update() | |
187 | + } | |
188 | + } | |
189 | + | |
190 | + //mpObjs := []interface{}{m.Heros, m.Teams} | |
191 | + //for _, mpObj := range mpObjs { | |
192 | + // for _, v := range mpObj.(map[string]components.ISchema) { | |
193 | + // if v != nil { | |
194 | + // v.Update() | |
195 | + // } | |
196 | + // } | |
197 | + //} | |
129 | 198 | } |
130 | 199 | \ No newline at end of file | ... | ... |
models/role_test.go
... | ... | @@ -6,12 +6,11 @@ import ( |
6 | 6 | "pro2d/common/db/mongoproxy" |
7 | 7 | "pro2d/common/logger" |
8 | 8 | "pro2d/pb" |
9 | - "pro2d/utils" | |
10 | 9 | "testing" |
11 | 10 | ) |
12 | 11 | |
13 | 12 | func TestNewRole(t *testing.T) { |
14 | - err := mongoproxy.ConnectMongo(common.GlobalConf.MongoConf) | |
13 | + err := mongoproxy.ConnectMongo(common.GlobalConf.GameConf.MongoConf) | |
15 | 14 | if err != nil { |
16 | 15 | logger.Error(err) |
17 | 16 | return |
... | ... | @@ -45,8 +44,25 @@ func TestNewRole(t *testing.T) { |
45 | 44 | } |
46 | 45 | |
47 | 46 | func TestRoleIndex(t *testing.T) { |
48 | - coll, keys := utils.FindIndex(pb.Role{}) | |
47 | + coll, keys := mongoproxy.FindIndex(pb.Role{}) | |
49 | 48 | for _, index := range keys { |
50 | 49 | logger.Debug("coll: %s, key: %s", coll, index) |
51 | 50 | } |
51 | +} | |
52 | + | |
53 | +func TestRoleModel_AddHero(t *testing.T) { | |
54 | + err := mongoproxy.ConnectMongo(common.GlobalConf.GameConf.MongoConf) | |
55 | + if err != nil { | |
56 | + logger.Error(err) | |
57 | + return | |
58 | + } | |
59 | + | |
60 | + var uid = "141815055745814528" | |
61 | + role := RoleExistByUid(uid) | |
62 | + if role == nil { | |
63 | + logger.Error("role not exist") | |
64 | + return | |
65 | + } | |
66 | + | |
67 | + role.InitRole() | |
52 | 68 | } |
53 | 69 | \ No newline at end of file | ... | ... |
models/schema.go
models/team.go
... | ... | @@ -4,17 +4,15 @@ import ( |
4 | 4 | "pro2d/pb" |
5 | 5 | ) |
6 | 6 | |
7 | +type TeamMap map[string]*TeamModel | |
7 | 8 | type TeamModel struct { |
8 | 9 | *Schema |
9 | 10 | Team *pb.Team |
10 | 11 | } |
11 | 12 | |
12 | -func NewTeam(id string) *TeamModel { | |
13 | - data := &pb.Team{ | |
14 | - Id: id, | |
15 | - } | |
13 | +func NewTeam(data *pb.Team) *TeamModel { | |
16 | 14 | m := &TeamModel{ |
17 | - Schema: NewSchema(id, data), | |
15 | + Schema: NewSchema(data.Id, data), | |
18 | 16 | Team: data, |
19 | 17 | } |
20 | 18 | ... | ... |
pb/game.pb.go
... | ... | @@ -67,6 +67,53 @@ func (x *HeartReq) GetCode() int64 { |
67 | 67 | return 0 |
68 | 68 | } |
69 | 69 | |
70 | +type HeartRsp struct { | |
71 | + state protoimpl.MessageState | |
72 | + sizeCache protoimpl.SizeCache | |
73 | + unknownFields protoimpl.UnknownFields | |
74 | + | |
75 | + Code int64 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` | |
76 | +} | |
77 | + | |
78 | +func (x *HeartRsp) Reset() { | |
79 | + *x = HeartRsp{} | |
80 | + if protoimpl.UnsafeEnabled { | |
81 | + mi := &file_game_proto_msgTypes[1] | |
82 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | |
83 | + ms.StoreMessageInfo(mi) | |
84 | + } | |
85 | +} | |
86 | + | |
87 | +func (x *HeartRsp) String() string { | |
88 | + return protoimpl.X.MessageStringOf(x) | |
89 | +} | |
90 | + | |
91 | +func (*HeartRsp) ProtoMessage() {} | |
92 | + | |
93 | +func (x *HeartRsp) ProtoReflect() protoreflect.Message { | |
94 | + mi := &file_game_proto_msgTypes[1] | |
95 | + if protoimpl.UnsafeEnabled && x != nil { | |
96 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | |
97 | + if ms.LoadMessageInfo() == nil { | |
98 | + ms.StoreMessageInfo(mi) | |
99 | + } | |
100 | + return ms | |
101 | + } | |
102 | + return mi.MessageOf(x) | |
103 | +} | |
104 | + | |
105 | +// Deprecated: Use HeartRsp.ProtoReflect.Descriptor instead. | |
106 | +func (*HeartRsp) Descriptor() ([]byte, []int) { | |
107 | + return file_game_proto_rawDescGZIP(), []int{1} | |
108 | +} | |
109 | + | |
110 | +func (x *HeartRsp) GetCode() int64 { | |
111 | + if x != nil { | |
112 | + return x.Code | |
113 | + } | |
114 | + return 0 | |
115 | +} | |
116 | + | |
70 | 117 | //ResponseCmd RoleRsp |
71 | 118 | type LoginReq struct { |
72 | 119 | state protoimpl.MessageState |
... | ... | @@ -80,7 +127,7 @@ type LoginReq struct { |
80 | 127 | func (x *LoginReq) Reset() { |
81 | 128 | *x = LoginReq{} |
82 | 129 | if protoimpl.UnsafeEnabled { |
83 | - mi := &file_game_proto_msgTypes[1] | |
130 | + mi := &file_game_proto_msgTypes[2] | |
84 | 131 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
85 | 132 | ms.StoreMessageInfo(mi) |
86 | 133 | } |
... | ... | @@ -93,7 +140,7 @@ func (x *LoginReq) String() string { |
93 | 140 | func (*LoginReq) ProtoMessage() {} |
94 | 141 | |
95 | 142 | func (x *LoginReq) ProtoReflect() protoreflect.Message { |
96 | - mi := &file_game_proto_msgTypes[1] | |
143 | + mi := &file_game_proto_msgTypes[2] | |
97 | 144 | if protoimpl.UnsafeEnabled && x != nil { |
98 | 145 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
99 | 146 | if ms.LoadMessageInfo() == nil { |
... | ... | @@ -106,7 +153,7 @@ func (x *LoginReq) ProtoReflect() protoreflect.Message { |
106 | 153 | |
107 | 154 | // Deprecated: Use LoginReq.ProtoReflect.Descriptor instead. |
108 | 155 | func (*LoginReq) Descriptor() ([]byte, []int) { |
109 | - return file_game_proto_rawDescGZIP(), []int{1} | |
156 | + return file_game_proto_rawDescGZIP(), []int{2} | |
110 | 157 | } |
111 | 158 | |
112 | 159 | func (x *LoginReq) GetToken() string { |
... | ... | @@ -135,7 +182,7 @@ type CreateReq struct { |
135 | 182 | func (x *CreateReq) Reset() { |
136 | 183 | *x = CreateReq{} |
137 | 184 | if protoimpl.UnsafeEnabled { |
138 | - mi := &file_game_proto_msgTypes[2] | |
185 | + mi := &file_game_proto_msgTypes[3] | |
139 | 186 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
140 | 187 | ms.StoreMessageInfo(mi) |
141 | 188 | } |
... | ... | @@ -148,7 +195,7 @@ func (x *CreateReq) String() string { |
148 | 195 | func (*CreateReq) ProtoMessage() {} |
149 | 196 | |
150 | 197 | func (x *CreateReq) ProtoReflect() protoreflect.Message { |
151 | - mi := &file_game_proto_msgTypes[2] | |
198 | + mi := &file_game_proto_msgTypes[3] | |
152 | 199 | if protoimpl.UnsafeEnabled && x != nil { |
153 | 200 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
154 | 201 | if ms.LoadMessageInfo() == nil { |
... | ... | @@ -161,7 +208,7 @@ func (x *CreateReq) ProtoReflect() protoreflect.Message { |
161 | 208 | |
162 | 209 | // Deprecated: Use CreateReq.ProtoReflect.Descriptor instead. |
163 | 210 | func (*CreateReq) Descriptor() ([]byte, []int) { |
164 | - return file_game_proto_rawDescGZIP(), []int{2} | |
211 | + return file_game_proto_rawDescGZIP(), []int{3} | |
165 | 212 | } |
166 | 213 | |
167 | 214 | func (x *CreateReq) GetUid() string { |
... | ... | @@ -183,16 +230,15 @@ type RoleRsp struct { |
183 | 230 | sizeCache protoimpl.SizeCache |
184 | 231 | unknownFields protoimpl.UnknownFields |
185 | 232 | |
186 | - Role *Role `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` | |
187 | - Hero []*Hero `protobuf:"bytes,3,rep,name=hero,proto3" json:"hero,omitempty"` | |
188 | - Team *Team `protobuf:"bytes,4,opt,name=team,proto3" json:"team,omitempty"` | |
189 | - Equips []*Equipment `protobuf:"bytes,5,rep,name=equips,proto3" json:"equips,omitempty"` | |
233 | + Role *Role `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` | |
234 | + Hero []*Hero `protobuf:"bytes,3,rep,name=hero,proto3" json:"hero,omitempty"` | |
235 | + Team []*Team `protobuf:"bytes,4,rep,name=team,proto3" json:"team,omitempty"` | |
190 | 236 | } |
191 | 237 | |
192 | 238 | func (x *RoleRsp) Reset() { |
193 | 239 | *x = RoleRsp{} |
194 | 240 | if protoimpl.UnsafeEnabled { |
195 | - mi := &file_game_proto_msgTypes[3] | |
241 | + mi := &file_game_proto_msgTypes[4] | |
196 | 242 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
197 | 243 | ms.StoreMessageInfo(mi) |
198 | 244 | } |
... | ... | @@ -205,7 +251,7 @@ func (x *RoleRsp) String() string { |
205 | 251 | func (*RoleRsp) ProtoMessage() {} |
206 | 252 | |
207 | 253 | func (x *RoleRsp) ProtoReflect() protoreflect.Message { |
208 | - mi := &file_game_proto_msgTypes[3] | |
254 | + mi := &file_game_proto_msgTypes[4] | |
209 | 255 | if protoimpl.UnsafeEnabled && x != nil { |
210 | 256 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
211 | 257 | if ms.LoadMessageInfo() == nil { |
... | ... | @@ -218,7 +264,7 @@ func (x *RoleRsp) ProtoReflect() protoreflect.Message { |
218 | 264 | |
219 | 265 | // Deprecated: Use RoleRsp.ProtoReflect.Descriptor instead. |
220 | 266 | func (*RoleRsp) Descriptor() ([]byte, []int) { |
221 | - return file_game_proto_rawDescGZIP(), []int{3} | |
267 | + return file_game_proto_rawDescGZIP(), []int{4} | |
222 | 268 | } |
223 | 269 | |
224 | 270 | func (x *RoleRsp) GetRole() *Role { |
... | ... | @@ -235,20 +281,13 @@ func (x *RoleRsp) GetHero() []*Hero { |
235 | 281 | return nil |
236 | 282 | } |
237 | 283 | |
238 | -func (x *RoleRsp) GetTeam() *Team { | |
284 | +func (x *RoleRsp) GetTeam() []*Team { | |
239 | 285 | if x != nil { |
240 | 286 | return x.Team |
241 | 287 | } |
242 | 288 | return nil |
243 | 289 | } |
244 | 290 | |
245 | -func (x *RoleRsp) GetEquips() []*Equipment { | |
246 | - if x != nil { | |
247 | - return x.Equips | |
248 | - } | |
249 | - return nil | |
250 | -} | |
251 | - | |
252 | 291 | var File_game_proto protoreflect.FileDescriptor |
253 | 292 | |
254 | 293 | var file_game_proto_rawDesc = []byte{ |
... | ... | @@ -256,6 +295,8 @@ var file_game_proto_rawDesc = []byte{ |
256 | 295 | 0x6d, 0x65, 0x1a, 0x0c, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, |
257 | 296 | 0x22, 0x1e, 0x0a, 0x08, 0x48, 0x65, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, |
258 | 297 | 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, |
298 | + 0x22, 0x1e, 0x0a, 0x08, 0x48, 0x65, 0x61, 0x72, 0x74, 0x52, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, | |
299 | + 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, | |
259 | 300 | 0x22, 0x38, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, |
260 | 301 | 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, |
261 | 302 | 0x65, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, |
... | ... | @@ -263,18 +304,15 @@ var file_game_proto_rawDesc = []byte{ |
263 | 304 | 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, |
264 | 305 | 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, |
265 | 306 | 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, |
266 | - 0x65, 0x22, 0x9a, 0x01, 0x0a, 0x07, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x73, 0x70, 0x12, 0x20, 0x0a, | |
267 | - 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, 0x6f, | |
268 | - 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, | |
269 | - 0x20, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, | |
270 | - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, | |
271 | - 0x6f, 0x12, 0x20, 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, | |
272 | - 0x0c, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x04, 0x74, | |
273 | - 0x65, 0x61, 0x6d, 0x12, 0x29, 0x0a, 0x06, 0x65, 0x71, 0x75, 0x69, 0x70, 0x73, 0x18, 0x05, 0x20, | |
274 | - 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x45, 0x71, 0x75, | |
275 | - 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x65, 0x71, 0x75, 0x69, 0x70, 0x73, 0x42, 0x0a, | |
276 | - 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, | |
277 | - 0x6f, 0x33, | |
307 | + 0x65, 0x22, 0x6f, 0x0a, 0x07, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x73, 0x70, 0x12, 0x20, 0x0a, 0x04, | |
308 | + 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, 0x6f, 0x64, | |
309 | + 0x65, 0x6c, 0x73, 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x20, | |
310 | + 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, | |
311 | + 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, | |
312 | + 0x12, 0x20, 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, | |
313 | + 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x04, 0x74, 0x65, | |
314 | + 0x61, 0x6d, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x3b, 0x70, 0x62, 0x62, 0x06, | |
315 | + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, | |
278 | 316 | } |
279 | 317 | |
280 | 318 | var ( |
... | ... | @@ -289,27 +327,26 @@ func file_game_proto_rawDescGZIP() []byte { |
289 | 327 | return file_game_proto_rawDescData |
290 | 328 | } |
291 | 329 | |
292 | -var file_game_proto_msgTypes = make([]protoimpl.MessageInfo, 4) | |
330 | +var file_game_proto_msgTypes = make([]protoimpl.MessageInfo, 5) | |
293 | 331 | var file_game_proto_goTypes = []interface{}{ |
294 | 332 | (*HeartReq)(nil), // 0: game.HeartReq |
295 | - (*LoginReq)(nil), // 1: game.LoginReq | |
296 | - (*CreateReq)(nil), // 2: game.CreateReq | |
297 | - (*RoleRsp)(nil), // 3: game.RoleRsp | |
298 | - (*Role)(nil), // 4: models.Role | |
299 | - (*Hero)(nil), // 5: models.Hero | |
300 | - (*Team)(nil), // 6: models.Team | |
301 | - (*Equipment)(nil), // 7: models.Equipment | |
333 | + (*HeartRsp)(nil), // 1: game.HeartRsp | |
334 | + (*LoginReq)(nil), // 2: game.LoginReq | |
335 | + (*CreateReq)(nil), // 3: game.CreateReq | |
336 | + (*RoleRsp)(nil), // 4: game.RoleRsp | |
337 | + (*Role)(nil), // 5: models.Role | |
338 | + (*Hero)(nil), // 6: models.Hero | |
339 | + (*Team)(nil), // 7: models.Team | |
302 | 340 | } |
303 | 341 | var file_game_proto_depIdxs = []int32{ |
304 | - 4, // 0: game.RoleRsp.role:type_name -> models.Role | |
305 | - 5, // 1: game.RoleRsp.hero:type_name -> models.Hero | |
306 | - 6, // 2: game.RoleRsp.team:type_name -> models.Team | |
307 | - 7, // 3: game.RoleRsp.equips:type_name -> models.Equipment | |
308 | - 4, // [4:4] is the sub-list for method output_type | |
309 | - 4, // [4:4] is the sub-list for method input_type | |
310 | - 4, // [4:4] is the sub-list for extension type_name | |
311 | - 4, // [4:4] is the sub-list for extension extendee | |
312 | - 0, // [0:4] is the sub-list for field type_name | |
342 | + 5, // 0: game.RoleRsp.role:type_name -> models.Role | |
343 | + 6, // 1: game.RoleRsp.hero:type_name -> models.Hero | |
344 | + 7, // 2: game.RoleRsp.team:type_name -> models.Team | |
345 | + 3, // [3:3] is the sub-list for method output_type | |
346 | + 3, // [3:3] is the sub-list for method input_type | |
347 | + 3, // [3:3] is the sub-list for extension type_name | |
348 | + 3, // [3:3] is the sub-list for extension extendee | |
349 | + 0, // [0:3] is the sub-list for field type_name | |
313 | 350 | } |
314 | 351 | |
315 | 352 | func init() { file_game_proto_init() } |
... | ... | @@ -332,7 +369,7 @@ func file_game_proto_init() { |
332 | 369 | } |
333 | 370 | } |
334 | 371 | file_game_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { |
335 | - switch v := v.(*LoginReq); i { | |
372 | + switch v := v.(*HeartRsp); i { | |
336 | 373 | case 0: |
337 | 374 | return &v.state |
338 | 375 | case 1: |
... | ... | @@ -344,7 +381,7 @@ func file_game_proto_init() { |
344 | 381 | } |
345 | 382 | } |
346 | 383 | file_game_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { |
347 | - switch v := v.(*CreateReq); i { | |
384 | + switch v := v.(*LoginReq); i { | |
348 | 385 | case 0: |
349 | 386 | return &v.state |
350 | 387 | case 1: |
... | ... | @@ -356,6 +393,18 @@ func file_game_proto_init() { |
356 | 393 | } |
357 | 394 | } |
358 | 395 | file_game_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { |
396 | + switch v := v.(*CreateReq); i { | |
397 | + case 0: | |
398 | + return &v.state | |
399 | + case 1: | |
400 | + return &v.sizeCache | |
401 | + case 2: | |
402 | + return &v.unknownFields | |
403 | + default: | |
404 | + return nil | |
405 | + } | |
406 | + } | |
407 | + file_game_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { | |
359 | 408 | switch v := v.(*RoleRsp); i { |
360 | 409 | case 0: |
361 | 410 | return &v.state |
... | ... | @@ -374,7 +423,7 @@ func file_game_proto_init() { |
374 | 423 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), |
375 | 424 | RawDescriptor: file_game_proto_rawDesc, |
376 | 425 | NumEnums: 0, |
377 | - NumMessages: 4, | |
426 | + NumMessages: 5, | |
378 | 427 | NumExtensions: 0, |
379 | 428 | NumServices: 0, |
380 | 429 | }, | ... | ... |
pb/models.pb.go
... | ... | @@ -318,7 +318,10 @@ type Team struct { |
318 | 318 | unknownFields protoimpl.UnknownFields |
319 | 319 | |
320 | 320 | Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" index:"unique" pri:"1"` // @inject_tag: index:"unique" pri:"1" |
321 | - HeroIds string `protobuf:"bytes,2,opt,name=hero_ids,json=heroIds,proto3" json:"hero_ids,omitempty"` | |
321 | + RoleId string `protobuf:"bytes,2,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"` | |
322 | + HeroId1 string `protobuf:"bytes,3,opt,name=hero_id1,json=heroId1,proto3" json:"hero_id1,omitempty"` | |
323 | + HeroId2 string `protobuf:"bytes,4,opt,name=hero_id2,json=heroId2,proto3" json:"hero_id2,omitempty"` | |
324 | + HeroId3 string `protobuf:"bytes,5,opt,name=hero_id3,json=heroId3,proto3" json:"hero_id3,omitempty"` | |
322 | 325 | } |
323 | 326 | |
324 | 327 | func (x *Team) Reset() { |
... | ... | @@ -360,9 +363,30 @@ func (x *Team) GetId() string { |
360 | 363 | return "" |
361 | 364 | } |
362 | 365 | |
363 | -func (x *Team) GetHeroIds() string { | |
366 | +func (x *Team) GetRoleId() string { | |
364 | 367 | if x != nil { |
365 | - return x.HeroIds | |
368 | + return x.RoleId | |
369 | + } | |
370 | + return "" | |
371 | +} | |
372 | + | |
373 | +func (x *Team) GetHeroId1() string { | |
374 | + if x != nil { | |
375 | + return x.HeroId1 | |
376 | + } | |
377 | + return "" | |
378 | +} | |
379 | + | |
380 | +func (x *Team) GetHeroId2() string { | |
381 | + if x != nil { | |
382 | + return x.HeroId2 | |
383 | + } | |
384 | + return "" | |
385 | +} | |
386 | + | |
387 | +func (x *Team) GetHeroId3() string { | |
388 | + if x != nil { | |
389 | + return x.HeroId3 | |
366 | 390 | } |
367 | 391 | return "" |
368 | 392 | } |
... | ... | @@ -526,10 +550,15 @@ var file_models_proto_rawDesc = []byte{ |
526 | 550 | 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x22, 0x2c, 0x0a, 0x04, 0x50, 0x72, 0x6f, 0x70, 0x12, 0x0e, 0x0a, |
527 | 551 | 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, |
528 | 552 | 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, |
529 | - 0x75, 0x6e, 0x74, 0x22, 0x31, 0x0a, 0x04, 0x54, 0x65, 0x61, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, | |
530 | - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x68, | |
531 | - 0x65, 0x72, 0x6f, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x68, | |
532 | - 0x65, 0x72, 0x6f, 0x49, 0x64, 0x73, 0x22, 0xdf, 0x01, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x12, | |
553 | + 0x75, 0x6e, 0x74, 0x22, 0x80, 0x01, 0x0a, 0x04, 0x54, 0x65, 0x61, 0x6d, 0x12, 0x0e, 0x0a, 0x02, | |
554 | + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x17, 0x0a, 0x07, | |
555 | + 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, | |
556 | + 0x6f, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x68, 0x65, 0x72, 0x6f, 0x5f, 0x69, 0x64, | |
557 | + 0x31, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x31, | |
558 | + 0x12, 0x19, 0x0a, 0x08, 0x68, 0x65, 0x72, 0x6f, 0x5f, 0x69, 0x64, 0x32, 0x18, 0x04, 0x20, 0x01, | |
559 | + 0x28, 0x09, 0x52, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x32, 0x12, 0x19, 0x0a, 0x08, 0x68, | |
560 | + 0x65, 0x72, 0x6f, 0x5f, 0x69, 0x64, 0x33, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x68, | |
561 | + 0x65, 0x72, 0x6f, 0x49, 0x64, 0x33, 0x22, 0xdf, 0x01, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x12, | |
533 | 562 | 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, |
534 | 563 | 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, |
535 | 564 | 0x64, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, | ... | ... |
pb/protocode.pb.go
... | ... | @@ -25,9 +25,10 @@ type ProtoCode int32 |
25 | 25 | const ( |
26 | 26 | ProtoCode_UNKNOWN ProtoCode = 0 |
27 | 27 | ProtoCode_HeartReq ProtoCode = 1 |
28 | - ProtoCode_LoginReq ProtoCode = 2 | |
29 | - ProtoCode_CreateReq ProtoCode = 3 | |
30 | - ProtoCode_RoleRsp ProtoCode = 4 | |
28 | + ProtoCode_HeartRsp ProtoCode = 2 | |
29 | + ProtoCode_LoginReq ProtoCode = 3 | |
30 | + ProtoCode_CreateReq ProtoCode = 4 | |
31 | + ProtoCode_RoleRsp ProtoCode = 5 | |
31 | 32 | ) |
32 | 33 | |
33 | 34 | // Enum value maps for ProtoCode. |
... | ... | @@ -35,16 +36,18 @@ var ( |
35 | 36 | ProtoCode_name = map[int32]string{ |
36 | 37 | 0: "UNKNOWN", |
37 | 38 | 1: "HeartReq", |
38 | - 2: "LoginReq", | |
39 | - 3: "CreateReq", | |
40 | - 4: "RoleRsp", | |
39 | + 2: "HeartRsp", | |
40 | + 3: "LoginReq", | |
41 | + 4: "CreateReq", | |
42 | + 5: "RoleRsp", | |
41 | 43 | } |
42 | 44 | ProtoCode_value = map[string]int32{ |
43 | 45 | "UNKNOWN": 0, |
44 | 46 | "HeartReq": 1, |
45 | - "LoginReq": 2, | |
46 | - "CreateReq": 3, | |
47 | - "RoleRsp": 4, | |
47 | + "HeartRsp": 2, | |
48 | + "LoginReq": 3, | |
49 | + "CreateReq": 4, | |
50 | + "RoleRsp": 5, | |
48 | 51 | } |
49 | 52 | ) |
50 | 53 | |
... | ... | @@ -79,14 +82,14 @@ var File_protocode_proto protoreflect.FileDescriptor |
79 | 82 | |
80 | 83 | var file_protocode_proto_rawDesc = []byte{ |
81 | 84 | 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, |
82 | - 0x6f, 0x12, 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x64, 0x65, 0x2a, 0x50, 0x0a, 0x09, | |
85 | + 0x6f, 0x12, 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x64, 0x65, 0x2a, 0x5e, 0x0a, 0x09, | |
83 | 86 | 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, |
84 | 87 | 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x48, 0x65, 0x61, 0x72, 0x74, 0x52, |
85 | - 0x65, 0x71, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, | |
86 | - 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x10, | |
87 | - 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x73, 0x70, 0x10, 0x04, 0x42, 0x0a, | |
88 | - 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, | |
89 | - 0x6f, 0x33, | |
88 | + 0x65, 0x71, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x48, 0x65, 0x61, 0x72, 0x74, 0x52, 0x73, 0x70, | |
89 | + 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x10, 0x03, | |
90 | + 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x10, 0x04, 0x12, | |
91 | + 0x0b, 0x0a, 0x07, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x73, 0x70, 0x10, 0x05, 0x42, 0x0a, 0x5a, 0x08, | |
92 | + 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, | |
90 | 93 | } |
91 | 94 | |
92 | 95 | var ( | ... | ... |