This commit is contained in:
aozhiwei 2024-05-26 11:58:15 +08:00
parent 2985b24b41
commit 7745bbaf25
4 changed files with 14 additions and 1 deletions

View File

@ -6,3 +6,7 @@ import (
type App interface { type App interface {
Run(func(), func()) Run(func(), func())
} }
type RouterMgr interface {
}

View File

@ -12,11 +12,15 @@ var initOrders = []int32{
} }
var app common.App var app common.App
var routerMgr common.RouterMgr
func GetApp() common.App { func GetApp() common.App {
return app return app
} }
func GetRouter() common.RouterMgr {
return routerMgr
}
func RegModule(idx int32, m q5.Module) { func RegModule(idx int32, m q5.Module) {
fmt.Printf("RegModule module %d\n", idx) fmt.Printf("RegModule module %d\n", idx)
@ -26,6 +30,10 @@ func RegModule(idx int32, m q5.Module) {
{ {
app = m.(common.App) app = m.(common.App)
} }
case constant.ROUTER_MGR_MODULE_IDX:
{
routerMgr = m.(common.RouterMgr)
}
default: default:
{ {
panic("unknow module") panic("unknow module")

View File

@ -4,6 +4,7 @@ import (
_ "main/app" _ "main/app"
. "main/global" . "main/global"
_ "main/controller" _ "main/controller"
_ "main/router"
) )
func Init() { func Init() {

View File

@ -8,5 +8,5 @@ import (
var _routerMgr = new(routerMgr) var _routerMgr = new(routerMgr)
func init() { func init() {
global.RegModule(constant.ROUTER_MODULE_IDX, _routerMgr) global.RegModule(constant.ROUTER_MGR_MODULE_IDX, _routerMgr)
} }