This commit is contained in:
aozhiwei 2024-06-13 11:13:39 +08:00
parent a1b755aebd
commit b2c45ca99f
7 changed files with 47 additions and 160 deletions

View File

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

View File

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

View File

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

View File

@ -1,34 +0,0 @@
package mt
import (
"f5"
"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

@ -5,15 +5,14 @@ import (
)
type table struct {
NftServerCluster *NftServerClusterTable
MarketServerCluster *MarketServerClusterTable
NftDb *NftDbTable
Config *ConfigTable
NftHomeMeta *NftHomeMetaTable
}
var Table = f5.New(func(this *table) {
this.NftServerCluster = f5.New(func(this *NftServerClusterTable) {
this.FileName = "../config/nftserver.cluster.json"
this.MarketServerCluster = f5.New(func(this *MarketServerClusterTable) {
this.FileName = "../config/marketserver.cluster.json"
this.PrimKey = "instance_id"
})
@ -27,8 +26,4 @@ var Table = f5.New(func(this *table) {
this.PrimKey = ""
})
this.NftHomeMeta = f5.New(func(this *NftHomeMetaTable) {
this.FileName = "../config/nft_home_meta.json"
this.PrimKey = "name"
})
})

View File

@ -4,7 +4,7 @@ import (
"f5"
)
type NftServerCluster struct {
type MarketServerCluster struct {
instance_id int32
listen_port int32
http_listen_port int32
@ -31,39 +31,27 @@ type Config struct {
_flags2_ uint64
}
type NftHomeMeta struct {
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 {
func (this *MarketServerCluster) GetInstanceId() int32 {
return this.instance_id
}
func (this *NftServerCluster) HasInstanceId() bool {
func (this *MarketServerCluster) HasInstanceId() bool {
return (this._flags1_ & (uint64(1) << 1)) > 0
}
func (this *NftServerCluster) GetListenPort() int32 {
func (this *MarketServerCluster) GetListenPort() int32 {
return this.listen_port
}
func (this *NftServerCluster) HasListenPort() bool {
func (this *MarketServerCluster) HasListenPort() bool {
return (this._flags1_ & (uint64(1) << 2)) > 0
}
func (this *NftServerCluster) GetHttpListenPort() int32 {
func (this *MarketServerCluster) GetHttpListenPort() int32 {
return this.http_listen_port
}
func (this *NftServerCluster) HasHttpListenPort() bool {
func (this *MarketServerCluster) HasHttpListenPort() bool {
return (this._flags1_ & (uint64(1) << 3)) > 0
}
@ -115,56 +103,8 @@ func (this *Config) HasGameapiUrl() bool {
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{}) {
func (this *MarketServerCluster) 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)
@ -181,12 +121,3 @@ func (this *NftDb) 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,7 +2,7 @@ package mt;
option go_package = ".;mt";
message NftServerCluster
message MarketServerCluster
{
optional int32 instance_id = 1;
optional int32 listen_port = 2;
@ -22,13 +22,3 @@ 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;
}