Commit 436e0af4e8fbfa54d883baa9f98aace6e7164e44

Authored by zhangqijia
1 parent 54b3f133

reactor: dir; Account loginrsp uid->token

cmd/gameserver/action/RoleAction.go
@@ -42,7 +42,7 @@ func LoginRpc(msg components.IMessage) (int32, interface{}) { @@ -42,7 +42,7 @@ func LoginRpc(msg components.IMessage) (int32, interface{}) {
42 return 1, nil 42 return 1, nil
43 } 43 }
44 44
45 - role := models.RoleExistByUid(req.Uid) 45 + role := models.RoleExistByUid(req.Token)
46 if role == nil { 46 if role == nil {
47 return 2, nil 47 return 2, nil
48 } 48 }
cmd/gameserver/game.go
@@ -6,7 +6,7 @@ import ( @@ -6,7 +6,7 @@ import (
6 "pro2d/cmd/gameserver/action" 6 "pro2d/cmd/gameserver/action"
7 "pro2d/common" 7 "pro2d/common"
8 "pro2d/common/components" 8 "pro2d/common/components"
9 - "pro2d/common/db" 9 + "pro2d/common/db/mongoproxy"
10 "pro2d/models" 10 "pro2d/models"
11 11
12 "pro2d/common/etcd" 12 "pro2d/common/etcd"
@@ -34,7 +34,7 @@ func NewGameServer(sconf *common.SConf) (*GameServer, error) { @@ -34,7 +34,7 @@ func NewGameServer(sconf *common.SConf) (*GameServer, error) {
34 s.IServer = iserver 34 s.IServer = iserver
35 35
36 //mgo init 36 //mgo init
37 - err := db.ConnectMongo(sconf.MongoConf) 37 + err := mongoproxy.ConnectMongo(sconf.MongoConf)
38 if err != nil { 38 if err != nil {
39 return nil, err 39 return nil, err
40 } 40 }
@@ -57,7 +57,7 @@ func (s *GameServer) Start() error { @@ -57,7 +57,7 @@ func (s *GameServer) Start() error {
57 func (s *GameServer) Stop() { 57 func (s *GameServer) Stop() {
58 s.IServer.Stop() 58 s.IServer.Stop()
59 59
60 - db.CloseMongo() 60 + mongoproxy.CloseMongo()
61 s.EtcdClient.Close() 61 s.EtcdClient.Close()
62 } 62 }
63 63
cmd/gameserver/plugin/plugin.go
@@ -28,7 +28,7 @@ func LoginRpc(msg components.IMessage) (int32, interface{}) { @@ -28,7 +28,7 @@ func LoginRpc(msg components.IMessage) (int32, interface{}) {
28 return 1, nil 28 return 1, nil
29 } 29 }
30 30
31 - role := models.RoleExistByUid(req.Uid) 31 + role := models.RoleExistByUid(req.Token)
32 if role == nil { 32 if role == nil {
33 return 2, nil 33 return 2, nil
34 } 34 }
cmd/httpserver/AccountAction.go
@@ -15,35 +15,39 @@ type AccountAction struct { @@ -15,35 +15,39 @@ type AccountAction struct {
15 func (h *AccountAction) Register(c *gin.Context) (int, interface{}){ 15 func (h *AccountAction) Register(c *gin.Context) (int, interface{}){
16 var register pb.Register 16 var register pb.Register
17 if err := c.ShouldBindJSON(&register); err != nil { 17 if err := c.ShouldBindJSON(&register); err != nil {
18 - return -1, err.Error() 18 + return 1, err.Error()
  19 + }
  20 +
  21 + if register.Code != "0000" {
  22 + return 2, "code error"
19 } 23 }
20 24
21 account := models.NewAccount(register.Phone) 25 account := models.NewAccount(register.Phone)
22 if err := account.Load(); err == nil { 26 if err := account.Load(); err == nil {
23 - return -2 , "account exists: " + register.Phone 27 + return 3 , "account exists: " + register.Phone
24 } 28 }
25 29
26 account.Uid = common.SnowFlack.NextValStr() 30 account.Uid = common.SnowFlack.NextValStr()
27 account.Password = utils.Md5V(register.Password) 31 account.Password = utils.Md5V(register.Password)
28 if err := account.Create(); err != nil{ 32 if err := account.Create(); err != nil{
29 - return -3, "account register err: " + err.Error() 33 + return 4, "account register err: " + err.Error()
30 } 34 }
31 account.Password = register.Password 35 account.Password = register.Password
32 - return 0, account.Account 36 + return 0, "success"
33 } 37 }
34 38
35 func (h *AccountAction) Login(c *gin.Context) (int,interface{}) { 39 func (h *AccountAction) Login(c *gin.Context) (int,interface{}) {
36 var login pb.Account 40 var login pb.Account
37 if err := c.ShouldBindJSON(&login); err != nil { 41 if err := c.ShouldBindJSON(&login); err != nil {
38 - return -1, err.Error() 42 + return 1, err.Error()
39 } 43 }
40 account := models.NewAccount(login.Phone) 44 account := models.NewAccount(login.Phone)
41 if err := account.Load(); err != nil { 45 if err := account.Load(); err != nil {
42 - return -2, err.Error() 46 + return 2, err.Error()
43 } 47 }
44 48
45 if utils.Md5V(login.Password) != account.Password { 49 if utils.Md5V(login.Password) != account.Password {
46 - return -3, "password error" 50 + return 3, "password error"
47 } 51 }
48 52
49 var gs []*pb.ServiceInfo 53 var gs []*pb.ServiceInfo
@@ -55,7 +59,7 @@ func (h *AccountAction) Login(c *gin.Context) (int,interface{}) { @@ -55,7 +59,7 @@ func (h *AccountAction) Login(c *gin.Context) (int,interface{}) {
55 }) 59 })
56 } 60 }
57 rsp := &pb.LoginRsp{ 61 rsp := &pb.LoginRsp{
58 - Uid: account.Uid, 62 + Token: account.Uid,
59 GameService: gs, 63 GameService: gs,
60 } 64 }
61 return 0, rsp 65 return 0, rsp
cmd/httpserver/http.go
@@ -6,7 +6,7 @@ import ( @@ -6,7 +6,7 @@ import (
6 "os/signal" 6 "os/signal"
7 "pro2d/common" 7 "pro2d/common"
8 "pro2d/common/components" 8 "pro2d/common/components"
9 - "pro2d/common/db" 9 + "pro2d/common/db/mongoproxy"
10 "pro2d/common/etcd" 10 "pro2d/common/etcd"
11 "pro2d/common/logger" 11 "pro2d/common/logger"
12 "syscall" 12 "syscall"
@@ -23,7 +23,7 @@ func NewAccountServer(version string, port ...string) *AccountServer { @@ -23,7 +23,7 @@ func NewAccountServer(version string, port ...string) *AccountServer {
23 23
24 func (s *AccountServer) Init() error { 24 func (s *AccountServer) Init() error {
25 //mgo init 25 //mgo init
26 - err := db.ConnectMongo(common.GlobalConf.AccountConf.MongoConf) 26 + err := mongoproxy.ConnectMongo(common.GlobalConf.AccountConf.MongoConf)
27 27
28 //Etcd ๅˆๅง‹ๅŒ– 28 //Etcd ๅˆๅง‹ๅŒ–
29 s.EtcdClient, err = etcd.NewEtcdClient(common.GlobalConf.Etcd) 29 s.EtcdClient, err = etcd.NewEtcdClient(common.GlobalConf.Etcd)
@@ -6,6 +6,7 @@ import ( @@ -6,6 +6,7 @@ import (
6 "gopkg.in/yaml.v3" 6 "gopkg.in/yaml.v3"
7 "io/ioutil" 7 "io/ioutil"
8 "pro2d/common/logger" 8 "pro2d/common/logger"
  9 + "pro2d/common/snow"
9 "strings" 10 "strings"
10 ) 11 )
11 12
@@ -92,7 +93,7 @@ type ServerConf struct { @@ -92,7 +93,7 @@ type ServerConf struct {
92 93
93 var( 94 var(
94 GlobalConf ServerConf 95 GlobalConf ServerConf
95 - SnowFlack *Snowflake 96 + SnowFlack *snow.Snowflake
96 ) 97 )
97 98
98 func init() { 99 func init() {
@@ -120,5 +121,5 @@ func init() { @@ -120,5 +121,5 @@ func init() {
120 } 121 }
121 122
122 //ๅˆๅง‹ๅŒ–้›ช่Šฑ็ฎ—ๆณ• 123 //ๅˆๅง‹ๅŒ–้›ช่Šฑ็ฎ—ๆณ•
123 - SnowFlack = NewSnowflake(GlobalConf.WorkerID, GlobalConf.DatacenterID) 124 + SnowFlack = snow.NewSnowflake(GlobalConf.WorkerID, GlobalConf.DatacenterID)
124 } 125 }
125 \ No newline at end of file 126 \ No newline at end of file
common/db/mongo.go renamed to common/db/mongoproxy/mongo.go
1 -package db 1 +package mongoproxy
2 2
3 import ( 3 import (
4 "context" 4 "context"
@@ -28,7 +28,7 @@ type MgoColl struct { @@ -28,7 +28,7 @@ type MgoColl struct {
28 func NewMongoColl(dbname string, schema components.ISchema) *MgoColl { 28 func NewMongoColl(dbname string, schema components.ISchema) *MgoColl {
29 m := &MgoColl{ 29 m := &MgoColl{
30 dbname: dbname, 30 dbname: dbname,
31 - coll: DB().Collection(dbname), 31 + coll: DB().Collection(dbname),
32 Schema: schema, 32 Schema: schema,
33 } 33 }
34 return m 34 return m
common/db/mongoplugin.go renamed to common/db/mongoproxy/mongoplugin.go
1 -package db 1 +package mongoproxy
2 2
3 import ( 3 import (
4 "context" 4 "context"
common/db/redis.go renamed to common/db/redisproxy/redis.go
1 -package db 1 +package redisproxy
2 2
3 import ( 3 import (
4 "github.com/garyburd/redigo/redis" 4 "github.com/garyburd/redigo/redis"
common/snowflake.go renamed to common/snow/snowflake.go
1 -package common 1 +package snow
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
@@ -29,8 +29,6 @@ const ( @@ -29,8 +29,6 @@ const (
29 timestampShift = sequenceBits + workeridBits + datacenteridBits // ๆ—ถ้—ดๆˆณๅทฆ็งปไฝๆ•ฐ 29 timestampShift = sequenceBits + workeridBits + datacenteridBits // ๆ—ถ้—ดๆˆณๅทฆ็งปไฝๆ•ฐ
30 ) 30 )
31 31
32 -  
33 -  
34 func NewSnowflake(workerid, datacenterid int64) *Snowflake { 32 func NewSnowflake(workerid, datacenterid int64) *Snowflake {
35 return &Snowflake{ 33 return &Snowflake{
36 Mutex: new(sync.Mutex), 34 Mutex: new(sync.Mutex),
@@ -45,7 +43,6 @@ func (s *Snowflake) NextValStr() string { @@ -45,7 +43,6 @@ func (s *Snowflake) NextValStr() string {
45 return fmt.Sprintf("%d", s.NextVal()) 43 return fmt.Sprintf("%d", s.NextVal())
46 } 44 }
47 45
48 -  
49 func (s *Snowflake) NextVal() int64 { 46 func (s *Snowflake) NextVal() int64 {
50 s.Lock() 47 s.Lock()
51 now := time.Now().UnixNano() / 1000000 // ่ฝฌๆฏซ็ง’ 48 now := time.Now().UnixNano() / 1000000 // ่ฝฌๆฏซ็ง’
1 package models 1 package models
2 2
3 import ( 3 import (
4 - "pro2d/common/db" 4 + "pro2d/common/db/mongoproxy"
5 "pro2d/pb" 5 "pro2d/pb"
6 ) 6 )
7 7
@@ -14,5 +14,5 @@ func InitModels() { @@ -14,5 +14,5 @@ func InitModels() {
14 pb.Role{}, 14 pb.Role{},
15 pb.Team{}, 15 pb.Team{},
16 } 16 }
17 - db.InitDoc(schema...) 17 + mongoproxy.InitDoc(schema...)
18 } 18 }
@@ -3,7 +3,7 @@ package models @@ -3,7 +3,7 @@ package models
3 import ( 3 import (
4 "fmt" 4 "fmt"
5 "pro2d/common" 5 "pro2d/common"
6 - "pro2d/common/db" 6 + "pro2d/common/db/mongoproxy"
7 "pro2d/common/logger" 7 "pro2d/common/logger"
8 "pro2d/pb" 8 "pro2d/pb"
9 "pro2d/utils" 9 "pro2d/utils"
@@ -24,7 +24,7 @@ type RoleModel struct { @@ -24,7 +24,7 @@ type RoleModel struct {
24 func RoleExistByUid(uid string) *RoleModel { 24 func RoleExistByUid(uid string) *RoleModel {
25 data := &pb.Role{Uid: uid} 25 data := &pb.Role{Uid: uid}
26 26
27 - if err := db.FindOne(db.GetBsonM("uid", uid), data); err != nil { 27 + if err := mongoproxy.FindOne(mongoproxy.GetBsonM("uid", uid), data); err != nil {
28 logger.Error("Role exist err: %v", err) 28 logger.Error("Role exist err: %v", err)
29 return nil 29 return nil
30 } 30 }
models/role_test.go
@@ -3,7 +3,7 @@ package models @@ -3,7 +3,7 @@ package models
3 import ( 3 import (
4 "fmt" 4 "fmt"
5 "pro2d/common" 5 "pro2d/common"
6 - "pro2d/common/db" 6 + "pro2d/common/db/mongoproxy"
7 "pro2d/common/logger" 7 "pro2d/common/logger"
8 "pro2d/pb" 8 "pro2d/pb"
9 "pro2d/utils" 9 "pro2d/utils"
@@ -11,7 +11,7 @@ import ( @@ -11,7 +11,7 @@ import (
11 ) 11 )
12 12
13 func TestNewRole(t *testing.T) { 13 func TestNewRole(t *testing.T) {
14 - err := db.ConnectMongo(common.GlobalConf.MongoConf) 14 + err := mongoproxy.ConnectMongo(common.GlobalConf.MongoConf)
15 if err != nil { 15 if err != nil {
16 logger.Error(err) 16 logger.Error(err)
17 return 17 return
@@ -2,7 +2,7 @@ package models @@ -2,7 +2,7 @@ package models
2 2
3 import ( 3 import (
4 "pro2d/common/components" 4 "pro2d/common/components"
5 - "pro2d/common/db" 5 + "pro2d/common/db/mongoproxy"
6 "pro2d/common/logger" 6 "pro2d/common/logger"
7 "reflect" 7 "reflect"
8 "strings" 8 "strings"
@@ -39,8 +39,8 @@ func NewSchema(key string, schema interface{}) *Schema { @@ -39,8 +39,8 @@ func NewSchema(key string, schema interface{}) *Schema {
39 schema: schema, 39 schema: schema,
40 } 40 }
41 41
42 - sch.db = db.NewMongoColl(sch.GetSchemaName(), sch)  
43 - sch.pri = db.GetBsonD(sch.getPriTag(), key) 42 + sch.db = mongoproxy.NewMongoColl(sch.GetSchemaName(), sch)
  43 + sch.pri = mongoproxy.GetBsonD(sch.getPriTag(), key)
44 return sch 44 return sch
45 } 45 }
46 46
@@ -88,7 +88,7 @@ type LoginRsp struct { @@ -88,7 +88,7 @@ type LoginRsp struct {
88 sizeCache protoimpl.SizeCache 88 sizeCache protoimpl.SizeCache
89 unknownFields protoimpl.UnknownFields 89 unknownFields protoimpl.UnknownFields
90 90
91 - Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` 91 + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
92 GameService []*ServiceInfo `protobuf:"bytes,2,rep,name=game_service,json=gameService,proto3" json:"game_service,omitempty"` 92 GameService []*ServiceInfo `protobuf:"bytes,2,rep,name=game_service,json=gameService,proto3" json:"game_service,omitempty"`
93 } 93 }
94 94
@@ -124,9 +124,9 @@ func (*LoginRsp) Descriptor() ([]byte, []int) { @@ -124,9 +124,9 @@ func (*LoginRsp) Descriptor() ([]byte, []int) {
124 return file_account_proto_rawDescGZIP(), []int{1} 124 return file_account_proto_rawDescGZIP(), []int{1}
125 } 125 }
126 126
127 -func (x *LoginRsp) GetUid() string { 127 +func (x *LoginRsp) GetToken() string {
128 if x != nil { 128 if x != nil {
129 - return x.Uid 129 + return x.Token
130 } 130 }
131 return "" 131 return ""
132 } 132 }
@@ -145,7 +145,7 @@ type Register struct { @@ -145,7 +145,7 @@ type Register struct {
145 145
146 Phone string `protobuf:"bytes,1,opt,name=phone,proto3" json:"phone,omitempty" binding:"required"` // @inject_tag: binding:"required" 146 Phone string `protobuf:"bytes,1,opt,name=phone,proto3" json:"phone,omitempty" binding:"required"` // @inject_tag: binding:"required"
147 Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty" binding:"required"` // @inject_tag: binding:"required" 147 Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty" binding:"required"` // @inject_tag: binding:"required"
148 - Code int32 `protobuf:"varint,3,opt,name=code,proto3" json:"code,omitempty" binding:"required"` // @inject_tag: binding:"required" 148 + Code string `protobuf:"bytes,3,opt,name=code,proto3" json:"code,omitempty" binding:"required"` // @inject_tag: binding:"required"
149 } 149 }
150 150
151 func (x *Register) Reset() { 151 func (x *Register) Reset() {
@@ -194,11 +194,11 @@ func (x *Register) GetPassword() string { @@ -194,11 +194,11 @@ func (x *Register) GetPassword() string {
194 return "" 194 return ""
195 } 195 }
196 196
197 -func (x *Register) GetCode() int32 { 197 +func (x *Register) GetCode() string {
198 if x != nil { 198 if x != nil {
199 return x.Code 199 return x.Code
200 } 200 }
201 - return 0 201 + return ""
202 } 202 }
203 203
204 var File_account_proto protoreflect.FileDescriptor 204 var File_account_proto protoreflect.FileDescriptor
@@ -210,19 +210,19 @@ var file_account_proto_rawDesc = []byte{ @@ -210,19 +210,19 @@ var file_account_proto_rawDesc = []byte{
210 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 210 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
211 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 211 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61,
212 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 212 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64,
213 - 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x55, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x73,  
214 - 0x70, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,  
215 - 0x75, 0x69, 0x64, 0x12, 0x37, 0x0a, 0x0c, 0x67, 0x61, 0x6d, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76,  
216 - 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x63, 0x63, 0x6f,  
217 - 0x75, 0x6e, 0x74, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52,  
218 - 0x0b, 0x67, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0x50, 0x0a, 0x08,  
219 - 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e,  
220 - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x1a,  
221 - 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,  
222 - 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f,  
223 - 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x42, 0x0a,  
224 - 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,  
225 - 0x6f, 0x33, 213 + 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x59, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x73,
  214 + 0x70, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
  215 + 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x37, 0x0a, 0x0c, 0x67, 0x61, 0x6d, 0x65, 0x5f,
  216 + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e,
  217 + 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49,
  218 + 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x67, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
  219 + 0x22, 0x50, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05,
  220 + 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f,
  221 + 0x6e, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02,
  222 + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x12,
  223 + 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f,
  224 + 0x64, 0x65, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x3b, 0x70, 0x62, 0x62, 0x06,
  225 + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
226 } 226 }
227 227
228 var ( 228 var (
@@ -73,7 +73,7 @@ type LoginReq struct { @@ -73,7 +73,7 @@ type LoginReq struct {
73 sizeCache protoimpl.SizeCache 73 sizeCache protoimpl.SizeCache
74 unknownFields protoimpl.UnknownFields 74 unknownFields protoimpl.UnknownFields
75 75
76 - Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` 76 + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
77 Device string `protobuf:"bytes,2,opt,name=device,proto3" json:"device,omitempty"` 77 Device string `protobuf:"bytes,2,opt,name=device,proto3" json:"device,omitempty"`
78 } 78 }
79 79
@@ -109,9 +109,9 @@ func (*LoginReq) Descriptor() ([]byte, []int) { @@ -109,9 +109,9 @@ func (*LoginReq) Descriptor() ([]byte, []int) {
109 return file_game_proto_rawDescGZIP(), []int{1} 109 return file_game_proto_rawDescGZIP(), []int{1}
110 } 110 }
111 111
112 -func (x *LoginReq) GetUid() string { 112 +func (x *LoginReq) GetToken() string {
113 if x != nil { 113 if x != nil {
114 - return x.Uid 114 + return x.Token
115 } 115 }
116 return "" 116 return ""
117 } 117 }
@@ -123,61 +123,6 @@ func (x *LoginReq) GetDevice() string { @@ -123,61 +123,6 @@ func (x *LoginReq) GetDevice() string {
123 return "" 123 return ""
124 } 124 }
125 125
126 -type LoginResponse struct {  
127 - state protoimpl.MessageState  
128 - sizeCache protoimpl.SizeCache  
129 - unknownFields protoimpl.UnknownFields  
130 -  
131 - Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"`  
132 - Device string `protobuf:"bytes,2,opt,name=device,proto3" json:"device,omitempty"`  
133 -}  
134 -  
135 -func (x *LoginResponse) Reset() {  
136 - *x = LoginResponse{}  
137 - if protoimpl.UnsafeEnabled {  
138 - mi := &file_game_proto_msgTypes[2]  
139 - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))  
140 - ms.StoreMessageInfo(mi)  
141 - }  
142 -}  
143 -  
144 -func (x *LoginResponse) String() string {  
145 - return protoimpl.X.MessageStringOf(x)  
146 -}  
147 -  
148 -func (*LoginResponse) ProtoMessage() {}  
149 -  
150 -func (x *LoginResponse) ProtoReflect() protoreflect.Message {  
151 - mi := &file_game_proto_msgTypes[2]  
152 - if protoimpl.UnsafeEnabled && x != nil {  
153 - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))  
154 - if ms.LoadMessageInfo() == nil {  
155 - ms.StoreMessageInfo(mi)  
156 - }  
157 - return ms  
158 - }  
159 - return mi.MessageOf(x)  
160 -}  
161 -  
162 -// Deprecated: Use LoginResponse.ProtoReflect.Descriptor instead.  
163 -func (*LoginResponse) Descriptor() ([]byte, []int) {  
164 - return file_game_proto_rawDescGZIP(), []int{2}  
165 -}  
166 -  
167 -func (x *LoginResponse) GetUid() string {  
168 - if x != nil {  
169 - return x.Uid  
170 - }  
171 - return ""  
172 -}  
173 -  
174 -func (x *LoginResponse) GetDevice() string {  
175 - if x != nil {  
176 - return x.Device  
177 - }  
178 - return ""  
179 -}  
180 -  
181 type CreateReq struct { 126 type CreateReq struct {
182 state protoimpl.MessageState 127 state protoimpl.MessageState
183 sizeCache protoimpl.SizeCache 128 sizeCache protoimpl.SizeCache
@@ -190,7 +135,7 @@ type CreateReq struct { @@ -190,7 +135,7 @@ type CreateReq struct {
190 func (x *CreateReq) Reset() { 135 func (x *CreateReq) Reset() {
191 *x = CreateReq{} 136 *x = CreateReq{}
192 if protoimpl.UnsafeEnabled { 137 if protoimpl.UnsafeEnabled {
193 - mi := &file_game_proto_msgTypes[3] 138 + mi := &file_game_proto_msgTypes[2]
194 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 139 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
195 ms.StoreMessageInfo(mi) 140 ms.StoreMessageInfo(mi)
196 } 141 }
@@ -203,7 +148,7 @@ func (x *CreateReq) String() string { @@ -203,7 +148,7 @@ func (x *CreateReq) String() string {
203 func (*CreateReq) ProtoMessage() {} 148 func (*CreateReq) ProtoMessage() {}
204 149
205 func (x *CreateReq) ProtoReflect() protoreflect.Message { 150 func (x *CreateReq) ProtoReflect() protoreflect.Message {
206 - mi := &file_game_proto_msgTypes[3] 151 + mi := &file_game_proto_msgTypes[2]
207 if protoimpl.UnsafeEnabled && x != nil { 152 if protoimpl.UnsafeEnabled && x != nil {
208 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 153 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
209 if ms.LoadMessageInfo() == nil { 154 if ms.LoadMessageInfo() == nil {
@@ -216,7 +161,7 @@ func (x *CreateReq) ProtoReflect() protoreflect.Message { @@ -216,7 +161,7 @@ func (x *CreateReq) ProtoReflect() protoreflect.Message {
216 161
217 // Deprecated: Use CreateReq.ProtoReflect.Descriptor instead. 162 // Deprecated: Use CreateReq.ProtoReflect.Descriptor instead.
218 func (*CreateReq) Descriptor() ([]byte, []int) { 163 func (*CreateReq) Descriptor() ([]byte, []int) {
219 - return file_game_proto_rawDescGZIP(), []int{3} 164 + return file_game_proto_rawDescGZIP(), []int{2}
220 } 165 }
221 166
222 func (x *CreateReq) GetUid() string { 167 func (x *CreateReq) GetUid() string {
@@ -247,7 +192,7 @@ type RoleRsp struct { @@ -247,7 +192,7 @@ type RoleRsp struct {
247 func (x *RoleRsp) Reset() { 192 func (x *RoleRsp) Reset() {
248 *x = RoleRsp{} 193 *x = RoleRsp{}
249 if protoimpl.UnsafeEnabled { 194 if protoimpl.UnsafeEnabled {
250 - mi := &file_game_proto_msgTypes[4] 195 + mi := &file_game_proto_msgTypes[3]
251 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 196 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
252 ms.StoreMessageInfo(mi) 197 ms.StoreMessageInfo(mi)
253 } 198 }
@@ -260,7 +205,7 @@ func (x *RoleRsp) String() string { @@ -260,7 +205,7 @@ func (x *RoleRsp) String() string {
260 func (*RoleRsp) ProtoMessage() {} 205 func (*RoleRsp) ProtoMessage() {}
261 206
262 func (x *RoleRsp) ProtoReflect() protoreflect.Message { 207 func (x *RoleRsp) ProtoReflect() protoreflect.Message {
263 - mi := &file_game_proto_msgTypes[4] 208 + mi := &file_game_proto_msgTypes[3]
264 if protoimpl.UnsafeEnabled && x != nil { 209 if protoimpl.UnsafeEnabled && x != nil {
265 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 210 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
266 if ms.LoadMessageInfo() == nil { 211 if ms.LoadMessageInfo() == nil {
@@ -273,7 +218,7 @@ func (x *RoleRsp) ProtoReflect() protoreflect.Message { @@ -273,7 +218,7 @@ func (x *RoleRsp) ProtoReflect() protoreflect.Message {
273 218
274 // Deprecated: Use RoleRsp.ProtoReflect.Descriptor instead. 219 // Deprecated: Use RoleRsp.ProtoReflect.Descriptor instead.
275 func (*RoleRsp) Descriptor() ([]byte, []int) { 220 func (*RoleRsp) Descriptor() ([]byte, []int) {
276 - return file_game_proto_rawDescGZIP(), []int{4} 221 + return file_game_proto_rawDescGZIP(), []int{3}
277 } 222 }
278 223
279 func (x *RoleRsp) GetRole() *Role { 224 func (x *RoleRsp) GetRole() *Role {
@@ -311,28 +256,25 @@ var file_game_proto_rawDesc = []byte{ @@ -311,28 +256,25 @@ var file_game_proto_rawDesc = []byte{
311 0x6d, 0x65, 0x1a, 0x0c, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 256 0x6d, 0x65, 0x1a, 0x0c, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
312 0x22, 0x1e, 0x0a, 0x08, 0x48, 0x65, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 257 0x22, 0x1e, 0x0a, 0x08, 0x48, 0x65, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04,
313 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 258 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65,
314 - 0x22, 0x34, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03,  
315 - 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x16,  
316 - 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,  
317 - 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x22, 0x39, 0x0a, 0x0d, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52,  
318 - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 259 + 0x22, 0x38, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05,
  260 + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b,
  261 + 0x65, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01,
  262 + 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x22, 0x35, 0x0a, 0x09, 0x43, 0x72,
  263 + 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01,
319 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 264 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76,
320 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 265 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63,
321 - 0x65, 0x22, 0x35, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12, 0x10,  
322 - 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64,  
323 - 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,  
324 - 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x22, 0x9a, 0x01, 0x0a, 0x07, 0x52, 0x6f, 0x6c,  
325 - 0x65, 0x52, 0x73, 0x70, 0x12, 0x20, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01,  
326 - 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x52, 0x6f, 0x6c, 0x65,  
327 - 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x03,  
328 - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x48, 0x65,  
329 - 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x12, 0x20, 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d,  
330 - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e,  
331 - 0x54, 0x65, 0x61, 0x6d, 0x52, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x12, 0x29, 0x0a, 0x06, 0x65, 0x71,  
332 - 0x75, 0x69, 0x70, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64,  
333 - 0x65, 0x6c, 0x73, 0x2e, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x65,  
334 - 0x71, 0x75, 0x69, 0x70, 0x73, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x3b, 0x70,  
335 - 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 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,
336 } 278 }
337 279
338 var ( 280 var (
@@ -347,23 +289,22 @@ func file_game_proto_rawDescGZIP() []byte { @@ -347,23 +289,22 @@ func file_game_proto_rawDescGZIP() []byte {
347 return file_game_proto_rawDescData 289 return file_game_proto_rawDescData
348 } 290 }
349 291
350 -var file_game_proto_msgTypes = make([]protoimpl.MessageInfo, 5) 292 +var file_game_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
351 var file_game_proto_goTypes = []interface{}{ 293 var file_game_proto_goTypes = []interface{}{
352 - (*HeartReq)(nil), // 0: game.HeartReq  
353 - (*LoginReq)(nil), // 1: game.LoginReq  
354 - (*LoginResponse)(nil), // 2: game.LoginResponse  
355 - (*CreateReq)(nil), // 3: game.CreateReq  
356 - (*RoleRsp)(nil), // 4: game.RoleRsp  
357 - (*Role)(nil), // 5: models.Role  
358 - (*Hero)(nil), // 6: models.Hero  
359 - (*Team)(nil), // 7: models.Team  
360 - (*Equipment)(nil), // 8: models.Equipment 294 + (*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
361 } 302 }
362 var file_game_proto_depIdxs = []int32{ 303 var file_game_proto_depIdxs = []int32{
363 - 5, // 0: game.RoleRsp.role:type_name -> models.Role  
364 - 6, // 1: game.RoleRsp.hero:type_name -> models.Hero  
365 - 7, // 2: game.RoleRsp.team:type_name -> models.Team  
366 - 8, // 3: game.RoleRsp.equips:type_name -> models.Equipment 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
367 4, // [4:4] is the sub-list for method output_type 308 4, // [4:4] is the sub-list for method output_type
368 4, // [4:4] is the sub-list for method input_type 309 4, // [4:4] is the sub-list for method input_type
369 4, // [4:4] is the sub-list for extension type_name 310 4, // [4:4] is the sub-list for extension type_name
@@ -403,18 +344,6 @@ func file_game_proto_init() { @@ -403,18 +344,6 @@ func file_game_proto_init() {
403 } 344 }
404 } 345 }
405 file_game_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { 346 file_game_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
406 - switch v := v.(*LoginResponse); i {  
407 - case 0:  
408 - return &v.state  
409 - case 1:  
410 - return &v.sizeCache  
411 - case 2:  
412 - return &v.unknownFields  
413 - default:  
414 - return nil  
415 - }  
416 - }  
417 - file_game_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {  
418 switch v := v.(*CreateReq); i { 347 switch v := v.(*CreateReq); i {
419 case 0: 348 case 0:
420 return &v.state 349 return &v.state
@@ -426,7 +355,7 @@ func file_game_proto_init() { @@ -426,7 +355,7 @@ func file_game_proto_init() {
426 return nil 355 return nil
427 } 356 }
428 } 357 }
429 - file_game_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { 358 + file_game_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
430 switch v := v.(*RoleRsp); i { 359 switch v := v.(*RoleRsp); i {
431 case 0: 360 case 0:
432 return &v.state 361 return &v.state
@@ -445,7 +374,7 @@ func file_game_proto_init() { @@ -445,7 +374,7 @@ func file_game_proto_init() {
445 GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 374 GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
446 RawDescriptor: file_game_proto_rawDesc, 375 RawDescriptor: file_game_proto_rawDesc,
447 NumEnums: 0, 376 NumEnums: 0,
448 - NumMessages: 5, 377 + NumMessages: 4,
449 NumExtensions: 0, 378 NumExtensions: 0,
450 NumServices: 0, 379 NumServices: 0,
451 }, 380 },
1 -Subproject commit 7257f0e1d7cbce636e95993247107ca58fd5e374 1 +Subproject commit f725ea29c1806f14c15502406a83b4269193f76b