任务2.5

This commit is contained in:
2025-10-31 16:49:35 +08:00
parent 4e87436cc0
commit bc6a960451
7 changed files with 301 additions and 133 deletions

View File

@@ -27,7 +27,6 @@ import (
"git.huangwc.com/pig/pig-farm-controller/internal/app/service"
"git.huangwc.com/pig/pig-farm-controller/internal/app/webhook"
"git.huangwc.com/pig/pig-farm-controller/internal/domain/audit"
domain_notify "git.huangwc.com/pig/pig-farm-controller/internal/domain/notify"
"git.huangwc.com/pig/pig-farm-controller/internal/domain/scheduler"
"git.huangwc.com/pig/pig-farm-controller/internal/domain/token"
"git.huangwc.com/pig/pig-farm-controller/internal/infra/config"
@@ -67,9 +66,9 @@ func NewAPI(cfg config.ServerConfig,
monitorService service.MonitorService,
deviceService service.DeviceService,
planService service.PlanService,
userService service.UserService,
tokenService token.Service,
auditService audit.Service,
notifyService domain_notify.Service,
listenHandler webhook.ListenHandler,
) *API {
// 使用 echo.New() 创建一个 Echo 引擎实例
@@ -92,7 +91,7 @@ func NewAPI(cfg config.ServerConfig,
config: cfg,
listenHandler: listenHandler,
// 在 NewAPI 中初始化用户控制器,并将其作为 API 结构体的成员
userController: user.NewController(userRepo, monitorService, logger, tokenService, notifyService),
userController: user.NewController(userService, logger),
// 在 NewAPI 中初始化设备控制器,并将其作为 API 结构体的成员
deviceController: device.NewController(deviceService, logger),
// 在 NewAPI 中初始化计划控制器,并将其作为 API 结构体的成员