index.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. 'use strict';
  2. const Controller = require('egg').Controller;
  3. const { CrudController } = require('naf-framework-mongoose/lib/controller');
  4. // 首页-数据动态统计
  5. class IndexController extends Controller {
  6. constructor(ctx) {
  7. super(ctx);
  8. this.service = this.ctx.service.statistics.index;
  9. }
  10. async index() {
  11. const patent = await this.service.patent(this.ctx.query);
  12. const product = await this.service.product(this.ctx.query);
  13. const expert = await this.service.expert(this.ctx.query);
  14. const circle = await this.service.circle(this.ctx.query);
  15. this.ctx.ok({ data: { patent, product, expert, circle } });
  16. }
  17. /**
  18. * 首页专利统计
  19. */
  20. async patent() {
  21. const data = await this.service.patent(this.ctx.query);
  22. this.ctx.ok({ data });
  23. }
  24. /**
  25. * 首页成果统计
  26. */
  27. async product() {
  28. const data = await this.service.product(this.ctx.query);
  29. this.ctx.ok({ data });
  30. }
  31. /**
  32. * 首页成果统计
  33. */
  34. async expert() {
  35. const data = await this.service.expert(this.ctx.query);
  36. this.ctx.ok({ data });
  37. }
  38. /**
  39. * 首页数据统计
  40. */
  41. async circle() {
  42. const data = await this.service.circle(this.ctx.query);
  43. this.ctx.ok({ data });
  44. }
  45. }
  46. module.exports = CrudController(IndexController, {});