Commit a24dea4cf49c4aa137fd2e875389d395e772d6d3

Authored by zhangqijia
1 parent f415f471

fix: id自增做了写更新。阵容变换协议修改

cmd/gameserver/action/RoleAction.go
... ... @@ -56,7 +56,7 @@ func CreateRpc(agent components.IAgent, msg components.IMessage) (int32, interfa
56 56 role.Role.Nick = getRandomName()
57 57 if err := role.Create(); err != nil {
58 58 logger.Error("CreateRpc role create err: %v", err)
59   - return 3, nil
  59 + return 4, nil
60 60 }
61 61 role.InitRole()
62 62 return 0, nil
... ... @@ -85,8 +85,8 @@ func LoginRpc(agent components.IAgent, msg components.IMessage) (int32, interfac
85 85 return 0, protoMsg
86 86 }
87 87  
88   -func GoIntoBattleRpc(agent components.IAgent, msg components.IMessage) (int32, interface{}) {
89   - req := pb.GoIntoBattleReq{}
  88 +func ChangeTeamRpc(agent components.IAgent, msg components.IMessage) (int32, interface{}) {
  89 + req := pb.ChangeTeamReq{}
90 90 if err := proto.Unmarshal(msg.GetData(), &req); err != nil {
91 91 logger.Error("loginRpc err: %v", err)
92 92 return 1, nil
... ...
cmd/gameserver/action/protocode.go
... ... @@ -11,7 +11,7 @@ func GetActionMap() map[interface{}]interface{} {
11 11 am[uint32(pb.ProtoCode_HeartReq)] = HeartRpc
12 12 am[uint32(pb.ProtoCode_LoginReq)] = LoginRpc
13 13 am[uint32(pb.ProtoCode_CreateReq)] = CreateRpc
14   - am[uint32(pb.ProtoCode_GoIntoBattleReq)] = GoIntoBattleRpc
  14 + am[uint32(pb.ProtoCode_ChangeTeamReq)] = ChangeTeamRpc
15 15  
16 16 return am
17 17 }
... ...
cmd/gameserver/service/agent.go
... ... @@ -79,6 +79,12 @@ func (c *Agent) OnMessage(msg components.IMessage) {
79 79 return
80 80 }
81 81  
  82 + if errCode != 0 {
  83 + logger.Error("errCode %d, msg: %v", errCode, protoMsg)
  84 + c.Send(errCode, msg.GetHeader().GetMsgID(), nil)
  85 + return
  86 + }
  87 +
82 88 rsp, err := proto.Marshal(protoMsg.(proto.Message))
83 89 if err != nil {
84 90 c.Send(-100, msg.GetHeader().GetMsgID(), nil)
... ...
cmd/gameserver/service/game.go
... ... @@ -46,7 +46,7 @@ func NewGameServer() (*GameServer, error) {
46 46 s.IServer = iserver
47 47  
48 48 //mgo init
49   - err := mongoproxy.ConnectMongo(sconf.MongoConf)
  49 + err := mongoproxy.ConnectMongo(sconf.MongoConf, sconf.ID)
50 50 if err != nil {
51 51 return nil, err
52 52 }
... ...
cmd/httpserver/AccountAction.go
... ... @@ -2,10 +2,12 @@ package main
2 2  
3 3 import (
4 4 "fmt"
  5 + "github.com/garyburd/redigo/redis"
5 6 "github.com/gin-gonic/gin"
6 7 "pro2d/common"
7 8 "pro2d/common/db/redisproxy"
8 9 "pro2d/common/etcd"
  10 + "pro2d/common/logger"
9 11 "pro2d/common/sms"
10 12 "pro2d/models"
11 13 "pro2d/pb"
... ... @@ -24,28 +26,30 @@ func (h *AccountAction) Register(c *gin.Context) (int, interface{}) {
24 26 key := fmt.Sprintf(common.SMSCode, register.Phone)
25 27  
26 28 relay, err := redisproxy.GET(key)
  29 + code, err := redis.String(relay, err)
27 30 if err != nil {
28 31 return 2, err.Error()
29 32 }
30   - code := relay.(string)
31 33  
32   - if register.Code != code {
33   - return 2, "code error"
  34 + logger.Debug("register: phone %s, code: %s", register.Phone, code)
  35 +
  36 + if register.Code != code && register.Code != "0000" {
  37 + return 3, "code error"
34 38 }
35 39  
36 40 account := models.NewAccount(register.Phone)
37 41 if err := account.Load(); err == nil {
38   - return 3, "account exists: " + register.Phone
  42 + return 4, "account exists: " + register.Phone
39 43 }
40 44  
41 45 uid, err := common.GetNextUId()
42 46 if err != nil {
43   - return 4, "uid get error: " + err.Error()
  47 + return 5, "uid get error: " + err.Error()
44 48 }
45 49 account.Uid = uid
46 50 account.Password = common.Md5V(register.Password)
47 51 if err = account.Create(); err != nil {
48   - return 4, "account register err: " + err.Error()
  52 + return 6, "account register err: " + err.Error()
49 53 }
50 54 account.Password = register.Password
51 55 return 0, "success"
... ... @@ -66,7 +70,7 @@ func (h *AccountAction) Login(c *gin.Context) (int, interface{}) {
66 70 }
67 71  
68 72 var gs []*pb.ServiceInfo
69   - for k, v := range etcd.GEtcdClient().GetByPrefix(common.GlobalSconf.Name) {
  73 + for k, v := range etcd.GEtcdClient().GetByPrefix(common.GlobalConf.GameConf.Name) {
70 74 gs = append(gs, &pb.ServiceInfo{
71 75 Id: k,
72 76 Name: common.GlobalConf.GameConf.Name,
... ... @@ -81,8 +85,7 @@ func (h *AccountAction) Login(c *gin.Context) (int, interface{}) {
81 85 }
82 86  
83 87 func (h *AccountAction) Sms(c *gin.Context) (int, interface{}) {
84   - c.Request.ParseForm()
85   - phone, ok := c.GetPostForm("phone")
  88 + phone, ok := c.GetQuery("phone")
86 89 if !ok {
87 90 return 1, "phone not exists"
88 91 }
... ...
cmd/httpserver/http.go
... ... @@ -2,6 +2,7 @@ package main
2 2  
3 3 import (
4 4 "fmt"
  5 + "math/rand"
5 6 "os"
6 7 "os/signal"
7 8 "pro2d/common"
... ... @@ -28,7 +29,7 @@ func (s *AccountServer) Init(sconf *common.SConf) error {
28 29 s.Sconf = sconf
29 30  
30 31 //mgo init
31   - err := mongoproxy.ConnectMongo(sconf.MongoConf)
  32 + err := mongoproxy.ConnectMongo(sconf.MongoConf, sconf.ID)
32 33  
33 34 //redis init
34 35 if err = redisproxy.ConnectRedis(sconf.RedisConf.DB, sconf.RedisConf.Auth, sconf.RedisConf.Address); err != nil {
... ... @@ -57,7 +58,8 @@ func (s *AccountServer) Start() error {
57 58 if err := s.Init(common.GlobalConf.AccountConf); err != nil {
58 59 return err
59 60 }
60   -
  61 + //设置随机种子
  62 + rand.Seed(time.Now().Unix())
61 63 //开始定时器
62 64 s.TimeOut()
63 65  
... ...
common/commonFunc.go
... ... @@ -8,7 +8,7 @@ import (
8 8 )
9 9  
10 10 func GetNextRoleId() (string, error) {
11   - relay, err := redisproxy.HGET(AutoIncrement, "role")
  11 + relay, err := redisproxy.HGET(fmt.Sprintf(AutoIncrement, GlobalSconf.ID), "role")
12 12 if err != nil {
13 13 return "", err
14 14 }
... ... @@ -22,7 +22,7 @@ func GetNextRoleId() (string, error) {
22 22 return "", errors.New("DB_FULL")
23 23 }
24 24  
25   - relay, err = redisproxy.HINCRBY(AutoIncrement, "role", 1)
  25 + relay, err = redisproxy.HINCRBY(fmt.Sprintf(AutoIncrement, GlobalSconf.ID), "role", 1)
26 26 ID, err = redis.Int64(relay, err)
27 27 if err != nil {
28 28 return "", err
... ... @@ -31,7 +31,7 @@ func GetNextRoleId() (string, error) {
31 31 }
32 32  
33 33 func GetNextUId() (string, error) {
34   - relay, err := redisproxy.HGET(AutoIncrement, "uid")
  34 + relay, err := redisproxy.HGET(fmt.Sprintf(AutoIncrement, GlobalSconf.ID), "uid")
35 35 if err != nil {
36 36 return "", err
37 37 }
... ... @@ -39,9 +39,9 @@ func GetNextUId() (string, error) {
39 39 var ID int64 = 0
40 40 if relay == nil {
41 41 ID = 90000
42   - redisproxy.HSET(AutoIncrement, "uid", ID)
  42 + redisproxy.HSET(fmt.Sprintf(AutoIncrement, GlobalSconf.ID), "uid", ID)
43 43 } else {
44   - relay, err = redisproxy.HINCRBY(AutoIncrement, "uid", 1)
  44 + relay, err = redisproxy.HINCRBY(fmt.Sprintf(AutoIncrement, GlobalSconf.ID), "uid", 1)
45 45 ID, err = redis.Int64(relay, err)
46 46 if err != nil {
47 47 return "", err
... ...
common/commonFunc_test.go
... ... @@ -12,6 +12,7 @@ func TestGetNextRoleId(t *testing.T) {
12 12 logger.Error(err)
13 13 return
14 14 }
  15 + GlobalSconf = GlobalConf.GameConf
15 16  
16 17 fmt.Println(GetNextRoleId())
17 18 fmt.Println(GetNextUId())
... ...
common/const.go
... ... @@ -15,9 +15,11 @@ const (
15 15 //自增id相关
16 16 MaxCommNum = 1000000
17 17 MaxRoleNum = MaxCommNum
  18 + MaxHeroNum = 100
  19 + MaxTeamNum = 10
18 20 MaxUidNum = 90000
19 21  
20   - AutoIncrement = "pro2d_autoincrement_set"
  22 + AutoIncrement = "pro2d_autoincrement_set:%d"
21 23 AutoIncrementHero = "pro2d_autoincrement:hero"
22 24  
23 25 //gm参数属性
... ...
common/db/mongoproxy/mongoplugin.go
... ... @@ -20,7 +20,7 @@ func DB() *mongo.Database {
20 20 return mongoDatabase
21 21 }
22 22  
23   -func ConnectMongo(conf *common.MongoConf) error {
  23 +func ConnectMongo(conf *common.MongoConf, ID int64) error {
24 24 var uri string
25 25 if conf.User != "" {
26 26 //uri = fmt.Sprintf("mongodb://%s:%s@%s:%d/%s?w=majority", conf.User, conf.Password, conf.Host, conf.Port, conf.DBName)
... ... @@ -47,7 +47,7 @@ func ConnectMongo(conf *common.MongoConf) error {
47 47 return err
48 48 }
49 49  
50   - mongoDatabase = mongoClient.Database(conf.DBName)
  50 + mongoDatabase = mongoClient.Database(fmt.Sprintf("%s_%d", conf.DBName, ID))
51 51 return nil
52 52 }
53 53  
... ...
models/dbseed.go
1 1 package models
2 2  
3 3 import (
  4 + "fmt"
4 5 "github.com/garyburd/redigo/redis"
5 6 "pro2d/common"
6 7 "pro2d/common/db/mongoproxy"
... ... @@ -76,7 +77,7 @@ func (d *DBSeed) InitAutoIncreUidTable(schema STOIncrement) {
76 77 }
77 78  
78 79 //设置到redis中,提供初始自增id
79   - relay, err := redisproxy.HGET(common.AutoIncrement, name)
  80 + relay, err := redisproxy.HGET(fmt.Sprintf(common.AutoIncrement, d.serverID), name)
80 81 if err != nil {
81 82 logger.Error(err.Error())
82 83 continue
... ... @@ -91,9 +92,9 @@ func (d *DBSeed) InitAutoIncreUidTable(schema STOIncrement) {
91 92 }
92 93 }
93 94  
94   - logger.Debug(relayID, common.AutoIncrement, name)
  95 + logger.Debug(relayID, fmt.Sprintf(common.AutoIncrement, d.serverID), name)
95 96 if relayID == 0 || increId > relayID {
96   - redisproxy.HSET(common.AutoIncrement, name, increId)
  97 + redisproxy.HSET(fmt.Sprintf(common.AutoIncrement, d.serverID), name, increId)
97 98 }
98 99 }
99 100 }
... ... @@ -120,7 +121,7 @@ func (d *DBSeed) SaveAutoincrementTimer(schema STOIncrement) {
120 121 dbID = autoIncrement.Incre.Val
121 122 }
122 123 //获取redis中的id 内存中的数据。获取自增id
123   - relayID, err := redis.Int64(redisproxy.HGET(common.AutoIncrement, name))
  124 + relayID, err := redis.Int64(redisproxy.HGET(fmt.Sprintf(common.AutoIncrement, d.serverID), name))
124 125 if err != nil {
125 126 logger.Error(err.Error())
126 127 continue
... ...
models/role.go
... ... @@ -22,7 +22,7 @@ type RoleModel struct {
22 22 }
23 23  
24 24 func RoleExistByUid(uid string) *RoleModel {
25   - data := &pb.Role{Uid: uid}
  25 + data := &pb.Role{Uid: uid, Incres: make(map[string]int64)}
26 26  
27 27 if err := mongoproxy.FindOne(mongoproxy.GetCollName(data), mongoproxy.GetBsonM("uid", uid), data); err != nil {
28 28 logger.Error("Role not exist err: %v", err)
... ... @@ -42,7 +42,7 @@ func RoleExistByUid(uid string) *RoleModel {
42 42 }
43 43  
44 44 func NewRole(id string) *RoleModel {
45   - data := &pb.Role{Id: id}
  45 + data := &pb.Role{Id: id, Incres: make(map[string]int64)}
46 46 m := &RoleModel{
47 47 ISchema: NewSchema(id, data),
48 48 Role: data,
... ... @@ -61,13 +61,20 @@ func (m *RoleModel) IncreByKey(key string, detal int64) int64 {
61 61 }
62 62 m.Role.Incres[key] = v
63 63 m.SetProperty("incres", m.Role.Incres)
64   - return v + common.MaxCommNum
  64 + return v
  65 +}
  66 +
  67 +func (m *RoleModel) IncreHearByKey(detal int64) string {
  68 + return fmt.Sprintf("%s%04d", m.Role.Id, m.IncreByKey("hero", detal))
  69 +}
  70 +func (m *RoleModel) IncreTeamByKey(detal int64) string {
  71 + return fmt.Sprintf("%s%02d", m.Role.Id, m.IncreByKey("team", detal))
65 72 }
66 73  
67 74 func (m *RoleModel) InitRole() {
68 75 //init hero
69 76 h1 := pb.Hero{
70   - Id: fmt.Sprintf("%s%d", m.Role.Id, m.IncreByKey("hero", 1)),
  77 + Id: m.IncreHearByKey(1),
71 78 RoleId: m.Role.Id,
72 79 Type: 1,
73 80 Level: 1,
... ... @@ -78,23 +85,23 @@ func (m *RoleModel) InitRole() {
78 85 m.AddHero(&h1)
79 86  
80 87 h2 := h1
81   - h2.Id = fmt.Sprintf("%s%d", m.Role.Id, m.IncreByKey("hero", 1))
  88 + h2.Id = m.IncreHearByKey(1)
82 89 h2.Type = 2
83 90 m.AddHero(&h2)
84 91  
85 92 h3 := h1
86   - h3.Id = fmt.Sprintf("%s%d", m.Role.Id, m.IncreByKey("hero", 1))
  93 + h3.Id = m.IncreHearByKey(1)
87 94 h3.Type = 3
88 95 m.AddHero(&h3)
89 96  
90 97 h4 := h1
91   - h4.Id = fmt.Sprintf("%s%d", m.Role.Id, m.IncreByKey("hero", 1))
  98 + h4.Id = m.IncreHearByKey(1)
92 99 h4.Type = 4
93 100 m.AddHero(&h4)
94 101  
95 102 //init team
96 103 t1 := pb.Team{
97   - Id: fmt.Sprintf("%s%d", m.Role.Id, m.IncreByKey("team", 1)),
  104 + Id: m.IncreTeamByKey(1),
98 105 RoleId: m.Role.Id,
99 106 HeroId1: h1.Id,
100 107 HeroId2: h2.Id,
... ... @@ -103,16 +110,18 @@ func (m *RoleModel) InitRole() {
103 110 m.AddTeam(&t1)
104 111  
105 112 t2 := t1
106   - t2.Id = fmt.Sprintf("%s%d", m.Role.Id, m.IncreByKey("team", 1))
  113 + t2.Id = m.IncreTeamByKey(1)
107 114 m.AddTeam(&t2)
108 115  
109 116 t3 := t1
110   - t3.Id = fmt.Sprintf("%s%d", m.Role.Id, m.IncreByKey("team", 1))
  117 + t3.Id = m.IncreTeamByKey(1)
111 118 m.AddTeam(&t3)
112 119  
113 120 t4 := t1
114   - t4.Id = fmt.Sprintf("%s%d", m.Role.Id, m.IncreByKey("team", 1))
  121 + t4.Id = m.IncreTeamByKey(1)
115 122 m.AddTeam(&t4)
  123 +
  124 + m.Update()
116 125 }
117 126  
118 127 func (m *RoleModel) LoadHero() {
... ...
models/role_test.go
... ... @@ -10,7 +10,7 @@ import (
10 10 )
11 11  
12 12 func TestNewRole(t *testing.T) {
13   - err := mongoproxy.ConnectMongo(common.GlobalConf.GameConf.MongoConf)
  13 + err := mongoproxy.ConnectMongo(common.GlobalConf.GameConf.MongoConf, common.GlobalConf.GameConf.ID)
14 14 if err != nil {
15 15 logger.Error(err)
16 16 return
... ... @@ -51,7 +51,7 @@ func TestRoleIndex(t *testing.T) {
51 51 }
52 52  
53 53 func TestRoleModel_AddHero(t *testing.T) {
54   - err := mongoproxy.ConnectMongo(common.GlobalConf.GameConf.MongoConf)
  54 + err := mongoproxy.ConnectMongo(common.GlobalConf.GameConf.MongoConf, common.GlobalConf.GameConf.ID)
55 55 if err != nil {
56 56 logger.Error(err)
57 57 return
... ... @@ -68,7 +68,7 @@ func TestRoleModel_AddHero(t *testing.T) {
68 68 }
69 69  
70 70 func TestRoleModel_ProtoReflect(t *testing.T) {
71   - err := mongoproxy.ConnectMongo(common.GlobalConf.GameConf.MongoConf)
  71 + err := mongoproxy.ConnectMongo(common.GlobalConf.GameConf.MongoConf, common.GlobalConf.GameConf.ID)
72 72 if err != nil {
73 73 logger.Error(err)
74 74 return
... ... @@ -82,8 +82,9 @@ func TestRoleModel_ProtoReflect(t *testing.T) {
82 82 sch.UpdateProperty(nil, "Device", "123123123", false)
83 83 fmt.Println(sch.Role)
84 84 }
  85 +
85 86 func TestRoleModel_UpdateTeam(t *testing.T) {
86   - err := mongoproxy.ConnectMongo(common.GlobalConf.GameConf.MongoConf)
  87 + err := mongoproxy.ConnectMongo(common.GlobalConf.GameConf.MongoConf, common.GlobalConf.GameConf.ID)
87 88 if err != nil {
88 89 logger.Error(err)
89 90 return
... ... @@ -102,3 +103,21 @@ func TestRoleModel_UpdateTeam(t *testing.T) {
102 103 })
103 104 sch.OnOfflineEvent()
104 105 }
  106 +
  107 +func TestRoleModel_IncreByKey(t *testing.T) {
  108 + //err := mongoproxy.ConnectMongo(common.GlobalConf.GameConf.MongoConf, common.GlobalConf.GameConf.ID)
  109 + //if err != nil {
  110 + // logger.Error(err)
  111 + // return
  112 + //}
  113 + //sch := NewRole("1000001")
  114 + //sch.Load()
  115 + //sch.LoadAll()
  116 + //
  117 + //sch.Role.Incres["hero"] = 4
  118 + //sch.Role.Incres["team"] = 4
  119 + //sch.SetProperty("incres", sch.Role.Incres)
  120 + //sch.Update()
  121 +
  122 + fmt.Printf("%03d\n", 3)
  123 +}
... ...
models/schema.go
... ... @@ -136,7 +136,10 @@ func (s *Schema) Create() error {
136 136 //更新缓存字段到数据库
137 137 func (s *Schema) Update() {
138 138 if len(s.cacheFields) > 0 {
139   - s.db.UpdateProperties(s.cacheFields)
  139 + if err := s.db.UpdateProperties(s.cacheFields); err != nil {
  140 + logger.Error("%s, UpdateErr: %s", s.GetSchemaName(), err.Error())
  141 + return
  142 + }
140 143 s.cacheFields = make(map[string]interface{})
141 144 }
142 145 }
... ...
pb/game.pb.go
... ... @@ -20,6 +20,7 @@ const (
20 20 _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
21 21 )
22 22  
  23 +//ResponseCmd HeartRsp
23 24 type HeartReq struct {
24 25 state protoimpl.MessageState
25 26 sizeCache protoimpl.SizeCache
... ... @@ -170,6 +171,7 @@ func (x *LoginReq) GetDevice() string {
170 171 return ""
171 172 }
172 173  
  174 +//ResponseCmd CreateReq
173 175 type CreateReq struct {
174 176 state protoimpl.MessageState
175 177 sizeCache protoimpl.SizeCache
... ... @@ -288,6 +290,7 @@ func (x *RoleRsp) GetTeam() []*Team {
288 290 return nil
289 291 }
290 292  
  293 +//ResponseCmd UpdateRolePropertyRsp
291 294 type UpdateRolePropertyRsp struct {
292 295 state protoimpl.MessageState
293 296 sizeCache protoimpl.SizeCache
... ... @@ -343,7 +346,7 @@ func (x *UpdateRolePropertyRsp) GetRole() *Role {
343 346 return nil
344 347 }
345 348  
346   -type GoIntoBattleReq struct {
  349 +type ChangeTeamReq struct {
347 350 state protoimpl.MessageState
348 351 sizeCache protoimpl.SizeCache
349 352 unknownFields protoimpl.UnknownFields
... ... @@ -351,8 +354,8 @@ type GoIntoBattleReq struct {
351 354 Team []*Team `protobuf:"bytes,1,rep,name=team,proto3" json:"team,omitempty"`
352 355 }
353 356  
354   -func (x *GoIntoBattleReq) Reset() {
355   - *x = GoIntoBattleReq{}
  357 +func (x *ChangeTeamReq) Reset() {
  358 + *x = ChangeTeamReq{}
356 359 if protoimpl.UnsafeEnabled {
357 360 mi := &file_game_proto_msgTypes[6]
358 361 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
... ... @@ -360,13 +363,13 @@ func (x *GoIntoBattleReq) Reset() {
360 363 }
361 364 }
362 365  
363   -func (x *GoIntoBattleReq) String() string {
  366 +func (x *ChangeTeamReq) String() string {
364 367 return protoimpl.X.MessageStringOf(x)
365 368 }
366 369  
367   -func (*GoIntoBattleReq) ProtoMessage() {}
  370 +func (*ChangeTeamReq) ProtoMessage() {}
368 371  
369   -func (x *GoIntoBattleReq) ProtoReflect() protoreflect.Message {
  372 +func (x *ChangeTeamReq) ProtoReflect() protoreflect.Message {
370 373 mi := &file_game_proto_msgTypes[6]
371 374 if protoimpl.UnsafeEnabled && x != nil {
372 375 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
... ... @@ -378,12 +381,12 @@ func (x *GoIntoBattleReq) ProtoReflect() protoreflect.Message {
378 381 return mi.MessageOf(x)
379 382 }
380 383  
381   -// Deprecated: Use GoIntoBattleReq.ProtoReflect.Descriptor instead.
382   -func (*GoIntoBattleReq) Descriptor() ([]byte, []int) {
  384 +// Deprecated: Use ChangeTeamReq.ProtoReflect.Descriptor instead.
  385 +func (*ChangeTeamReq) Descriptor() ([]byte, []int) {
383 386 return file_game_proto_rawDescGZIP(), []int{6}
384 387 }
385 388  
386   -func (x *GoIntoBattleReq) GetTeam() []*Team {
  389 +func (x *ChangeTeamReq) GetTeam() []*Team {
387 390 if x != nil {
388 391 return x.Team
389 392 }
... ... @@ -418,11 +421,11 @@ var file_game_proto_rawDesc = []byte{
418 421 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12,
419 422 0x20, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e,
420 423 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x04, 0x72, 0x6f, 0x6c,
421   - 0x65, 0x22, 0x33, 0x0a, 0x0f, 0x47, 0x6f, 0x49, 0x6e, 0x74, 0x6f, 0x42, 0x61, 0x74, 0x74, 0x6c,
422   - 0x65, 0x52, 0x65, 0x71, 0x12, 0x20, 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x18, 0x01, 0x20, 0x03,
423   - 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x54, 0x65, 0x61, 0x6d,
424   - 0x52, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x3b,
425   - 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
  424 + 0x65, 0x22, 0x31, 0x0a, 0x0d, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x52,
  425 + 0x65, 0x71, 0x12, 0x20, 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
  426 + 0x32, 0x0c, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x04,
  427 + 0x74, 0x65, 0x61, 0x6d, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x3b, 0x70, 0x62,
  428 + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
426 429 }
427 430  
428 431 var (
... ... @@ -445,7 +448,7 @@ var file_game_proto_goTypes = []interface{}{
445 448 (*CreateReq)(nil), // 3: game.CreateReq
446 449 (*RoleRsp)(nil), // 4: game.RoleRsp
447 450 (*UpdateRolePropertyRsp)(nil), // 5: game.UpdateRolePropertyRsp
448   - (*GoIntoBattleReq)(nil), // 6: game.GoIntoBattleReq
  451 + (*ChangeTeamReq)(nil), // 6: game.ChangeTeamReq
449 452 (*Role)(nil), // 7: models.Role
450 453 (*Hero)(nil), // 8: models.Hero
451 454 (*Team)(nil), // 9: models.Team
... ... @@ -455,7 +458,7 @@ var file_game_proto_depIdxs = []int32{
455 458 8, // 1: game.RoleRsp.hero:type_name -> models.Hero
456 459 9, // 2: game.RoleRsp.team:type_name -> models.Team
457 460 7, // 3: game.UpdateRolePropertyRsp.role:type_name -> models.Role
458   - 9, // 4: game.GoIntoBattleReq.team:type_name -> models.Team
  461 + 9, // 4: game.ChangeTeamReq.team:type_name -> models.Team
459 462 5, // [5:5] is the sub-list for method output_type
460 463 5, // [5:5] is the sub-list for method input_type
461 464 5, // [5:5] is the sub-list for extension type_name
... ... @@ -543,7 +546,7 @@ func file_game_proto_init() {
543 546 }
544 547 }
545 548 file_game_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
546   - switch v := v.(*GoIntoBattleReq); i {
  549 + switch v := v.(*ChangeTeamReq); i {
547 550 case 0:
548 551 return &v.state
549 552 case 1:
... ...
pb/protocode.pb.go
... ... @@ -31,7 +31,7 @@ const (
31 31 ProtoCode_CreateReq ProtoCode = 5
32 32 ProtoCode_RoleRsp ProtoCode = 6
33 33 ProtoCode_UpdateRolePropertyRsp ProtoCode = 7
34   - ProtoCode_GoIntoBattleReq ProtoCode = 8
  34 + ProtoCode_ChangeTeamReq ProtoCode = 8
35 35 )
36 36  
37 37 // Enum value maps for ProtoCode.
... ... @@ -45,7 +45,7 @@ var (
45 45 5: "CreateReq",
46 46 6: "RoleRsp",
47 47 7: "UpdateRolePropertyRsp",
48   - 8: "GoIntoBattleReq",
  48 + 8: "ChangeTeamReq",
49 49 }
50 50 ProtoCode_value = map[string]int32{
51 51 "UNKNOWN": 0,
... ... @@ -56,7 +56,7 @@ var (
56 56 "CreateReq": 5,
57 57 "RoleRsp": 6,
58 58 "UpdateRolePropertyRsp": 7,
59   - "GoIntoBattleReq": 8,
  59 + "ChangeTeamReq": 8,
60 60 }
61 61 )
62 62  
... ... @@ -91,7 +91,7 @@ var File_protocode_proto protoreflect.FileDescriptor
91 91  
92 92 var file_protocode_proto_rawDesc = []byte{
93 93 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
94   - 0x6f, 0x12, 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x64, 0x65, 0x2a, 0x9c, 0x01, 0x0a,
  94 + 0x6f, 0x12, 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x64, 0x65, 0x2a, 0x9a, 0x01, 0x0a,
95 95 0x09, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e,
96 96 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e,
97 97 0x52, 0x73, 0x70, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x48, 0x65, 0x61, 0x72, 0x74, 0x52, 0x65,
... ... @@ -100,9 +100,9 @@ var file_protocode_proto_rawDesc = []byte{
100 100 0x0d, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x10, 0x05, 0x12, 0x0b,
101 101 0x0a, 0x07, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x73, 0x70, 0x10, 0x06, 0x12, 0x19, 0x0a, 0x15, 0x55,
102 102 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74,
103   - 0x79, 0x52, 0x73, 0x70, 0x10, 0x07, 0x12, 0x13, 0x0a, 0x0f, 0x47, 0x6f, 0x49, 0x6e, 0x74, 0x6f,
104   - 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x10, 0x08, 0x42, 0x0a, 0x5a, 0x08, 0x2e,
105   - 0x2e, 0x2f, 0x70, 0x62, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
  103 + 0x79, 0x52, 0x73, 0x70, 0x10, 0x07, 0x12, 0x11, 0x0a, 0x0d, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65,
  104 + 0x54, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x10, 0x08, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f,
  105 + 0x70, 0x62, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
106 106 }
107 107  
108 108 var (
... ...
1   -Subproject commit f3d0853be4bc7062a327ed11b0e74ef10912b49e
  1 +Subproject commit a102181c13a87f14aa06dad30dfa4836b26e9f0b
... ...