This commit is contained in:
aozhiwei 2024-06-21 14:56:44 +08:00
parent 0c59d5fbfa
commit a9bbad721b
8 changed files with 66 additions and 77 deletions

View File

@ -16,7 +16,7 @@ func (this *app) GetPkgName() string {
}
func (this *app) GetHttpListenPort() int32 {
return 3000
return mt.Table.GameServiceCluster.GetHttpListenPort()
}
func (this *app) Run(initCb func(), unInitCb func()) {
@ -40,14 +40,6 @@ func (this *app) Update() {
}
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.GetGoStyleDb().RegisterDataSource(
constant.GAME_DB,
mt.Table.GameDb.GetById(0).GetHost(),
@ -56,22 +48,6 @@ func (this *app) registerDataSources() {
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)
f5.GetApp().RegisterOrmDb(
constant.ADMIN_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(),
"admindb_dev",
)
}
func (this *app) HasTask() bool {

View File

@ -5,9 +5,9 @@ const (
)
const (
BCNFT_DB = "bcnftdb"
BCEVENT_DB = "bceventdb"
GAME_DB = "gamedb"
FRIEND_DB = "firenddb"
ADMIN_DB = "admindb"
)
const (
@ -16,10 +16,4 @@ const (
MAX_MODULE_IDX
)
const (
GAMEID = "2006"
EMAIL_URL_DEV = "gamemail-test.kingsome.cn"
EMAIL_KEY = "520d8eeb8cf1d833a42c820432c020b2fd60f4b7|" + EMAIL_URL_DEV
)
const BASE_SCORE = 2800

View File

@ -0,0 +1,14 @@
package mt
import (
"f5"
"mtb"
)
type BcEventDb struct {
mtb.BcEventDb
}
type BcEventDbTable struct {
f5.IdMetaTable[BcEventDb]
}

View File

@ -0,0 +1,14 @@
package mt
import (
"f5"
"mtb"
)
type BcNftDb struct {
mtb.BcNftDb
}
type BcNftDbTable struct {
f5.IdMetaTable[BcNftDb]
}

View File

@ -1,15 +0,0 @@
package mt
import (
"f5"
"mtb"
)
type FriendDb struct {
mtb.FriendDb
}
type FriendDbTable struct {
f5.IdMetaTable[FriendDb]
selfConf *FriendDb
}

View File

@ -7,7 +7,8 @@ import (
type table struct {
GameServiceCluster *GameServiceClusterTable
GameDb *GameDbTable
FriendDb *FriendDbTable
BcEventDb *BcEventDbTable
BcNftDb *BcNftDbTable
Config *ConfigTable
RankSeason *RankSeasonTable
HashRateCommon *HashRateCommonTable
@ -24,8 +25,13 @@ var Table = f5.New(func(this *table) {
this.PrimKey = ""
})
this.FriendDb = f5.New(func(this *FriendDbTable) {
this.FileName = "../config/frienddb.mysql.json"
this.BcEventDb = f5.New(func(this *BcEventDbTable) {
this.FileName = "../config/bceventdb.mysql.json"
this.PrimKey = ""
})
this.BcNftDb = f5.New(func(this *BcNftDbTable) {
this.FileName = "../config/bcnftdb.mysql.json"
this.PrimKey = ""
})

View File

@ -24,7 +24,7 @@ type GameDb struct {
_flags2_ uint64
}
type FriendDb struct {
type BcNftDb struct {
host string
port int32
user string
@ -35,7 +35,7 @@ type FriendDb struct {
_flags2_ uint64
}
type AdminDb struct {
type BcEventDb struct {
host string
port int32
user string
@ -137,83 +137,83 @@ func (this *GameDb) HasDatabase() bool {
return (this._flags1_ & (uint64(1) << 5)) > 0
}
func (this *FriendDb) GetHost() string {
func (this *BcNftDb) GetHost() string {
return this.host
}
func (this *FriendDb) HasHost() bool {
func (this *BcNftDb) HasHost() bool {
return (this._flags1_ & (uint64(1) << 1)) > 0
}
func (this *FriendDb) GetPort() int32 {
func (this *BcNftDb) GetPort() int32 {
return this.port
}
func (this *FriendDb) HasPort() bool {
func (this *BcNftDb) HasPort() bool {
return (this._flags1_ & (uint64(1) << 2)) > 0
}
func (this *FriendDb) GetUser() string {
func (this *BcNftDb) GetUser() string {
return this.user
}
func (this *FriendDb) HasUser() bool {
func (this *BcNftDb) HasUser() bool {
return (this._flags1_ & (uint64(1) << 3)) > 0
}
func (this *FriendDb) GetPasswd() string {
func (this *BcNftDb) GetPasswd() string {
return this.passwd
}
func (this *FriendDb) HasPasswd() bool {
func (this *BcNftDb) HasPasswd() bool {
return (this._flags1_ & (uint64(1) << 4)) > 0
}
func (this *FriendDb) GetDatabase() string {
func (this *BcNftDb) GetDatabase() string {
return this.database
}
func (this *FriendDb) HasDatabase() bool {
func (this *BcNftDb) HasDatabase() bool {
return (this._flags1_ & (uint64(1) << 5)) > 0
}
func (this *AdminDb) GetHost() string {
func (this *BcEventDb) GetHost() string {
return this.host
}
func (this *AdminDb) HasHost() bool {
func (this *BcEventDb) HasHost() bool {
return (this._flags1_ & (uint64(1) << 1)) > 0
}
func (this *AdminDb) GetPort() int32 {
func (this *BcEventDb) GetPort() int32 {
return this.port
}
func (this *AdminDb) HasPort() bool {
func (this *BcEventDb) HasPort() bool {
return (this._flags1_ & (uint64(1) << 2)) > 0
}
func (this *AdminDb) GetUser() string {
func (this *BcEventDb) GetUser() string {
return this.user
}
func (this *AdminDb) HasUser() bool {
func (this *BcEventDb) HasUser() bool {
return (this._flags1_ & (uint64(1) << 3)) > 0
}
func (this *AdminDb) GetPasswd() string {
func (this *BcEventDb) GetPasswd() string {
return this.passwd
}
func (this *AdminDb) HasPasswd() bool {
func (this *BcEventDb) HasPasswd() bool {
return (this._flags1_ & (uint64(1) << 4)) > 0
}
func (this *AdminDb) GetDatabase() string {
func (this *BcEventDb) GetDatabase() string {
return this.database
}
func (this *AdminDb) HasDatabase() bool {
func (this *BcEventDb) HasDatabase() bool {
return (this._flags1_ & (uint64(1) << 5)) > 0
}
@ -304,7 +304,7 @@ func (this *GameDb) LoadFromKv(kv map[string]interface{}) {
f5.ReadMetaTableField(&this.database, "database", &this._flags1_, 5, kv)
}
func (this *FriendDb) LoadFromKv(kv map[string]interface{}) {
func (this *BcNftDb) 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)
@ -312,7 +312,7 @@ func (this *FriendDb) LoadFromKv(kv map[string]interface{}) {
f5.ReadMetaTableField(&this.database, "database", &this._flags1_, 5, kv)
}
func (this *AdminDb) LoadFromKv(kv map[string]interface{}) {
func (this *BcEventDb) 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)

View File

@ -18,7 +18,7 @@ message GameDb
optional string database = 5;
}
message FriendDb
message BcNftDb
{
optional string host = 1;
optional int32 port = 2;
@ -27,7 +27,7 @@ message FriendDb
optional string database = 5;
}
message AdminDb
message BcEventDb
{
optional string host = 1;
optional int32 port = 2;