home.controller.ts 2.9 KB

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