修改domain包

This commit is contained in:
2025-11-05 21:40:19 +08:00
parent 203be4307d
commit 07d8c719ac
28 changed files with 943 additions and 793 deletions

View File

@@ -57,8 +57,8 @@ func NewApplication(configPath string) (*Application, error) {
appServices.deviceService,
appServices.planService,
appServices.userService,
infra.tokenService,
appServices.auditService,
infra.tokenGenerator,
infra.lora.listenHandler,
)
@@ -91,7 +91,7 @@ func (app *Application) Start() error {
}
// 3. 启动后台工作协程
app.Domain.planService.Start()
app.Domain.planService.Start(startCtx)
// 4. 启动 API 服务器
app.API.Start()
@@ -107,14 +107,14 @@ func (app *Application) Start() error {
// Stop 优雅地关闭应用的所有组件。
func (app *Application) Stop() error {
logger := logs.TraceLogger(app.Ctx, app.Ctx, "Stop")
stopCtx, logger := logs.Trace(app.Ctx, app.Ctx, "Stop")
logger.Info("应用关闭中...")
// 关闭 API 服务器
app.API.Stop()
// 关闭任务执行器
app.Domain.planService.Stop()
app.Domain.planService.Stop(stopCtx)
// 断开数据库连接
if err := app.Infra.storage.Disconnect(); err != nil {