wangrong
2022-06-28 0b31be01af4247244e1b6285d6c537c2894acea9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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);
  }
 
}