Merge branch 'dev' of git.kingsome.cn:server/game2006go into dev
This commit is contained in:
commit
c7ea490bfe
@ -104,6 +104,17 @@ func (this *app) registerDataSources() {
|
||||
mt.Table.LogDb.GetById(0).GetMaxOpenConns(),
|
||||
mt.Table.LogDb.GetById(0).GetMaxIdleConns())
|
||||
|
||||
f5.GetGoStyleDb().RegisterDataSource(
|
||||
constant.ACCOUNT_DB,
|
||||
mt.Table.AccountDb.GetById(0).GetHost(),
|
||||
mt.Table.AccountDb.GetById(0).GetPort(),
|
||||
mt.Table.AccountDb.GetById(0).GetUser(),
|
||||
mt.Table.AccountDb.GetById(0).GetPasswd(),
|
||||
mt.Table.AccountDb.GetById(0).GetDatabase(),
|
||||
1,
|
||||
mt.Table.AccountDb.GetById(0).GetMaxOpenConns(),
|
||||
mt.Table.AccountDb.GetById(0).GetMaxIdleConns())
|
||||
|
||||
}
|
||||
|
||||
func (this *app) HasTask() bool {
|
||||
|
@ -10,6 +10,7 @@ const (
|
||||
GAME_DB = "gamedb"
|
||||
MAIL_DB = "maildb"
|
||||
LOG_DB = "logdb"
|
||||
ACCOUNT_DB = "accountdb"
|
||||
)
|
||||
|
||||
const (
|
||||
|
14
server/backtask/mt/AccountDb.go
Normal file
14
server/backtask/mt/AccountDb.go
Normal file
@ -0,0 +1,14 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"main/mtb"
|
||||
)
|
||||
|
||||
type AccountDb struct {
|
||||
mtb.AccountDb
|
||||
}
|
||||
|
||||
type AccountDbTable struct {
|
||||
f5.IdMetaTable[AccountDb]
|
||||
}
|
@ -11,6 +11,7 @@ type table struct {
|
||||
BcEventDb *BcEventDbTable
|
||||
BcNftDb *BcNftDbTable
|
||||
LogDb *LogDbTable
|
||||
AccountDb *AccountDbTable
|
||||
Config *ConfigTable
|
||||
Item *ItemTable
|
||||
Language *LanguageTable
|
||||
@ -52,6 +53,11 @@ var Table = f5.New(func(this *table) {
|
||||
this.PrimKey = ""
|
||||
})
|
||||
|
||||
this.AccountDb = f5.New(func(this *AccountDbTable) {
|
||||
this.FileName = "../config/accountdb.mysql.json"
|
||||
this.PrimKey = ""
|
||||
})
|
||||
|
||||
this.Config = f5.New(func(this *ConfigTable) {
|
||||
this.FileName = "../config/config.json"
|
||||
this.PrimKey = ""
|
||||
|
@ -78,6 +78,19 @@ type LogDb struct {
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type AccountDb struct {
|
||||
host string
|
||||
port int32
|
||||
user string
|
||||
passwd string
|
||||
database string
|
||||
max_open_conns int32
|
||||
max_idle_conns int32
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
gameapi_url string
|
||||
net_id int32
|
||||
@ -442,6 +455,62 @@ func (this *LogDb) HasMaxIdleConns() bool {
|
||||
return (this._flags1_ & (uint64(1) << 7)) > 0
|
||||
}
|
||||
|
||||
func (this *AccountDb) GetHost() string {
|
||||
return this.host
|
||||
}
|
||||
|
||||
func (this *AccountDb) HasHost() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *AccountDb) GetPort() int32 {
|
||||
return this.port
|
||||
}
|
||||
|
||||
func (this *AccountDb) HasPort() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *AccountDb) GetUser() string {
|
||||
return this.user
|
||||
}
|
||||
|
||||
func (this *AccountDb) HasUser() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *AccountDb) GetPasswd() string {
|
||||
return this.passwd
|
||||
}
|
||||
|
||||
func (this *AccountDb) HasPasswd() bool {
|
||||
return (this._flags1_ & (uint64(1) << 4)) > 0
|
||||
}
|
||||
|
||||
func (this *AccountDb) GetDatabase() string {
|
||||
return this.database
|
||||
}
|
||||
|
||||
func (this *AccountDb) HasDatabase() bool {
|
||||
return (this._flags1_ & (uint64(1) << 5)) > 0
|
||||
}
|
||||
|
||||
func (this *AccountDb) GetMaxOpenConns() int32 {
|
||||
return this.max_open_conns
|
||||
}
|
||||
|
||||
func (this *AccountDb) HasMaxOpenConns() bool {
|
||||
return (this._flags1_ & (uint64(1) << 6)) > 0
|
||||
}
|
||||
|
||||
func (this *AccountDb) GetMaxIdleConns() int32 {
|
||||
return this.max_idle_conns
|
||||
}
|
||||
|
||||
func (this *AccountDb) HasMaxIdleConns() bool {
|
||||
return (this._flags1_ & (uint64(1) << 7)) > 0
|
||||
}
|
||||
|
||||
func (this *Config) GetGameapiUrl() string {
|
||||
return this.gameapi_url
|
||||
}
|
||||
@ -691,6 +760,16 @@ func (this *LogDb) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.max_idle_conns, "max_idle_conns", &this._flags1_, 7, kv)
|
||||
}
|
||||
|
||||
func (this *AccountDb) 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)
|
||||
f5.ReadMetaTableField(&this.max_open_conns, "max_open_conns", &this._flags1_, 6, kv)
|
||||
f5.ReadMetaTableField(&this.max_idle_conns, "max_idle_conns", &this._flags1_, 7, kv)
|
||||
}
|
||||
|
||||
func (this *Config) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.gameapi_url, "gameapi_url", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.net_id, "net_id", &this._flags1_, 2, kv)
|
||||
|
@ -64,6 +64,17 @@ message LogDb
|
||||
optional int32 max_idle_conns = 7;
|
||||
}
|
||||
|
||||
message AccountDb
|
||||
{
|
||||
optional string host = 1;
|
||||
optional int32 port = 2;
|
||||
optional string user = 3;
|
||||
optional string passwd = 4;
|
||||
optional string database = 5;
|
||||
optional int32 max_open_conns = 6;
|
||||
optional int32 max_idle_conns = 7;
|
||||
}
|
||||
|
||||
message Config
|
||||
{
|
||||
optional string gameapi_url = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user