integrate core codes
This commit is contained in:
+16
-2
@@ -3,6 +3,7 @@ package app
|
||||
import (
|
||||
"log"
|
||||
"s-ui/config"
|
||||
"s-ui/core"
|
||||
"s-ui/cronjob"
|
||||
"s-ui/database"
|
||||
"s-ui/logger"
|
||||
@@ -18,6 +19,8 @@ type APP struct {
|
||||
webServer *web.Server
|
||||
subServer *sub.Server
|
||||
cronJob *cronjob.CronJob
|
||||
logger *logging.Logger
|
||||
core *core.Core
|
||||
}
|
||||
|
||||
func NewApp() *APP {
|
||||
@@ -34,11 +37,13 @@ func (a *APP) Init() error {
|
||||
return err
|
||||
}
|
||||
|
||||
a.cronJob = cronjob.NewCronJob()
|
||||
a.core = core.NewCore()
|
||||
|
||||
a.cronJob = cronjob.NewCronJob(a.core)
|
||||
a.webServer = web.NewServer()
|
||||
a.subServer = sub.NewServer()
|
||||
|
||||
configService := service.NewConfigService()
|
||||
configService := service.NewConfigService(a.core)
|
||||
err = configService.InitConfig()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -72,6 +77,11 @@ func (a *APP) Start() error {
|
||||
return err
|
||||
}
|
||||
|
||||
err = a.core.Start()
|
||||
if err != nil {
|
||||
logger.Error(err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -106,3 +116,7 @@ func (a *APP) RestartApp() {
|
||||
a.Stop()
|
||||
a.Start()
|
||||
}
|
||||
|
||||
func (a *APP) GetCore() *core.Core {
|
||||
return a.core
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user