'use strict'; const Controller = require('egg').Controller; const { CrudController } = require('naf-framework-mongoose/lib/controller'); // 首页-数据动态统计 class IndexController extends Controller { constructor(ctx) { super(ctx); this.service = this.ctx.service.statistics.index; } async index() { const patent = await this.service.patent(this.ctx.query); const product = await this.service.product(this.ctx.query); const expert = await this.service.expert(this.ctx.query); const circle = await this.service.circle(this.ctx.query); this.ctx.ok({ data: { patent, product, expert, circle } }); } /** * 首页专利统计 */ async patent() { const data = await this.service.patent(this.ctx.query); this.ctx.ok({ data }); } /** * 首页成果统计 */ async product() { const data = await this.service.product(this.ctx.query); this.ctx.ok({ data }); } /** * 首页成果统计 */ async expert() { const data = await this.service.expert(this.ctx.query); this.ctx.ok({ data }); } /** * 首页数据统计 */ async circle() { const data = await this.service.circle(this.ctx.query); this.ctx.ok({ data }); } async dockIndex() { const res = await this.service.dockIndex(this.ctx.query); this.ctx.ok({ data: res }); } } module.exports = CrudController(IndexController, {});