| | |
| | | import { Taskmonitor } from '../../entity/taskmonitor'; |
| | | // import { TaskmonitorService } from '../../service/taskmonitor'; |
| | | import { DataController } from '../../../base/controller/dataController'; |
| | | import { SocketHandler } from '../../../../../socket/socketHandle'; |
| | | import { RpcService } from '../../../base/service/dataapi/rpcservice'; |
| | | /** |
| | | * 监测任务 |
| | | */ |
| | |
| | | @CoolController({ |
| | | api: ['add', 'delete', 'update', 'list', 'page', 'info'], |
| | | entity: Taskmonitor, |
| | | service: RpcService, |
| | | // service: TaskmonitorService, |
| | | }) |
| | | export class TaskmonitorController extends DataController { |
| | | // @Inject() |
| | | // taskmonitorService: TaskmonitorService; |
| | | |
| | | @Inject() |
| | | socketHandler: SocketHandler |
| | | |
| | | @Inject() |
| | | rpcService: RpcService |
| | | |
| | | |
| | | |
| | | /** |
| | | * 任务下发 |
| | | */ |
| | | @Get('/add', { summary: '下发任务' }) |
| | | async add(@Query(ALL) params: any) { // 这个io对象对应 SocketHandler的命名空间 |
| | | // this.socketHandler.connection |
| | | this.socketHandler.clients.get("").emit('device is offline'); |
| | | this.rpcService.remoteCall(null,""); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 获得数据 |
| | | */ |
| | | @Get('/getdata', { summary: '数据接口' }) |
| | | async getData(@Query(ALL) params: any) { |
| | | async getData(@Query(ALL) params: any) { // 这个io对象对应 SocketHandler的命名空间 |
| | | // this.socketHandler.connection |
| | | this.socketHandler.clients.get("").emit('device is offline'); |
| | | return this.ok(await this.dataService.getData(params)); |
| | | } |
| | | /** |
| | |
| | | async postData(@Query(ALL) params: any) { |
| | | return this.ok(await this.dataService.getData(params)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |