chore: opt settings code

This commit is contained in:
engigu
2025-12-21 10:23:25 +08:00
parent 432c57e862
commit c06030fe27
28 changed files with 535 additions and 187 deletions
+5 -4
View File
@@ -8,9 +8,10 @@ import (
var cronService *services.CronService
func RegisterControllers() (*Controllers, *services.SettingsService) {
func RegisterControllers() *Controllers {
// Initialize services
settingsService := services.NewSettingsService()
loginLogService := services.NewLoginLogService()
// 执行系统初始化(返回 userService
initService := services.NewInitService(settingsService)
@@ -28,7 +29,7 @@ func RegisterControllers() (*Controllers, *services.SettingsService) {
// Initialize and return controllers
return &Controllers{
Task: controllers.NewTaskController(taskService, cronService),
Auth: controllers.NewAuthController(userService, settingsService),
Auth: controllers.NewAuthController(userService, settingsService, loginLogService),
Env: controllers.NewEnvController(envService),
Script: controllers.NewScriptController(scriptService),
Executor: controllers.NewExecutorController(executorService),
@@ -36,8 +37,8 @@ func RegisterControllers() (*Controllers, *services.SettingsService) {
Dashboard: controllers.NewDashboardController(cronService, executorService),
Log: controllers.NewLogController(),
Terminal: controllers.NewTerminalController(),
Settings: controllers.NewSettingsController(userService),
}, settingsService
Settings: controllers.NewSettingsController(userService, loginLogService),
}
}
// StopCron stops the cron service gracefully