1
This commit is contained in:
parent
bc4e93b5c4
commit
baad482d6d
@ -15,7 +15,7 @@ func (this *app) GetPkgName() string {
|
||||
}
|
||||
|
||||
func (this *app) GetHttpListenPort() int32 {
|
||||
return mt.Table.LoginCluster.GetHttpListenPort()
|
||||
return mt.Table.NftServerCluster.GetHttpListenPort()
|
||||
}
|
||||
|
||||
func (this *app) Run(initCb func(), unInitCb func()) {
|
||||
|
@ -1,34 +0,0 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"mtb"
|
||||
)
|
||||
|
||||
type LoginCluster struct {
|
||||
mtb.LoginCluster
|
||||
}
|
||||
|
||||
type LoginClusterTable struct {
|
||||
f5.IdMetaTable[LoginCluster]
|
||||
selfConf *LoginCluster
|
||||
}
|
||||
|
||||
func (this *LoginCluster) Init1() {
|
||||
|
||||
}
|
||||
|
||||
func (this *LoginClusterTable) GetListenPort() int32 {
|
||||
return this.selfConf.GetListenPort()
|
||||
}
|
||||
|
||||
func (this *LoginClusterTable) GetHttpListenPort() int32 {
|
||||
return this.selfConf.GetHttpListenPort()
|
||||
}
|
||||
|
||||
func (this *LoginClusterTable) PostInit1() {
|
||||
this.selfConf = this.GetById(int64(f5.GetApp().GetInstanceId()))
|
||||
if this.selfConf == nil {
|
||||
panic("loginserver集群无法读取本服配置")
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"mtb"
|
||||
)
|
||||
|
||||
type LoginDb struct {
|
||||
mtb.LoginDb
|
||||
}
|
||||
|
||||
type LoginDbTable struct {
|
||||
f5.IdMetaTable[LoginDb]
|
||||
}
|
||||
|
||||
func (this *LoginDb) Init1() {
|
||||
}
|
17
server/nftserver/mt/NftDb.go
Normal file
17
server/nftserver/mt/NftDb.go
Normal file
@ -0,0 +1,17 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"mtb"
|
||||
)
|
||||
|
||||
type NftDb struct {
|
||||
mtb.NftDb
|
||||
}
|
||||
|
||||
type NftDbTable struct {
|
||||
f5.IdMetaTable[NftDb]
|
||||
}
|
||||
|
||||
func (this *NftDb) Init1() {
|
||||
}
|
34
server/nftserver/mt/NftServerCluster.go
Normal file
34
server/nftserver/mt/NftServerCluster.go
Normal file
@ -0,0 +1,34 @@
|
||||
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集群无法读取本服配置")
|
||||
}
|
||||
}
|
@ -5,18 +5,18 @@ import (
|
||||
)
|
||||
|
||||
type table struct {
|
||||
LoginCluster *LoginClusterTable
|
||||
LoginDb *LoginDbTable
|
||||
NftServerCluster *NftServerClusterTable
|
||||
NftDb *NftDbTable
|
||||
Config *ConfigTable
|
||||
}
|
||||
|
||||
var Table = f5.New(func(this *table) {
|
||||
this.LoginCluster = f5.New(func(this *LoginClusterTable) {
|
||||
this.NftServerCluster = f5.New(func(this *NftServerClusterTable) {
|
||||
this.FileName = "../config/loginserver.cluster.json"
|
||||
this.PrimKey = "instance_id"
|
||||
})
|
||||
|
||||
this.LoginDb = f5.New(func(this *LoginDbTable) {
|
||||
this.NftDb = f5.New(func(this *NftDbTable) {
|
||||
this.FileName = "../config/logindb.mysql.json"
|
||||
this.PrimKey = ""
|
||||
})
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"f5"
|
||||
)
|
||||
|
||||
type LoginCluster struct {
|
||||
type NftServerCluster struct {
|
||||
instance_id int32
|
||||
listen_port int32
|
||||
http_listen_port int32
|
||||
@ -13,7 +13,7 @@ type LoginCluster struct {
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type LoginDb struct {
|
||||
type NftDb struct {
|
||||
host string
|
||||
port int32
|
||||
user string
|
||||
@ -31,67 +31,67 @@ type Config struct {
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
func (this *LoginCluster) GetInstanceId() int32 {
|
||||
func (this *NftServerCluster) GetInstanceId() int32 {
|
||||
return this.instance_id
|
||||
}
|
||||
|
||||
func (this *LoginCluster) HasInstanceId() bool {
|
||||
func (this *NftServerCluster) HasInstanceId() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *LoginCluster) GetListenPort() int32 {
|
||||
func (this *NftServerCluster) GetListenPort() int32 {
|
||||
return this.listen_port
|
||||
}
|
||||
|
||||
func (this *LoginCluster) HasListenPort() bool {
|
||||
func (this *NftServerCluster) HasListenPort() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *LoginCluster) GetHttpListenPort() int32 {
|
||||
func (this *NftServerCluster) GetHttpListenPort() int32 {
|
||||
return this.http_listen_port
|
||||
}
|
||||
|
||||
func (this *LoginCluster) HasHttpListenPort() bool {
|
||||
func (this *NftServerCluster) HasHttpListenPort() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *LoginDb) GetHost() string {
|
||||
func (this *NftDb) GetHost() string {
|
||||
return this.host
|
||||
}
|
||||
|
||||
func (this *LoginDb) HasHost() bool {
|
||||
func (this *NftDb) HasHost() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *LoginDb) GetPort() int32 {
|
||||
func (this *NftDb) GetPort() int32 {
|
||||
return this.port
|
||||
}
|
||||
|
||||
func (this *LoginDb) HasPort() bool {
|
||||
func (this *NftDb) HasPort() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *LoginDb) GetUser() string {
|
||||
func (this *NftDb) GetUser() string {
|
||||
return this.user
|
||||
}
|
||||
|
||||
func (this *LoginDb) HasUser() bool {
|
||||
func (this *NftDb) HasUser() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *LoginDb) GetPasswd() string {
|
||||
func (this *NftDb) GetPasswd() string {
|
||||
return this.passwd
|
||||
}
|
||||
|
||||
func (this *LoginDb) HasPasswd() bool {
|
||||
func (this *NftDb) HasPasswd() bool {
|
||||
return (this._flags1_ & (uint64(1) << 4)) > 0
|
||||
}
|
||||
|
||||
func (this *LoginDb) GetDatabase() string {
|
||||
func (this *NftDb) GetDatabase() string {
|
||||
return this.database
|
||||
}
|
||||
|
||||
func (this *LoginDb) HasDatabase() bool {
|
||||
func (this *NftDb) HasDatabase() bool {
|
||||
return (this._flags1_ & (uint64(1) << 5)) > 0
|
||||
}
|
||||
|
||||
@ -104,13 +104,13 @@ func (this *Config) HasGameapiUrl() bool {
|
||||
}
|
||||
|
||||
|
||||
func (this *LoginCluster) LoadFromKv(kv map[string]interface{}) {
|
||||
func (this *NftServerCluster) 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)
|
||||
}
|
||||
|
||||
func (this *LoginDb) LoadFromKv(kv map[string]interface{}) {
|
||||
func (this *NftDb) 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)
|
||||
|
@ -2,14 +2,14 @@ package mt;
|
||||
|
||||
option go_package = ".;mt";
|
||||
|
||||
message LoginCluster
|
||||
message NftServerCluster
|
||||
{
|
||||
optional int32 instance_id = 1;
|
||||
optional int32 listen_port = 2;
|
||||
optional int32 http_listen_port = 3;
|
||||
}
|
||||
|
||||
message LoginDb
|
||||
message NftDb
|
||||
{
|
||||
optional string host = 1;
|
||||
optional int32 port = 2;
|
||||
|
Loading…
x
Reference in New Issue
Block a user