diff --git a/server/backtask/app/app.go b/server/backtask/app/app.go index a95b4ea0..68d987a5 100644 --- a/server/backtask/app/app.go +++ b/server/backtask/app/app.go @@ -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 { diff --git a/server/backtask/constant/constant.go b/server/backtask/constant/constant.go index 3e4febee..b30d3dad 100644 --- a/server/backtask/constant/constant.go +++ b/server/backtask/constant/constant.go @@ -10,6 +10,7 @@ const ( GAME_DB = "gamedb" MAIL_DB = "maildb" LOG_DB = "logdb" + ACCOUNT_DB = "accountdb" ) const ( diff --git a/server/backtask/mt/AccountDb.go b/server/backtask/mt/AccountDb.go new file mode 100644 index 00000000..75279f97 --- /dev/null +++ b/server/backtask/mt/AccountDb.go @@ -0,0 +1,14 @@ +package mt + +import ( + "f5" + "main/mtb" +) + +type AccountDb struct { + mtb.AccountDb +} + +type AccountDbTable struct { + f5.IdMetaTable[AccountDb] +} diff --git a/server/backtask/mt/export.go b/server/backtask/mt/export.go index 54ac7f27..ca4ee5ab 100644 --- a/server/backtask/mt/export.go +++ b/server/backtask/mt/export.go @@ -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 = "" diff --git a/server/backtask/mtb/mtb.auto_gen.go b/server/backtask/mtb/mtb.auto_gen.go index f71c840f..2ef4fa25 100644 --- a/server/backtask/mtb/mtb.auto_gen.go +++ b/server/backtask/mtb/mtb.auto_gen.go @@ -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) diff --git a/server/backtask/proto/mt.proto b/server/backtask/proto/mt.proto index 1f559c5b..8a4cf84e 100644 --- a/server/backtask/proto/mt.proto +++ b/server/backtask/proto/mt.proto @@ -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;