1.注册饲喂计划相关路由
2. 实现create接口
This commit is contained in:
@@ -40,6 +40,9 @@ type Application struct {
|
||||
// DeviceRepo 设备仓库实例
|
||||
DeviceRepo repository.DeviceRepo
|
||||
|
||||
// FeedPlanRepo 投喂计划仓库实例
|
||||
FeedPlanRepo repository.FeedPlanRepo
|
||||
|
||||
// WebsocketManager WebSocket管理器
|
||||
WebsocketManager *websocket.Manager
|
||||
|
||||
@@ -97,6 +100,8 @@ func (app *Application) Start() error {
|
||||
// 初始化设备仓库
|
||||
app.DeviceRepo = repository.NewDeviceRepo(app.Storage.GetDB())
|
||||
|
||||
app.FeedPlanRepo = repository.NewFeedPlanRepo(app.Storage.GetDB())
|
||||
|
||||
// 初始化设备状态池
|
||||
app.DeviceStatusPool = service.NewDeviceStatusPool()
|
||||
|
||||
@@ -109,7 +114,16 @@ func (app *Application) Start() error {
|
||||
app.HeartbeatService = service.NewHeartbeatService(app.WebsocketManager, app.DeviceStatusPool, app.DeviceRepo, app.Config)
|
||||
|
||||
// 初始化API组件
|
||||
app.API = api.NewAPI(app.Config, app.UserRepo, app.OperationHistoryRepo, app.DeviceControlRepo, app.DeviceRepo, app.WebsocketManager, app.HeartbeatService, app.DeviceStatusPool)
|
||||
app.API = api.NewAPI(app.Config,
|
||||
app.UserRepo,
|
||||
app.OperationHistoryRepo,
|
||||
app.DeviceControlRepo,
|
||||
app.DeviceRepo,
|
||||
app.FeedPlanRepo,
|
||||
app.WebsocketManager,
|
||||
app.HeartbeatService,
|
||||
app.DeviceStatusPool,
|
||||
)
|
||||
|
||||
// 初始化任务执行器组件(使用5个工作协程)
|
||||
app.TaskExecutor = task.NewExecutor(5)
|
||||
|
||||
Reference in New Issue
Block a user