diff --git a/server/backtask/app/app.go b/server/backtask/app/app.go index 15a983f0..a4cdbb91 100644 --- a/server/backtask/app/app.go +++ b/server/backtask/app/app.go @@ -12,11 +12,11 @@ type app struct { } func (this *app) GetPkgName() string { - return "gameservice" + return "backtask" } func (this *app) GetHttpListenPort() int32 { - return mt.Table.GameServiceCluster.GetHttpListenPort() + return mt.Table.BackTaskCluster.GetHttpListenPort() } func (this *app) Run(initCb func(), unInitCb func()) { diff --git a/server/backtask/mt/BackTaskCluster.go b/server/backtask/mt/BackTaskCluster.go new file mode 100644 index 00000000..36ca5b14 --- /dev/null +++ b/server/backtask/mt/BackTaskCluster.go @@ -0,0 +1,34 @@ +package mt + +import ( + "f5" + "mtb" +) + +type BackTaskCluster struct { + mtb.BackTaskCluster +} + +type BackTaskClusterTable struct { + f5.IdMetaTable[BackTaskCluster] + selfConf *BackTaskCluster +} + +func (this *BackTaskCluster) Init1() { + +} + +func (this *BackTaskClusterTable) GetListenPort() int32 { + return this.selfConf.GetListenPort() +} + +func (this *BackTaskClusterTable) GetHttpListenPort() int32 { + return this.selfConf.GetHttpListenPort() +} + +func (this *BackTaskClusterTable) PostInit1() { + this.selfConf = this.GetById(int64(f5.GetApp().GetInstanceId())) + if this.selfConf == nil { + panic("backtask集群无法读取本服配置") + } +} diff --git a/server/backtask/mt/GameServiceCluster.go b/server/backtask/mt/GameServiceCluster.go deleted file mode 100644 index d7e3102d..00000000 --- a/server/backtask/mt/GameServiceCluster.go +++ /dev/null @@ -1,34 +0,0 @@ -package mt - -import ( - "f5" - "mtb" -) - -type GameServiceCluster struct { - mtb.GameServiceCluster -} - -type GameServiceClusterTable struct { - f5.IdMetaTable[GameServiceCluster] - selfConf *GameServiceCluster -} - -func (this *GameServiceCluster) Init1() { - -} - -func (this *GameServiceClusterTable) GetListenPort() int32 { - return this.selfConf.GetListenPort() -} - -func (this *GameServiceClusterTable) GetHttpListenPort() int32 { - return this.selfConf.GetHttpListenPort() -} - -func (this *GameServiceClusterTable) PostInit1() { - this.selfConf = this.GetById(int64(f5.GetApp().GetInstanceId())) - if this.selfConf == nil { - panic("gameservice集群无法读取本服配置") - } -} diff --git a/server/backtask/mt/export.go b/server/backtask/mt/export.go index d2fe5267..9450852c 100644 --- a/server/backtask/mt/export.go +++ b/server/backtask/mt/export.go @@ -5,7 +5,7 @@ import ( ) type table struct { - GameServiceCluster *GameServiceClusterTable + BackTaskCluster *BackTaskClusterTable GameDb *GameDbTable BcEventDb *BcEventDbTable BcNftDb *BcNftDbTable @@ -15,7 +15,7 @@ type table struct { } var Table = f5.New(func(this *table) { - this.GameServiceCluster = f5.New(func(this *GameServiceClusterTable) { + this.BackTaskCluster = f5.New(func(this *BackTaskClusterTable) { this.FileName = "../config/adminserver.cluster.json" this.PrimKey = "instance_id" }) diff --git a/server/backtask/mtb/mtb.auto_gen.go b/server/backtask/mtb/mtb.auto_gen.go index 341fa160..33fbec05 100644 --- a/server/backtask/mtb/mtb.auto_gen.go +++ b/server/backtask/mtb/mtb.auto_gen.go @@ -4,7 +4,7 @@ import ( "f5" ) -type GameServiceCluster struct { +type BackTaskCluster struct { instance_id int32 listen_port int32 http_listen_port int32 @@ -73,27 +73,27 @@ type HashRateCommon struct { _flags2_ uint64 } -func (this *GameServiceCluster) GetInstanceId() int32 { +func (this *BackTaskCluster) GetInstanceId() int32 { return this.instance_id } -func (this *GameServiceCluster) HasInstanceId() bool { +func (this *BackTaskCluster) HasInstanceId() bool { return (this._flags1_ & (uint64(1) << 1)) > 0 } -func (this *GameServiceCluster) GetListenPort() int32 { +func (this *BackTaskCluster) GetListenPort() int32 { return this.listen_port } -func (this *GameServiceCluster) HasListenPort() bool { +func (this *BackTaskCluster) HasListenPort() bool { return (this._flags1_ & (uint64(1) << 2)) > 0 } -func (this *GameServiceCluster) GetHttpListenPort() int32 { +func (this *BackTaskCluster) GetHttpListenPort() int32 { return this.http_listen_port } -func (this *GameServiceCluster) HasHttpListenPort() bool { +func (this *BackTaskCluster) HasHttpListenPort() bool { return (this._flags1_ & (uint64(1) << 3)) > 0 } @@ -290,7 +290,7 @@ func (this *HashRateCommon) HasCecPool() bool { } -func (this *GameServiceCluster) LoadFromKv(kv map[string]interface{}) { +func (this *BackTaskCluster) LoadFromKv(kv map[string]interface{}) { f5.ReadMetaTableField(&this.instance_id, "instance_id", &this._flags1_, 1, kv) f5.ReadMetaTableField(&this.listen_port, "listen_port", &this._flags1_, 2, kv) f5.ReadMetaTableField(&this.http_listen_port, "http_listen_port", &this._flags1_, 3, kv) diff --git a/server/backtask/proto/mt.proto b/server/backtask/proto/mt.proto index 6ac8936a..5015c195 100644 --- a/server/backtask/proto/mt.proto +++ b/server/backtask/proto/mt.proto @@ -2,7 +2,7 @@ package mt; option go_package = ".;mt"; -message GameServiceCluster +message BackTaskCluster { optional int32 instance_id = 1; optional int32 listen_port = 2;