1
This commit is contained in:
parent
cd2bd5da77
commit
afe2c8d890
@ -81,20 +81,4 @@ func (this *app) AddNetMsg(hdr *f5.MsgHdr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *app) registerDataSources() {
|
func (this *app) registerDataSources() {
|
||||||
f5.GetJsStyleDb().RegisterDataSource(
|
|
||||||
constant.GAME_DB,
|
|
||||||
mt.Table.GameDb.GetById(0).GetHost(),
|
|
||||||
mt.Table.GameDb.GetById(0).GetPort(),
|
|
||||||
mt.Table.GameDb.GetById(0).GetUser(),
|
|
||||||
mt.Table.GameDb.GetById(0).GetPasswd(),
|
|
||||||
mt.Table.GameDb.GetById(0).GetDatabase(),
|
|
||||||
30)
|
|
||||||
f5.GetJsStyleDb().RegisterDataSource(
|
|
||||||
constant.FRIEND_DB,
|
|
||||||
mt.Table.FriendDb.GetById(0).GetHost(),
|
|
||||||
mt.Table.FriendDb.GetById(0).GetPort(),
|
|
||||||
mt.Table.FriendDb.GetById(0).GetUser(),
|
|
||||||
mt.Table.FriendDb.GetById(0).GetPasswd(),
|
|
||||||
mt.Table.FriendDb.GetById(0).GetDatabase(),
|
|
||||||
30)
|
|
||||||
}
|
}
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
package mt
|
|
||||||
|
|
||||||
import (
|
|
||||||
"f5"
|
|
||||||
"mtb"
|
|
||||||
)
|
|
||||||
|
|
||||||
type FriendDb struct {
|
|
||||||
mtb.FriendDb
|
|
||||||
}
|
|
||||||
|
|
||||||
type FriendDbTable struct {
|
|
||||||
f5.IdMetaTable[FriendDb]
|
|
||||||
selfConf *FriendDb
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package mt
|
|
||||||
|
|
||||||
import (
|
|
||||||
"f5"
|
|
||||||
"mtb"
|
|
||||||
)
|
|
||||||
|
|
||||||
type GameDb struct {
|
|
||||||
mtb.GameDb
|
|
||||||
}
|
|
||||||
|
|
||||||
type GameDbTable struct {
|
|
||||||
f5.IdMetaTable[GameDb]
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *GameDb) Init1() {
|
|
||||||
}
|
|
@ -7,8 +7,6 @@ import (
|
|||||||
type table struct {
|
type table struct {
|
||||||
HallCluster *HallClusterTable
|
HallCluster *HallClusterTable
|
||||||
MasterCluster *MasterClusterTable
|
MasterCluster *MasterClusterTable
|
||||||
GameDb *GameDbTable
|
|
||||||
FriendDb *FriendDbTable
|
|
||||||
Config *ConfigTable
|
Config *ConfigTable
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,16 +21,6 @@ var Table = f5.New(func (this* table) {
|
|||||||
this.PrimKey = "instance_id"
|
this.PrimKey = "instance_id"
|
||||||
});
|
});
|
||||||
|
|
||||||
this.GameDb = f5.New(func (this *GameDbTable) {
|
|
||||||
this.FileName = "../config/gamedb.mysql.json"
|
|
||||||
this.PrimKey = ""
|
|
||||||
});
|
|
||||||
|
|
||||||
this.FriendDb = f5.New(func (this *FriendDbTable) {
|
|
||||||
this.FileName = "../config/frienddb.mysql.json"
|
|
||||||
this.PrimKey = ""
|
|
||||||
});
|
|
||||||
|
|
||||||
this.Config = f5.New(func (this *ConfigTable) {
|
this.Config = f5.New(func (this *ConfigTable) {
|
||||||
this.FileName = "../config/config.json"
|
this.FileName = "../config/config.json"
|
||||||
this.PrimKey = ""
|
this.PrimKey = ""
|
||||||
|
@ -22,28 +22,6 @@ type MasterCluster struct {
|
|||||||
_flags2_ uint64
|
_flags2_ uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
type GameDb struct {
|
|
||||||
host string
|
|
||||||
port int32
|
|
||||||
user string
|
|
||||||
passwd string
|
|
||||||
database string
|
|
||||||
|
|
||||||
_flags1_ uint64
|
|
||||||
_flags2_ uint64
|
|
||||||
}
|
|
||||||
|
|
||||||
type FriendDb struct {
|
|
||||||
host string
|
|
||||||
port int32
|
|
||||||
user string
|
|
||||||
passwd string
|
|
||||||
database string
|
|
||||||
|
|
||||||
_flags1_ uint64
|
|
||||||
_flags2_ uint64
|
|
||||||
}
|
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
gameapi_url string
|
gameapi_url string
|
||||||
auto_start_time int32
|
auto_start_time int32
|
||||||
@ -102,86 +80,6 @@ func (this *MasterCluster) HasListenPort() bool {
|
|||||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *GameDb) GetHost() string {
|
|
||||||
return this.host
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *GameDb) HasHost() bool {
|
|
||||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *GameDb) GetPort() int32 {
|
|
||||||
return this.port
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *GameDb) HasPort() bool {
|
|
||||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *GameDb) GetUser() string {
|
|
||||||
return this.user
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *GameDb) HasUser() bool {
|
|
||||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *GameDb) GetPasswd() string {
|
|
||||||
return this.passwd
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *GameDb) HasPasswd() bool {
|
|
||||||
return (this._flags1_ & (uint64(1) << 4)) > 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *GameDb) GetDatabase() string {
|
|
||||||
return this.database
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *GameDb) HasDatabase() bool {
|
|
||||||
return (this._flags1_ & (uint64(1) << 5)) > 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *FriendDb) GetHost() string {
|
|
||||||
return this.host
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *FriendDb) HasHost() bool {
|
|
||||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *FriendDb) GetPort() int32 {
|
|
||||||
return this.port
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *FriendDb) HasPort() bool {
|
|
||||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *FriendDb) GetUser() string {
|
|
||||||
return this.user
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *FriendDb) HasUser() bool {
|
|
||||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *FriendDb) GetPasswd() string {
|
|
||||||
return this.passwd
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *FriendDb) HasPasswd() bool {
|
|
||||||
return (this._flags1_ & (uint64(1) << 4)) > 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *FriendDb) GetDatabase() string {
|
|
||||||
return this.database
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *FriendDb) HasDatabase() bool {
|
|
||||||
return (this._flags1_ & (uint64(1) << 5)) > 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *Config) GetGameapiUrl() string {
|
func (this *Config) GetGameapiUrl() string {
|
||||||
return this.gameapi_url
|
return this.gameapi_url
|
||||||
}
|
}
|
||||||
@ -227,22 +125,6 @@ func (this *MasterCluster) LoadFromKv(kv map[string]interface{}) {
|
|||||||
f5.ReadMetaTableField(&this.listen_port, "listen_port", &this._flags1_, 3, 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)
|
|
||||||
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 *FriendDb) 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{}) {
|
func (this *Config) LoadFromKv(kv map[string]interface{}) {
|
||||||
f5.ReadMetaTableField(&this.gameapi_url, "gameapi_url", &this._flags1_, 1, kv)
|
f5.ReadMetaTableField(&this.gameapi_url, "gameapi_url", &this._flags1_, 1, kv)
|
||||||
f5.ReadMetaTableField(&this.auto_start_time, "auto_start_time", &this._flags1_, 2, kv)
|
f5.ReadMetaTableField(&this.auto_start_time, "auto_start_time", &this._flags1_, 2, kv)
|
||||||
|
@ -16,24 +16,6 @@ message MasterCluster
|
|||||||
optional int32 listen_port = 3;
|
optional int32 listen_port = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GameDb
|
|
||||||
{
|
|
||||||
optional string host = 1;
|
|
||||||
optional int32 port = 2;
|
|
||||||
optional string user = 3;
|
|
||||||
optional string passwd = 4;
|
|
||||||
optional string database = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
message FriendDb
|
|
||||||
{
|
|
||||||
optional string host = 1;
|
|
||||||
optional int32 port = 2;
|
|
||||||
optional string user = 3;
|
|
||||||
optional string passwd = 4;
|
|
||||||
optional string database = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
message Config
|
message Config
|
||||||
{
|
{
|
||||||
optional string gameapi_url = 1;
|
optional string gameapi_url = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user