This commit is contained in:
azw 2023-08-20 18:27:30 +08:00
parent 9f27cb56e5
commit 737fb96c95
6 changed files with 40 additions and 4 deletions

View File

@ -19,6 +19,7 @@ func (this *App) GetPkgName() string {
func (this *App) Init() {
this.netMsgQueue.Init()
f5.LoadMetaTable(mt.Table)
this.registerDataSources()
handlerMgr.init()
playerMgr.init()
@ -71,3 +72,23 @@ func (this *App) addNetMsg(hdr *f5.MsgHdr) {
this.netMsgQueue.Push(&hdr.Entry)
f5.GetApp().NotifyLoopCond()
}
func (this *App) registerDataSources() {
f5.GetGoStyleDb().RegisterDataSource(
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(
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)
}

View File

@ -9,3 +9,8 @@ const (
const (
MAX_PACKET_LEN = 1024 * 64
)
const (
GAME_DB = "gamedb"
FRIEND_DB = "firenddb"
)

View File

@ -15,12 +15,12 @@ type table struct {
var Table = f5.New(func (this* table) {
this.IMCluster = f5.New(func (this *IMClusterTable) {
this.FileName = "../config/imserver.cluster.json"
this.PrimKey = ""
this.PrimKey = "instance_id"
});
this.MasterCluster = f5.New(func (this *MasterClusterTable) {
this.FileName = "../config/master.cluster.json"
this.PrimKey = ""
this.PrimKey = "instance_id"
});
this.GameDb = f5.New(func (this *GameDbTable) {

View File

@ -53,6 +53,16 @@ func (this *PlayerMgr) init() {
} else {
f5.GetSysLog().Info("mysql error:%s\n", err)
}
{
f5.GetJsStyleDb().OrmSelectOne(
GAME_DB,
"t_user",
[][]string{
[]string{"account_id", "100"}},
func (err error, row *[]*string) {
fmt.Println(row)
})
}
}
func (this *PlayerMgr) unInit() {

2
third_party/f5 vendored

@ -1 +1 @@
Subproject commit 096c5046c962a4bcc5873aa5b539a0900e3cf4bd
Subproject commit 7dd2331f6c8bc39fdc33471a24dd49ebedc13023

2
third_party/q5 vendored

@ -1 +1 @@
Subproject commit aecf26a45c74547bb724f59653331dcc34f16974
Subproject commit 8716d301c6d364a3fb8bdf324e4cf7e4cd8c4bda