This commit is contained in:
aozhiwei 2024-08-09 09:40:33 +08:00
parent a050a01519
commit 4ab0643ecd
6 changed files with 112 additions and 1 deletions

View File

@ -9,6 +9,7 @@ const (
BCEVENT_DB = "bceventdb"
GAME_DB = "gamedb"
MAIL_DB = "maildb"
LOG_DB = "logdb"
)
const (

View File

@ -0,0 +1,14 @@
package mt
import (
"f5"
"main/mtb"
)
type LogDb struct {
mtb.LogDb
}
type LogDbTable struct {
f5.IdMetaTable[LogDb]
}

View File

@ -10,6 +10,7 @@ type table struct {
MailDb *MailDbTable
BcEventDb *BcEventDbTable
BcNftDb *BcNftDbTable
LogDb *LogDbTable
Config *ConfigTable
Item *ItemTable
Language *LanguageTable
@ -46,6 +47,11 @@ var Table = f5.New(func(this *table) {
this.PrimKey = ""
})
this.LogDb = f5.New(func(this *LogDbTable) {
this.FileName = "../config/logdb.mysql.json"
this.PrimKey = ""
})
this.Config = f5.New(func(this *ConfigTable) {
this.FileName = "../config/config.json"
this.PrimKey = ""

View File

@ -65,6 +65,19 @@ type BcEventDb struct {
_flags2_ uint64
}
type LogDb 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
@ -372,6 +385,62 @@ func (this *BcEventDb) HasMaxIdleConns() bool {
return (this._flags1_ & (uint64(1) << 7)) > 0
}
func (this *LogDb) GetHost() string {
return this.host
}
func (this *LogDb) HasHost() bool {
return (this._flags1_ & (uint64(1) << 1)) > 0
}
func (this *LogDb) GetPort() int32 {
return this.port
}
func (this *LogDb) HasPort() bool {
return (this._flags1_ & (uint64(1) << 2)) > 0
}
func (this *LogDb) GetUser() string {
return this.user
}
func (this *LogDb) HasUser() bool {
return (this._flags1_ & (uint64(1) << 3)) > 0
}
func (this *LogDb) GetPasswd() string {
return this.passwd
}
func (this *LogDb) HasPasswd() bool {
return (this._flags1_ & (uint64(1) << 4)) > 0
}
func (this *LogDb) GetDatabase() string {
return this.database
}
func (this *LogDb) HasDatabase() bool {
return (this._flags1_ & (uint64(1) << 5)) > 0
}
func (this *LogDb) GetMaxOpenConns() int32 {
return this.max_open_conns
}
func (this *LogDb) HasMaxOpenConns() bool {
return (this._flags1_ & (uint64(1) << 6)) > 0
}
func (this *LogDb) GetMaxIdleConns() int32 {
return this.max_idle_conns
}
func (this *LogDb) HasMaxIdleConns() bool {
return (this._flags1_ & (uint64(1) << 7)) > 0
}
func (this *Config) GetGameapiUrl() string {
return this.gameapi_url
}
@ -603,6 +672,16 @@ func (this *BcEventDb) LoadFromKv(kv map[string]interface{}) {
f5.ReadMetaTableField(&this.max_idle_conns, "max_idle_conns", &this._flags1_, 7, kv)
}
func (this *LogDb) 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)

View File

@ -53,6 +53,17 @@ message BcEventDb
optional int32 max_idle_conns = 7;
}
message LogDb
{
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;

View File

@ -111,7 +111,7 @@ func AddGameLog(accountId string, logType string, subType string,
param1 string, param2 string, param3 string, param4 string) {
nowTime := f5.GetApp().GetRealSeconds()
f5.GetGoStyleDb().Insert(
constant.GAME_DB,
constant.LOG_DB,
"t_game_log",
[][]string {
{"account_id", accountId},