home.controller.ts 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import { Config, Controller, Get, Inject, Query } from '@midwayjs/core';
  2. import { InitTwoService } from '../service/initData/initTwo.service';
  3. import { InitRegionService } from '../service/initData/initRegion.service';
  4. import { InitOneService } from '../service/initData/initOne.service';
  5. import { QichachaService } from '../service/thirdParty/qichacha.service';
  6. import { InitThreeService } from '../service/initData/initThree.service';
  7. import { DataDealService } from '../service/initData/dataDeal.service';
  8. import { TestsService } from '../service/tests.service';
  9. import { Opera } from '../frame/dbOpera';
  10. import { Client, estypes } from '@elastic/elasticsearch';
  11. @Controller('/')
  12. export class HomeController {
  13. @Inject()
  14. threeService: InitThreeService;
  15. @Inject()
  16. twoService: InitTwoService;
  17. @Inject()
  18. oneService: InitOneService;
  19. @Inject()
  20. regionService: InitRegionService;
  21. @Inject()
  22. qichachaService: QichachaService;
  23. @Inject()
  24. dataDealService: DataDealService;
  25. @Inject()
  26. testService: TestsService;
  27. @Get('/')
  28. async home(@Query() query: object): Promise<any> {
  29. // await this.dataDealService.initUserMenus();
  30. // await this.dataDealService.initRoleMenus();
  31. // await this.oneService.addTags();
  32. // await this.oneService.addImportDataTags();
  33. // await this.twoService.addTags();
  34. // await this.twoService.addImportDataTags();
  35. // await this.oneService.dataToUse();
  36. // await this.twoService.dataToUse();
  37. // await this.threeService.dataToUse();
  38. // const data = await this.qichachaService.searchByName('长春市福瑞科技');
  39. // await this.threeService.import2021Company();
  40. // await this.threeService.import2024Company();
  41. // await this.threeService.importMatching();
  42. // await this.dataDealService.JsonbAddDefault();
  43. // const sq = {
  44. // // time: ['2024-01-01', '2025-01-01'],
  45. // // nick_name: '2024',
  46. // // account: '2024',
  47. // // age: [40, 10],
  48. // // data_owner: '',
  49. // // tags: '黑奴'
  50. // };
  51. // const operas = {
  52. // id: Opera.Not,
  53. // time: Opera.Between,
  54. // nick_name: Opera.ILikeRight,
  55. // account: Opera.LikeRight,
  56. // age: Opera.In,
  57. // data_owner: Opera.IsNotNull,
  58. // tags: Opera.Json,
  59. // };
  60. // const res = await this.testService.query(sq, null, operas);
  61. // const body = {
  62. // nick_name: '测试20240806_1',
  63. // account: '测试20240806_1',
  64. // age: 20,
  65. // hobby: ['上班'],
  66. // time: '2024-09-01',
  67. // tags: ['黑奴'],
  68. // };
  69. // const res = await this.testService.create(body);
  70. // const id = 9;
  71. // const res = await this.testService.update({ id }, { age: 21 });
  72. // const res = await this.testService.fetch({ id });
  73. // const res = await this.testService.delete({ id });
  74. // return res;
  75. return 'starting...';
  76. }
  77. // @Get('/:method')
  78. // async test(@Param('method') method: string, @Query() query: object) {
  79. // const result: any = await this.adminService[method](query);
  80. // return result;
  81. // }
  82. }