This commit is contained in:
aozhiwei 2024-10-30 14:23:52 +08:00
parent 8641e8b26c
commit 03f5d21a3f
10 changed files with 79 additions and 214 deletions

View File

@ -15,7 +15,7 @@ func (this *app) GetPkgName() string {
} }
func (this *app) GetHttpListenPort() int32 { func (this *app) GetHttpListenPort() int32 {
return mt.Table.NftServerCluster.GetHttpListenPort() return mt.Table.WheelServerCluster.GetHttpListenPort()
} }
func (this *app) Run(initCb func(), unInitCb func()) { func (this *app) Run(initCb func(), unInitCb func()) {

View File

@ -14,10 +14,6 @@ type ConfigTable struct {
selfConf *Config selfConf *Config
} }
func (this *ConfigTable) GetGameApiUrl() string {
return this.selfConf.GetGameapiUrl()
}
func (this *ConfigTable) PostInit1() { func (this *ConfigTable) PostInit1() {
this.selfConf = this.GetById(int64(0)) this.selfConf = this.GetById(int64(0))
if this.selfConf == nil { if this.selfConf == nil {

View File

@ -1,17 +0,0 @@
package mt
import (
"f5"
"main/mtb"
)
type NftDb struct {
mtb.NftDb
}
type NftDbTable struct {
f5.IdMetaTable[NftDb]
}
func (this *NftDb) Init1() {
}

View File

@ -1,35 +0,0 @@
package mt
import (
"f5"
"main/mtb"
)
type NftHomeMeta struct {
mtb.NftHomeMeta
}
type NftHomeMetaTable struct {
f5.NameMetaTable[NftHomeMeta]
hero *NftHomeMeta
newHero *NftHomeMeta
goldBullion *NftHomeMeta
}
func (this *NftHomeMetaTable) GetHeroMeta() *NftHomeMeta {
return this.hero
}
func (this *NftHomeMetaTable) GetNewHeroMeta() *NftHomeMeta {
return this.newHero
}
func (this *NftHomeMetaTable) GetGoldBullionMeta() *NftHomeMeta {
return this.goldBullion
}
func (this *NftHomeMetaTable) PostInit1() {
this.hero = this.GetByName("hero")
this.newHero = this.GetByName("new_hero")
this.goldBullion = this.GetByName("gold_bullion")
}

View File

@ -1,34 +0,0 @@
package mt
import (
"f5"
"main/mtb"
)
type NftServerCluster struct {
mtb.NftServerCluster
}
type NftServerClusterTable struct {
f5.IdMetaTable[NftServerCluster]
selfConf *NftServerCluster
}
func (this *NftServerCluster) Init1() {
}
func (this *NftServerClusterTable) GetListenPort() int32 {
return this.selfConf.GetListenPort()
}
func (this *NftServerClusterTable) GetHttpListenPort() int32 {
return this.selfConf.GetHttpListenPort()
}
func (this *NftServerClusterTable) PostInit1() {
this.selfConf = this.GetById(int64(f5.GetApp().GetInstanceId()))
if this.selfConf == nil {
panic("loginserver集群无法读取本服配置")
}
}

View File

@ -0,0 +1,17 @@
package mt
import (
"f5"
"main/mtb"
)
type WheelDb struct {
mtb.WheelDb
}
type WheelDbTable struct {
f5.IdMetaTable[WheelDb]
}
func (this *WheelDb) Init1() {
}

View File

@ -0,0 +1,34 @@
package mt
import (
"f5"
"main/mtb"
)
type WheelServerCluster struct {
mtb.WheelServerCluster
}
type WheelServerClusterTable struct {
f5.IdMetaTable[WheelServerCluster]
selfConf *WheelServerCluster
}
func (this *WheelServerCluster) Init1() {
}
func (this *WheelServerClusterTable) GetListenPort() int32 {
return this.selfConf.GetListenPort()
}
func (this *WheelServerClusterTable) GetHttpListenPort() int32 {
return this.selfConf.GetHttpListenPort()
}
func (this *WheelServerClusterTable) PostInit1() {
this.selfConf = this.GetById(int64(f5.GetApp().GetInstanceId()))
if this.selfConf == nil {
panic("loginserver集群无法读取本服配置")
}
}

View File

@ -5,21 +5,20 @@ import (
) )
type table struct { type table struct {
NftServerCluster *NftServerClusterTable WheelServerCluster *WheelServerClusterTable
//NftDb *NftDbTable //WheelDb *WheelDbTable
Config *ConfigTable Config *ConfigTable
NftHomeMeta *NftHomeMetaTable
//Contract *ContractTable //Contract *ContractTable
} }
var Table = f5.New(func(this *table) { var Table = f5.New(func(this *table) {
this.NftServerCluster = f5.New(func(this *NftServerClusterTable) { this.WheelServerCluster = f5.New(func(this *WheelServerClusterTable) {
this.FileName = "../config/nftserver.cluster.json" this.FileName = "../config/wheelserver.cluster.json"
this.PrimKey = "instance_id" this.PrimKey = "instance_id"
}) })
/* /*
this.NftDb = f5.New(func(this *NftDbTable) { this.WheelDb = f5.New(func(this *WheelDbTable) {
this.FileName = "../config/nftdb.mysql.json" this.FileName = "../config/nftdb.mysql.json"
this.PrimKey = "" this.PrimKey = ""
})*/ })*/
@ -29,11 +28,6 @@ var Table = f5.New(func(this *table) {
this.PrimKey = "" this.PrimKey = ""
}) })
this.NftHomeMeta = f5.New(func(this *NftHomeMetaTable) {
this.FileName = "../config/nft_home_meta.json"
this.PrimKey = "name"
})
//this.Contract = new(ContractTable) //this.Contract = new(ContractTable)
}) })

View File

@ -4,7 +4,7 @@ import (
"f5" "f5"
) )
type NftServerCluster struct { type WheelServerCluster struct {
instance_id int32 instance_id int32
listen_port int32 listen_port int32
http_listen_port int32 http_listen_port int32
@ -13,7 +13,7 @@ type NftServerCluster struct {
_flags2_ uint64 _flags2_ uint64
} }
type NftDb struct { type WheelDb struct {
host string host string
port int32 port int32
user string user string
@ -25,152 +25,83 @@ type NftDb struct {
} }
type Config struct { type Config struct {
gameapi_url string
_flags1_ uint64 _flags1_ uint64
_flags2_ uint64 _flags2_ uint64
} }
type NftHomeMeta struct { func (this *WheelServerCluster) GetInstanceId() int32 {
name string
nft_name string
nft_symbol string
nft_description string
nft_image string
nft_external_link string
_flags1_ uint64
_flags2_ uint64
}
func (this *NftServerCluster) GetInstanceId() int32 {
return this.instance_id return this.instance_id
} }
func (this *NftServerCluster) HasInstanceId() bool { func (this *WheelServerCluster) HasInstanceId() bool {
return (this._flags1_ & (uint64(1) << 1)) > 0 return (this._flags1_ & (uint64(1) << 1)) > 0
} }
func (this *NftServerCluster) GetListenPort() int32 { func (this *WheelServerCluster) GetListenPort() int32 {
return this.listen_port return this.listen_port
} }
func (this *NftServerCluster) HasListenPort() bool { func (this *WheelServerCluster) HasListenPort() bool {
return (this._flags1_ & (uint64(1) << 2)) > 0 return (this._flags1_ & (uint64(1) << 2)) > 0
} }
func (this *NftServerCluster) GetHttpListenPort() int32 { func (this *WheelServerCluster) GetHttpListenPort() int32 {
return this.http_listen_port return this.http_listen_port
} }
func (this *NftServerCluster) HasHttpListenPort() bool { func (this *WheelServerCluster) HasHttpListenPort() bool {
return (this._flags1_ & (uint64(1) << 3)) > 0 return (this._flags1_ & (uint64(1) << 3)) > 0
} }
func (this *NftDb) GetHost() string { func (this *WheelDb) GetHost() string {
return this.host return this.host
} }
func (this *NftDb) HasHost() bool { func (this *WheelDb) HasHost() bool {
return (this._flags1_ & (uint64(1) << 1)) > 0 return (this._flags1_ & (uint64(1) << 1)) > 0
} }
func (this *NftDb) GetPort() int32 { func (this *WheelDb) GetPort() int32 {
return this.port return this.port
} }
func (this *NftDb) HasPort() bool { func (this *WheelDb) HasPort() bool {
return (this._flags1_ & (uint64(1) << 2)) > 0 return (this._flags1_ & (uint64(1) << 2)) > 0
} }
func (this *NftDb) GetUser() string { func (this *WheelDb) GetUser() string {
return this.user return this.user
} }
func (this *NftDb) HasUser() bool { func (this *WheelDb) HasUser() bool {
return (this._flags1_ & (uint64(1) << 3)) > 0 return (this._flags1_ & (uint64(1) << 3)) > 0
} }
func (this *NftDb) GetPasswd() string { func (this *WheelDb) GetPasswd() string {
return this.passwd return this.passwd
} }
func (this *NftDb) HasPasswd() bool { func (this *WheelDb) HasPasswd() bool {
return (this._flags1_ & (uint64(1) << 4)) > 0 return (this._flags1_ & (uint64(1) << 4)) > 0
} }
func (this *NftDb) GetDatabase() string { func (this *WheelDb) GetDatabase() string {
return this.database return this.database
} }
func (this *NftDb) HasDatabase() bool { func (this *WheelDb) HasDatabase() bool {
return (this._flags1_ & (uint64(1) << 5)) > 0 return (this._flags1_ & (uint64(1) << 5)) > 0
} }
func (this *Config) GetGameapiUrl() string {
return this.gameapi_url
}
func (this *Config) HasGameapiUrl() bool { func (this *WheelServerCluster) LoadFromKv(kv map[string]interface{}) {
return (this._flags1_ & (uint64(1) << 1)) > 0
}
func (this *NftHomeMeta) GetName() string {
return this.name
}
func (this *NftHomeMeta) HasName() bool {
return (this._flags1_ & (uint64(1) << 1)) > 0
}
func (this *NftHomeMeta) GetNftName() string {
return this.nft_name
}
func (this *NftHomeMeta) HasNftName() bool {
return (this._flags1_ & (uint64(1) << 3)) > 0
}
func (this *NftHomeMeta) GetNftSymbol() string {
return this.nft_symbol
}
func (this *NftHomeMeta) HasNftSymbol() bool {
return (this._flags1_ & (uint64(1) << 4)) > 0
}
func (this *NftHomeMeta) GetNftDescription() string {
return this.nft_description
}
func (this *NftHomeMeta) HasNftDescription() bool {
return (this._flags1_ & (uint64(1) << 5)) > 0
}
func (this *NftHomeMeta) GetNftImage() string {
return this.nft_image
}
func (this *NftHomeMeta) HasNftImage() bool {
return (this._flags1_ & (uint64(1) << 6)) > 0
}
func (this *NftHomeMeta) GetNftExternalLink() string {
return this.nft_external_link
}
func (this *NftHomeMeta) HasNftExternalLink() bool {
return (this._flags1_ & (uint64(1) << 7)) > 0
}
func (this *NftServerCluster) LoadFromKv(kv map[string]interface{}) {
f5.ReadMetaTableField(&this.instance_id, "instance_id", &this._flags1_, 1, kv) 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.listen_port, "listen_port", &this._flags1_, 2, kv)
f5.ReadMetaTableField(&this.http_listen_port, "http_listen_port", &this._flags1_, 3, kv) f5.ReadMetaTableField(&this.http_listen_port, "http_listen_port", &this._flags1_, 3, kv)
} }
func (this *NftDb) LoadFromKv(kv map[string]interface{}) { func (this *WheelDb) LoadFromKv(kv map[string]interface{}) {
f5.ReadMetaTableField(&this.host, "host", &this._flags1_, 1, kv) f5.ReadMetaTableField(&this.host, "host", &this._flags1_, 1, kv)
f5.ReadMetaTableField(&this.port, "port", &this._flags1_, 2, kv) f5.ReadMetaTableField(&this.port, "port", &this._flags1_, 2, kv)
f5.ReadMetaTableField(&this.user, "user", &this._flags1_, 3, kv) f5.ReadMetaTableField(&this.user, "user", &this._flags1_, 3, kv)
@ -179,14 +110,4 @@ func (this *NftDb) LoadFromKv(kv map[string]interface{}) {
} }
func (this *Config) LoadFromKv(kv map[string]interface{}) { func (this *Config) LoadFromKv(kv map[string]interface{}) {
f5.ReadMetaTableField(&this.gameapi_url, "gameapi_url", &this._flags1_, 1, kv)
}
func (this *NftHomeMeta) LoadFromKv(kv map[string]interface{}) {
f5.ReadMetaTableField(&this.name, "name", &this._flags1_, 1, kv)
f5.ReadMetaTableField(&this.nft_name, "nft_name", &this._flags1_, 3, kv)
f5.ReadMetaTableField(&this.nft_symbol, "nft_symbol", &this._flags1_, 4, kv)
f5.ReadMetaTableField(&this.nft_description, "nft_description", &this._flags1_, 5, kv)
f5.ReadMetaTableField(&this.nft_image, "nft_image", &this._flags1_, 6, kv)
f5.ReadMetaTableField(&this.nft_external_link, "nft_external_link", &this._flags1_, 7, kv)
} }

View File

@ -2,14 +2,14 @@ package mt;
option go_package = ".;mt"; option go_package = ".;mt";
message NftServerCluster message WheelServerCluster
{ {
optional int32 instance_id = 1; optional int32 instance_id = 1;
optional int32 listen_port = 2; optional int32 listen_port = 2;
optional int32 http_listen_port = 3; optional int32 http_listen_port = 3;
} }
message NftDb message WheelDb
{ {
optional string host = 1; optional string host = 1;
optional int32 port = 2; optional int32 port = 2;
@ -20,15 +20,4 @@ message NftDb
message Config message Config
{ {
optional string gameapi_url = 1;
}
message NftHomeMeta
{
optional string name = 1;
optional string nft_name = 3;
optional string nft_symbol = 4;
optional string nft_description = 5;
optional string nft_image = 6;
optional string nft_external_link = 7;
} }