This commit is contained in:
aozhiwei 2024-08-09 18:01:38 +08:00
commit ec7a3ee802
19 changed files with 272 additions and 4 deletions

View File

@ -0,0 +1,9 @@
{
"host": "login-test.kingsome.cn",
"port": 3306,
"user": "root",
"passwd": "keji178",
"database": "logdb_dev_1",
"max_open_conns": 1,
"max_idle_conns": 1
}

View File

@ -0,0 +1,9 @@
{
"host": "login-test.kingsome.cn",
"port": 3306,
"user": "root",
"passwd": "keji178",
"database": "logdb_dev_1",
"max_open_conns": 1,
"max_idle_conns": 1
}

View File

@ -52,11 +52,17 @@ CREATE TABLE `t_mail` (
`user_reg_end_time` int(11) NOT NULL DEFAULT '0' COMMENT '用户注册结束时间',
`tag1` int(11) NOT NULL DEFAULT '0' COMMENT 'tag1',
`tag2` int(11) NOT NULL DEFAULT '0' COMMENT 'tag2',
`create_address` varchar(60) CHARACTER SET utf8 COMMENT '创建邮件的钱包地址',
`update_address` varchar(60) CHARACTER SET utf8 COMMENT '更新邮件的钱包地址',
`expiretime` int(11) NOT NULL DEFAULT '0' COMMENT '过期时间',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
UNIQUE KEY `unikey` (`unikey`),
UNIQUE KEY `mail_id` (`mail_id`),
KEY `idx_create_address` (`create_address`),
KEY `idx_update_address` (`update_address`),
KEY `idx_tag1` (`tag1`),
KEY `idx_tag2` (`tag2`),
PRIMARY KEY (`idx`)
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;

View File

@ -93,6 +93,17 @@ func (this *app) registerDataSources() {
mt.Table.BcEventDb.GetById(0).GetMaxOpenConns(),
mt.Table.BcEventDb.GetById(0).GetMaxIdleConns())
f5.GetGoStyleDb().RegisterDataSource(
constant.LOG_DB,
mt.Table.LogDb.GetById(0).GetHost(),
mt.Table.LogDb.GetById(0).GetPort(),
mt.Table.LogDb.GetById(0).GetUser(),
mt.Table.LogDb.GetById(0).GetPasswd(),
mt.Table.LogDb.GetById(0).GetDatabase(),
1,
mt.Table.LogDb.GetById(0).GetMaxOpenConns(),
mt.Table.LogDb.GetById(0).GetMaxIdleConns())
}
func (this *app) HasTask() bool {

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
@ -373,6 +386,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
}
@ -612,6 +681,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},

View File

@ -37,7 +37,7 @@ const (
)
const (
MAIL_TAG1_CUSTOM = 1
MAIL_TAG1_CUSTOM = 10
MAIL_TAG1_HERO = 100
MAIL_TAG1_GOLD_BULLION = 101
)

View File

@ -93,6 +93,17 @@ func (this *app) registerDataSources() {
mt.Table.BcEventDb.GetById(0).GetMaxOpenConns(),
mt.Table.BcEventDb.GetById(0).GetMaxIdleConns())
f5.GetGoStyleDb().RegisterDataSource(
constant.LOG_DB,
mt.Table.LogDb.GetById(0).GetHost(),
mt.Table.LogDb.GetById(0).GetPort(),
mt.Table.LogDb.GetById(0).GetUser(),
mt.Table.LogDb.GetById(0).GetPasswd(),
mt.Table.LogDb.GetById(0).GetDatabase(),
1,
mt.Table.LogDb.GetById(0).GetMaxOpenConns(),
mt.Table.LogDb.GetById(0).GetMaxIdleConns())
}
func (this *app) HasTask() bool {

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},

View File

@ -20,7 +20,7 @@ type RechargeApi struct {
}
func (ea *RechargeApi) RechargeList(c *gin.Context) {
netId := q5.ToInt32(c.Param("net_id"))
netId := q5.ToInt32(c.DefaultQuery("net_id", ""))
rspObj := struct {
ErrCode int32 `json:"errcode"`
ErrMsg string `json:"errmsg"`