import { ALL, Body, Get, Inject, Post, Provide, Query } from '@midwayjs/decorator';
|
import { CoolController, BaseController } from '@cool-midway/core';
|
import { Colletmeta } from '../../entity/colletmeta';
|
// import { ColletmetaService } from '../../service/';
|
import { DataController } from '../../../base/controller/dataController';
|
import { SocketHandler } from '../../../../../socket/socketHandle';
|
import { RpcService } from '../../../base/service/dataapi/rpcservice';
|
/**
|
* 监测元数据
|
*/
|
@Provide()
|
@CoolController({
|
api: ['add', 'delete', 'update', 'list', 'page', 'info'],
|
entity: Colletmeta,
|
// service: ColletmetaService,
|
})
|
export class ColletmetaController extends DataController {
|
// @Inject()
|
// colletmetaService: ColletmetaService;
|
|
|
@Inject()
|
socketHandler: SocketHandler
|
|
@Inject()
|
rpcService: RpcService
|
|
/**
|
* 接收设备监控消息
|
*/
|
@Post('/getDeviceMsg', { summary: '接收设备消息' })
|
async getDeviceMsg(@Query(ALL) params: any) {
|
this.dealMessage(params)
|
return this.ok();
|
}
|
|
/**
|
* 获得数据
|
*/
|
@Get('/getdata', { summary: '数据接口' })
|
async getData(@Query(ALL) params: any) {
|
return this.ok(await this.dataService.getData(params));
|
}
|
/**
|
* 获得数据
|
*/
|
@Get('/postdata', { summary: '数据接口' })
|
async postData(@Query(ALL) params: any) {
|
return this.ok(await this.dataService.getData(params));
|
}
|
|
|
async dealMessage(params: any) {
|
// this.socketHandler.connection
|
console.log(params);
|
}
|
|
}
|