初步实现device_controller

This commit is contained in:
2025-09-12 17:18:14 +08:00
parent 4a78aa1c20
commit fe9b0db985
5 changed files with 273 additions and 24 deletions

View File

@@ -46,16 +46,19 @@ func NewApplication(configPath string) (*Application, error) {
// 4. 初始化任务执行器
executor := task.NewExecutor(cfg.Heartbeat.Concurrency, logger)
// 5. 初始化用户仓库
userRepo := repository.NewGormUserRepository(storage.GetDB())
// 6. 初始化 Token 服务
// 5. 初始化 Token 服务
tokenService := token.NewTokenService([]byte(cfg.App.JWTSecret))
// 7. 初始化 API 服务器
apiServer := api.NewAPI(cfg.Server, logger, userRepo, tokenService)
// 6. 初始化用户仓库
userRepo := repository.NewGormUserRepository(storage.GetDB())
// 8. 组装 Application 对象
// 7. 初始化设备仓库
deviceRepo := repository.NewGormDeviceRepository(storage.GetDB())
// 8. 初始化 API 服务器
apiServer := api.NewAPI(cfg.Server, logger, userRepo, deviceRepo, tokenService)
// 9. 组装 Application 对象
app := &Application{
Config: cfg,
Logger: logger,