From 083cf00b02373195772c9ee69528125fb9f211d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B7=E5=8B=87?= Date: Wed, 8 Nov 2023 10:48:10 +0800 Subject: [PATCH] save --- database/accountdb.sql | 29 ++++ database/admindb.sql | 31 ---- .../adminserver/api/v1/system/announcement.go | 10 +- server/adminserver/api/v1/system/audit.go | 14 +- .../api/v1/system/battle_server.go | 8 +- server/adminserver/app/app.go | 8 + server/adminserver/constant/constant.go | 7 +- server/adminserver/cs/cs.auto_gen.go | 42 +++++ server/adminserver/mt/AccountDb.go | 15 ++ server/adminserver/mt/export.go | 30 ++-- server/adminserver/mtb/mtb.auto_gen.go | 157 +++++++++++++----- server/adminserver/proto/cs_msgid.proto | 3 + server/adminserver/proto/cs_proto.proto | 3 + server/adminserver/proto/mt.proto | 9 + server/adminserver/proto/ss_msgid.proto | 3 + server/adminserver/proto/ss_proto.proto | 4 + server/adminserver/ss/ss.auto_gen.go | 42 +++++ 17 files changed, 314 insertions(+), 101 deletions(-) create mode 100644 database/accountdb.sql create mode 100644 server/adminserver/cs/cs.auto_gen.go create mode 100644 server/adminserver/mt/AccountDb.go create mode 100644 server/adminserver/proto/cs_msgid.proto create mode 100644 server/adminserver/proto/cs_proto.proto create mode 100644 server/adminserver/proto/ss_msgid.proto create mode 100644 server/adminserver/proto/ss_proto.proto create mode 100644 server/adminserver/ss/ss.auto_gen.go diff --git a/database/accountdb.sql b/database/accountdb.sql new file mode 100644 index 00000000..2d80fe65 --- /dev/null +++ b/database/accountdb.sql @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS `t_announcement`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_announcement` ( +`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', +`title` varchar(255) NOT NULL DEFAULT '' COMMENT '标题', +`version` varchar(32) NOT NULL DEFAULT '' COMMENT '版本', +`model` int(11) NOT NULL DEFAULT '0' COMMENT '型号 1:Android 2:ios', +`type` int(11) NOT NULL DEFAULT '0' COMMENT ' 1:停服公告 2:普通公告', +`is_effect` int(11) NOT NULL DEFAULT '0' COMMENT '是否生效', +`content` text DEFAULT '' COMMENT '内容', +PRIMARY KEY (`idx`), +UNIQUE KEY `model_type` (`model`,`type`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; + + +DROP TABLE IF EXISTS `t_audit`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t_audit` ( +`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', +`version` varchar(32) NOT NULL DEFAULT '' COMMENT '版本', +`model` int(11) NOT NULL DEFAULT '0' COMMENT '型号 1:Android 2:ios', +`is_auditing` int(11) NOT NULL DEFAULT '0' COMMENT '是否审核中', +PRIMARY KEY (`idx`), +UNIQUE KEY `model` (`model`) +) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +/*!40101 SET character_set_client = @saved_cs_client */; \ No newline at end of file diff --git a/database/admindb.sql b/database/admindb.sql index fe303ded..3e2575c5 100644 --- a/database/admindb.sql +++ b/database/admindb.sql @@ -22,34 +22,3 @@ PRIMARY KEY (`idx`), UNIQUE KEY `username` (`username`) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; /*!40101 SET character_set_client = @saved_cs_client */; - - -DROP TABLE IF EXISTS `t_announcement`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_announcement` ( -`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', -`title` varchar(255) NOT NULL DEFAULT '' COMMENT '标题', -`version` varchar(32) NOT NULL DEFAULT '' COMMENT '版本', -`model` int(11) NOT NULL DEFAULT '0' COMMENT '型号 1:Android 2:ios', -`type` int(11) NOT NULL DEFAULT '0' COMMENT ' 1:停服公告 2:普通公告', -`is_effect` int(11) NOT NULL DEFAULT '0' COMMENT '是否生效', -`content` text DEFAULT '' COMMENT '内容', -PRIMARY KEY (`idx`), -UNIQUE KEY `model_type` (`model`,`type`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; - - -DROP TABLE IF EXISTS `t_audit`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t_audit` ( -`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id', -`version` varchar(32) NOT NULL DEFAULT '' COMMENT '版本', -`model` int(11) NOT NULL DEFAULT '0' COMMENT '型号 1:Android 2:ios', -`is_auditing` int(11) NOT NULL DEFAULT '0' COMMENT '是否审核中', -PRIMARY KEY (`idx`), -UNIQUE KEY `model` (`model`) -) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -/*!40101 SET character_set_client = @saved_cs_client */; \ No newline at end of file diff --git a/server/adminserver/api/v1/system/announcement.go b/server/adminserver/api/v1/system/announcement.go index 4f3c7602..c4d90870 100644 --- a/server/adminserver/api/v1/system/announcement.go +++ b/server/adminserver/api/v1/system/announcement.go @@ -14,7 +14,7 @@ type AnncApi struct { func (this *AnncApi) AnncList(c *gin.Context) { var anncList []system.Annc - err := f5.GetApp().GetOrmDb(constant.ADMIN_DB).Find(&anncList).Error + err := f5.GetApp().GetOrmDb(constant.ACCOUNT_DB).Find(&anncList).Error if err != nil { c.JSON(http.StatusOK, gin.H{ "code": 1, @@ -39,7 +39,7 @@ func (this *AnncApi) AddAnnc(c *gin.Context) { return } var count int64 - f5.GetApp().GetOrmDb(constant.ADMIN_DB).Table("t_announcement").Where("model = ?", annc.Model).Where("type = ?", annc.Type).Count(&count) + f5.GetApp().GetOrmDb(constant.ACCOUNT_DB).Table("t_announcement").Where("model = ?", annc.Model).Where("type = ?", annc.Type).Count(&count) if count > 0 { c.JSON(http.StatusOK, gin.H{ "code": 1, @@ -48,7 +48,7 @@ func (this *AnncApi) AddAnnc(c *gin.Context) { return } - err := f5.GetApp().GetOrmDb(constant.ADMIN_DB).Create(&annc).Error + err := f5.GetApp().GetOrmDb(constant.ACCOUNT_DB).Create(&annc).Error if err != nil { c.JSON(http.StatusOK, gin.H{ "code": 1, @@ -65,7 +65,7 @@ func (this *AnncApi) AddAnnc(c *gin.Context) { func (this *AnncApi) UpdateAnnc(c *gin.Context) { idx, _ := strconv.ParseUint(c.Param("idx"), 10, 64) var count int64 - f5.GetApp().GetOrmDb(constant.ADMIN_DB).Table("t_announcement").Where("idx = ?", idx).Count(&count) + f5.GetApp().GetOrmDb(constant.ACCOUNT_DB).Table("t_announcement").Where("idx = ?", idx).Count(&count) if count < 1 { c.JSON(http.StatusOK, gin.H{ "code": 1, @@ -81,7 +81,7 @@ func (this *AnncApi) UpdateAnnc(c *gin.Context) { }) return } - err := f5.GetApp().GetOrmDb(constant.ADMIN_DB).Select("*").Omit("idx").Where("idx = ?", idx).Updates(&annc).Error + err := f5.GetApp().GetOrmDb(constant.ACCOUNT_DB).Select("*").Omit("idx").Where("idx = ?", idx).Updates(&annc).Error if err != nil { c.JSON(http.StatusOK, gin.H{ "code": 1, diff --git a/server/adminserver/api/v1/system/audit.go b/server/adminserver/api/v1/system/audit.go index 413a861e..644ade45 100644 --- a/server/adminserver/api/v1/system/audit.go +++ b/server/adminserver/api/v1/system/audit.go @@ -1,10 +1,10 @@ package system import ( - "adminsever/constant" - "adminsever/model/system" "f5" "github.com/gin-gonic/gin" + "main/constant" + "main/model/system" "net/http" "strconv" ) @@ -14,7 +14,7 @@ type AuditApi struct { func (this *AuditApi) AuditList(c *gin.Context) { var auditList []system.Audit - err := f5.GetApp().GetOrmDb(constant.ADMIN_DB).Find(&auditList).Error + err := f5.GetApp().GetOrmDb(constant.ACCOUNT_DB).Find(&auditList).Error if err != nil { c.JSON(http.StatusOK, gin.H{ "code": 1, @@ -39,7 +39,7 @@ func (this *AuditApi) AddAudit(c *gin.Context) { return } var count int64 - f5.GetApp().GetOrmDb(constant.ADMIN_DB).Table("t_audit").Where("model = ?", audit.Model).Count(&count) + f5.GetApp().GetOrmDb(constant.ACCOUNT_DB).Table("t_audit").Where("model = ?", audit.Model).Count(&count) if count > 0 { c.JSON(http.StatusOK, gin.H{ "code": 1, @@ -48,7 +48,7 @@ func (this *AuditApi) AddAudit(c *gin.Context) { return } - err := f5.GetApp().GetOrmDb(constant.ADMIN_DB).Create(&audit).Error + err := f5.GetApp().GetOrmDb(constant.ACCOUNT_DB).Create(&audit).Error if err != nil { c.JSON(http.StatusOK, gin.H{ "code": 1, @@ -65,7 +65,7 @@ func (this *AuditApi) AddAudit(c *gin.Context) { func (this *AuditApi) UpdateAudit(c *gin.Context) { idx, _ := strconv.ParseUint(c.Param("idx"), 10, 64) var count int64 - f5.GetApp().GetOrmDb(constant.ADMIN_DB).Table("t_audit").Where("idx = ?", idx).Count(&count) + f5.GetApp().GetOrmDb(constant.ACCOUNT_DB).Table("t_audit").Where("idx = ?", idx).Count(&count) if count < 1 { c.JSON(http.StatusOK, gin.H{ "code": 1, @@ -81,7 +81,7 @@ func (this *AuditApi) UpdateAudit(c *gin.Context) { }) return } - err := f5.GetApp().GetOrmDb(constant.ADMIN_DB).Select("*").Omit("idx").Where("idx = ?", idx).Updates(&audit).Error + err := f5.GetApp().GetOrmDb(constant.ACCOUNT_DB).Select("*").Omit("idx").Where("idx = ?", idx).Updates(&audit).Error if err != nil { c.JSON(http.StatusOK, gin.H{ "code": 1, diff --git a/server/adminserver/api/v1/system/battle_server.go b/server/adminserver/api/v1/system/battle_server.go index eeba2459..c4f94c55 100644 --- a/server/adminserver/api/v1/system/battle_server.go +++ b/server/adminserver/api/v1/system/battle_server.go @@ -20,7 +20,7 @@ func (s *BattleServerApi) Add(c *gin.Context) { return } - err := f5.GetApp().GetOrmDb(constant.ADMIN_DB).Create(&server).Error + err := f5.GetApp().GetOrmDb(constant.ACCOUNT_DB).Create(&server).Error if err != nil { c.JSON(http.StatusOK, gin.H{ "code": 1, @@ -39,7 +39,7 @@ func (s *BattleServerApi) Add(c *gin.Context) { func (s *BattleServerApi) List(c *gin.Context) { var battleServers []system.BattleServer - err := f5.GetApp().GetOrmDb(constant.ADMIN_DB).Find(&battleServers).Error + err := f5.GetApp().GetOrmDb(constant.ACCOUNT_DB).Find(&battleServers).Error if err != nil { c.JSON(http.StatusOK, gin.H{ "code": 1, @@ -64,7 +64,7 @@ func (s *BattleServerApi) Update(c *gin.Context) { return } var count int64 - f5.GetApp().GetOrmDb(constant.ADMIN_DB).Table(entity.TableName()).Where("idx = ?", entity.Idx).Count(&count) + f5.GetApp().GetOrmDb(constant.ACCOUNT_DB).Table(entity.TableName()).Where("idx = ?", entity.Idx).Count(&count) if count < 1 { c.JSON(http.StatusOK, gin.H{ "code": 1, @@ -73,7 +73,7 @@ func (s *BattleServerApi) Update(c *gin.Context) { return } - err := f5.GetApp().GetOrmDb(constant.ADMIN_DB).Select("*").Omit("idx").Where("idx = ?", entity.Idx).Updates(&entity).Error + err := f5.GetApp().GetOrmDb(constant.ACCOUNT_DB).Select("*").Omit("idx").Where("idx = ?", entity.Idx).Updates(&entity).Error if err != nil { c.JSON(http.StatusOK, gin.H{ "code": 1, diff --git a/server/adminserver/app/app.go b/server/adminserver/app/app.go index d45b4b52..950f49cf 100644 --- a/server/adminserver/app/app.go +++ b/server/adminserver/app/app.go @@ -75,6 +75,14 @@ func (this *app) registerDataSources() { mt.Table.FriendDb.GetById(0).GetPasswd(), "admindb_dev", ) + f5.GetApp().RegisterOrmDb( + constant.ACCOUNT_DB, + mt.Table.AccountDb.GetById(0).GetHost(), + mt.Table.AccountDb.GetById(0).GetPort(), + mt.Table.AccountDb.GetById(0).GetUser(), + mt.Table.AccountDb.GetById(0).GetPasswd(), + mt.Table.AccountDb.GetById(0).GetDatabase(), + ) u := system.SysUser{} f5.GetApp().GetOrmDb(constant.ADMIN_DB).First(&u) diff --git a/server/adminserver/constant/constant.go b/server/adminserver/constant/constant.go index 5664a080..978e51a7 100644 --- a/server/adminserver/constant/constant.go +++ b/server/adminserver/constant/constant.go @@ -5,9 +5,10 @@ const ( ) const ( - GAME_DB = "gamedb" - FRIEND_DB = "firenddb" - ADMIN_DB = "admindb" + GAME_DB = "gamedb" + FRIEND_DB = "firenddb" + ADMIN_DB = "admindb" + ACCOUNT_DB = "accountdb" ) const ( diff --git a/server/adminserver/cs/cs.auto_gen.go b/server/adminserver/cs/cs.auto_gen.go new file mode 100644 index 00000000..6050da55 --- /dev/null +++ b/server/adminserver/cs/cs.auto_gen.go @@ -0,0 +1,42 @@ +package cs + +import ( + "f5" + proto "github.com/golang/protobuf/proto" +) + +type CsNetMsgHandler f5.NetMsgHandler[MsgHandler]; + +type MsgHandlerImpl struct { +} + +var handlers [2000]*CsNetMsgHandler + +func GetNetMsgHandler(msgId uint16) *CsNetMsgHandler { + handler := handlers[msgId] + return handler +} + +func DispatchMsg(handler *CsNetMsgHandler, hdr *f5.MsgHdr, msgHandler MsgHandler) { + handler.Cb(hdr, msgHandler) +} + +func RegHandlerId(msgId int, handlerId int) { + handler := handlers[msgId] + handler.HandlerId = handlerId +} + +func ParsePb(msgId uint16, data []byte) interface{} { + handler := handlers[msgId] + if handler == nil { + return nil + } + return handler.ParseCb(data) +} + +type MsgHandler interface { +} + +func init() { + +} \ No newline at end of file diff --git a/server/adminserver/mt/AccountDb.go b/server/adminserver/mt/AccountDb.go new file mode 100644 index 00000000..65cca2e1 --- /dev/null +++ b/server/adminserver/mt/AccountDb.go @@ -0,0 +1,15 @@ +package mt + +import ( + "f5" + "mtb" +) + +type AccountDb struct { + mtb.AccountDb +} + +type AccountDbTable struct { + f5.IdMetaTable[AccountDb] + selfConf *AccountDb +} diff --git a/server/adminserver/mt/export.go b/server/adminserver/mt/export.go index 778e2b83..1f014eb2 100644 --- a/server/adminserver/mt/export.go +++ b/server/adminserver/mt/export.go @@ -6,29 +6,35 @@ import ( type table struct { AdminCluster *AdminClusterTable - GameDb *GameDbTable - FriendDb *FriendDbTable - Config *ConfigTable + GameDb *GameDbTable + FriendDb *FriendDbTable + AccountDb *AccountDbTable + Config *ConfigTable } -var Table = f5.New(func (this* table) { - this.AdminCluster = f5.New(func (this *AdminClusterTable) { +var Table = f5.New(func(this *table) { + this.AdminCluster = f5.New(func(this *AdminClusterTable) { this.FileName = "../config/adminserver.cluster.json" this.PrimKey = "instance_id" - }); + }) - this.GameDb = f5.New(func (this *GameDbTable) { + this.GameDb = f5.New(func(this *GameDbTable) { this.FileName = "../config/gamedb.mysql.json" this.PrimKey = "" - }); + }) - this.FriendDb = f5.New(func (this *FriendDbTable) { + this.FriendDb = f5.New(func(this *FriendDbTable) { this.FileName = "../config/frienddb.mysql.json" this.PrimKey = "" - }); + }) - this.Config = f5.New(func (this *ConfigTable) { + this.AccountDb = f5.New(func(this *AccountDbTable) { + this.FileName = "../config/accountdb.mysql.json" + this.PrimKey = "" + }) + + this.Config = f5.New(func(this *ConfigTable) { this.FileName = "../config/config.json" this.PrimKey = "" - }); + }) }) diff --git a/server/adminserver/mtb/mtb.auto_gen.go b/server/adminserver/mtb/mtb.auto_gen.go index 7b90731c..947a1eb4 100644 --- a/server/adminserver/mtb/mtb.auto_gen.go +++ b/server/adminserver/mtb/mtb.auto_gen.go @@ -13,15 +13,6 @@ type AdminCluster struct { _flags2_ uint64 } -type MasterCluster struct { - instance_id int32 - ip string - listen_port int32 - - _flags1_ uint64 - _flags2_ uint64 -} - type GameDb struct { host string port int32 @@ -44,6 +35,28 @@ type FriendDb struct { _flags2_ uint64 } +type AdminDb struct { + host string + port int32 + user string + passwd string + database string + + _flags1_ uint64 + _flags2_ uint64 +} + +type AccountDb struct { + host string + port int32 + user string + passwd string + database string + + _flags1_ uint64 + _flags2_ uint64 +} + type Config struct { gameapi_url string @@ -75,30 +88,6 @@ func (this *AdminCluster) HasHttpListenPort() bool { return (this._flags1_ & (uint64(1) << 3)) > 0 } -func (this *MasterCluster) GetInstanceId() int32 { - return this.instance_id -} - -func (this *MasterCluster) HasInstanceId() bool { - return (this._flags1_ & (uint64(1) << 1)) > 0 -} - -func (this *MasterCluster) GetIp() string { - return this.ip -} - -func (this *MasterCluster) HasIp() bool { - return (this._flags1_ & (uint64(1) << 2)) > 0 -} - -func (this *MasterCluster) GetListenPort() int32 { - return this.listen_port -} - -func (this *MasterCluster) HasListenPort() bool { - return (this._flags1_ & (uint64(1) << 3)) > 0 -} - func (this *GameDb) GetHost() string { return this.host } @@ -179,6 +168,86 @@ func (this *FriendDb) HasDatabase() bool { return (this._flags1_ & (uint64(1) << 5)) > 0 } +func (this *AdminDb) GetHost() string { + return this.host +} + +func (this *AdminDb) HasHost() bool { + return (this._flags1_ & (uint64(1) << 1)) > 0 +} + +func (this *AdminDb) GetPort() int32 { + return this.port +} + +func (this *AdminDb) HasPort() bool { + return (this._flags1_ & (uint64(1) << 2)) > 0 +} + +func (this *AdminDb) GetUser() string { + return this.user +} + +func (this *AdminDb) HasUser() bool { + return (this._flags1_ & (uint64(1) << 3)) > 0 +} + +func (this *AdminDb) GetPasswd() string { + return this.passwd +} + +func (this *AdminDb) HasPasswd() bool { + return (this._flags1_ & (uint64(1) << 4)) > 0 +} + +func (this *AdminDb) GetDatabase() string { + return this.database +} + +func (this *AdminDb) HasDatabase() bool { + return (this._flags1_ & (uint64(1) << 5)) > 0 +} + +func (this *AccountDb) GetHost() string { + return this.host +} + +func (this *AccountDb) HasHost() bool { + return (this._flags1_ & (uint64(1) << 1)) > 0 +} + +func (this *AccountDb) GetPort() int32 { + return this.port +} + +func (this *AccountDb) HasPort() bool { + return (this._flags1_ & (uint64(1) << 2)) > 0 +} + +func (this *AccountDb) GetUser() string { + return this.user +} + +func (this *AccountDb) HasUser() bool { + return (this._flags1_ & (uint64(1) << 3)) > 0 +} + +func (this *AccountDb) GetPasswd() string { + return this.passwd +} + +func (this *AccountDb) HasPasswd() bool { + return (this._flags1_ & (uint64(1) << 4)) > 0 +} + +func (this *AccountDb) GetDatabase() string { + return this.database +} + +func (this *AccountDb) HasDatabase() bool { + return (this._flags1_ & (uint64(1) << 5)) > 0 +} + func (this *Config) GetGameapiUrl() string { return this.gameapi_url } @@ -194,12 +263,6 @@ func (this *AdminCluster) LoadFromKv(kv map[string]interface{}) { f5.ReadMetaTableField(&this.http_listen_port, "http_listen_port", &this._flags1_, 3, kv) } -func (this *MasterCluster) LoadFromKv(kv map[string]interface{}) { - f5.ReadMetaTableField(&this.instance_id, "instance_id", &this._flags1_, 1, kv) - f5.ReadMetaTableField(&this.ip, "ip", &this._flags1_, 2, kv) - f5.ReadMetaTableField(&this.listen_port, "listen_port", &this._flags1_, 3, kv) -} - func (this *GameDb) LoadFromKv(kv map[string]interface{}) { f5.ReadMetaTableField(&this.host, "host", &this._flags1_, 1, kv) f5.ReadMetaTableField(&this.port, "port", &this._flags1_, 2, kv) @@ -216,6 +279,22 @@ func (this *FriendDb) LoadFromKv(kv map[string]interface{}) { f5.ReadMetaTableField(&this.database, "database", &this._flags1_, 5, kv) } +func (this *AdminDb) LoadFromKv(kv map[string]interface{}) { + f5.ReadMetaTableField(&this.host, "host", &this._flags1_, 1, kv) + f5.ReadMetaTableField(&this.port, "port", &this._flags1_, 2, kv) + f5.ReadMetaTableField(&this.user, "user", &this._flags1_, 3, kv) + f5.ReadMetaTableField(&this.passwd, "passwd", &this._flags1_, 4, kv) + f5.ReadMetaTableField(&this.database, "database", &this._flags1_, 5, kv) +} + +func (this *AccountDb) LoadFromKv(kv map[string]interface{}) { + f5.ReadMetaTableField(&this.host, "host", &this._flags1_, 1, kv) + f5.ReadMetaTableField(&this.port, "port", &this._flags1_, 2, kv) + f5.ReadMetaTableField(&this.user, "user", &this._flags1_, 3, kv) + f5.ReadMetaTableField(&this.passwd, "passwd", &this._flags1_, 4, kv) + f5.ReadMetaTableField(&this.database, "database", &this._flags1_, 5, kv) +} + func (this *Config) LoadFromKv(kv map[string]interface{}) { f5.ReadMetaTableField(&this.gameapi_url, "gameapi_url", &this._flags1_, 1, kv) } diff --git a/server/adminserver/proto/cs_msgid.proto b/server/adminserver/proto/cs_msgid.proto new file mode 100644 index 00000000..2b5590b3 --- /dev/null +++ b/server/adminserver/proto/cs_msgid.proto @@ -0,0 +1,3 @@ +syntax = "proto2"; +package cs; +option go_package = ".;cs"; diff --git a/server/adminserver/proto/cs_proto.proto b/server/adminserver/proto/cs_proto.proto new file mode 100644 index 00000000..89f88b3a --- /dev/null +++ b/server/adminserver/proto/cs_proto.proto @@ -0,0 +1,3 @@ +syntax = "proto2"; +package cs; +option go_package = ".;cs"; \ No newline at end of file diff --git a/server/adminserver/proto/mt.proto b/server/adminserver/proto/mt.proto index 359ca1fa..d82ee13a 100644 --- a/server/adminserver/proto/mt.proto +++ b/server/adminserver/proto/mt.proto @@ -36,6 +36,15 @@ message AdminDb optional string database = 5; } +message AccountDb +{ + optional string host = 1; + optional int32 port = 2; + optional string user = 3; + optional string passwd = 4; + optional string database = 5; +} + message Config { optional string gameapi_url = 1; diff --git a/server/adminserver/proto/ss_msgid.proto b/server/adminserver/proto/ss_msgid.proto new file mode 100644 index 00000000..992bade5 --- /dev/null +++ b/server/adminserver/proto/ss_msgid.proto @@ -0,0 +1,3 @@ +syntax = "proto2"; +package ss; +option go_package = ".;ss"; \ No newline at end of file diff --git a/server/adminserver/proto/ss_proto.proto b/server/adminserver/proto/ss_proto.proto new file mode 100644 index 00000000..a50b6c9e --- /dev/null +++ b/server/adminserver/proto/ss_proto.proto @@ -0,0 +1,4 @@ +syntax = "proto2"; +package ss; +option go_package = ".;ss"; + diff --git a/server/adminserver/ss/ss.auto_gen.go b/server/adminserver/ss/ss.auto_gen.go new file mode 100644 index 00000000..20376aee --- /dev/null +++ b/server/adminserver/ss/ss.auto_gen.go @@ -0,0 +1,42 @@ +package ss + +import ( + "f5" + proto "github.com/golang/protobuf/proto" +) + +type SsNetMsgHandler f5.NetMsgHandler[MsgHandler]; + +type MsgHandlerImpl struct { +} + +var handlers [2000]*SsNetMsgHandler + +func GetNetMsgHandler(msgId uint16) *SsNetMsgHandler { + handler := handlers[msgId] + return handler +} + +func DispatchMsg(handler *SsNetMsgHandler, hdr *f5.MsgHdr, msgHandler MsgHandler) { + handler.Cb(hdr, msgHandler) +} + +func RegHandlerId(msgId int, handlerId int) { + handler := handlers[msgId] + handler.HandlerId = handlerId +} + +func ParsePb(msgId uint16, data []byte) interface{} { + handler := handlers[msgId] + if handler == nil { + return nil + } + return handler.ParseCb(data) +} + +type MsgHandler interface { +} + +func init() { + +} \ No newline at end of file