优化结构
This commit is contained in:
@@ -4,8 +4,7 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
systemmodule "kra/app/system/internal/module"
|
||||
systemserver "kra/app/system/internal/server"
|
||||
systemrouter "kra/app/system/internal/server/router"
|
||||
systemworker "kra/app/system/internal/worker"
|
||||
"kra/pkg/module"
|
||||
platformtask "kra/pkg/task"
|
||||
@@ -15,7 +14,7 @@ import (
|
||||
// module means adding one Definition here; system initialization and runtime
|
||||
// code consume the catalog without knowing that module's implementation.
|
||||
func Catalog() module.Catalog {
|
||||
return module.Catalog{Definitions: []module.Definition{systemmodule.Definition()}}
|
||||
return module.Catalog{Definitions: []module.Definition{Definition()}}
|
||||
}
|
||||
|
||||
// TaskRegistry builds the process-wide registry from dependency-free module
|
||||
@@ -28,7 +27,7 @@ func TaskRegistry(catalog module.Catalog) *platformtask.Registry {
|
||||
}
|
||||
|
||||
// Runtime composes HTTP route contributors from the enabled modules.
|
||||
func Runtime(systemRoutes *systemserver.Routes, systemTasks *systemworker.TaskMethods, registry *platformtask.Registry) *module.Runtime {
|
||||
func Runtime(systemRoutes *systemrouter.Routes, systemTasks *systemworker.TaskMethods, registry *platformtask.Registry) *module.Runtime {
|
||||
platformtask.Apply(registry, systemTasks)
|
||||
return module.NewRuntime(systemRoutes)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
datapayment "kra/app/system/internal/data/payment"
|
||||
datasystem "kra/app/system/internal/data/repository"
|
||||
"kra/pkg/module"
|
||||
)
|
||||
|
||||
// Definition describes the built-in system contribution to the application
|
||||
// catalog. Other business modules can expose the same shape independently.
|
||||
func Definition() module.Definition {
|
||||
return module.Definition{
|
||||
Name: "system",
|
||||
Migrations: append(datasystem.Migrations(), datapayment.Migrations()...),
|
||||
Surface: datapayment.AdminSurface(),
|
||||
TimedTasks: []module.TimedTask{
|
||||
{Name: "ClearDB", Description: "定时清理数据库过期日志(操作记录/JWT黑名单/定时任务执行日志)", Spec: "@daily", MethodName: "ClearDB", Enabled: true},
|
||||
{Name: "CleanStaleUploads", Description: "定时清理过期大文件上传会话", Spec: "@hourly", MethodName: "CleanStaleUploads", Enabled: true},
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user