'use strict'; const Controller = require('egg').Controller; const { CrudController } = require('naf-framework-mongoose/lib/controller'); // 首页-数据动态统计 class StatisticsController extends Controller { constructor(ctx) { super(ctx); this.service = this.ctx.service.statistics; } async index() { const patent = await this.service.patent(this.ctx.query); const product = await this.service.product(this.ctx.query); const users = await this.service.users(this.ctx.query); const data = await this.service.data(this.ctx.query); this.ctx.ok({ data: { patent, product, users, data } }); } /** * 首页专利统计 */ 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 users() { const data = await this.service.users(this.ctx.query); this.ctx.ok({ data }); } /** * 首页数据统计 */ async data() { const data = await this.service.data(this.ctx.query); this.ctx.ok({ data }); } /** * 创新券统计 */ async ticket() { const data = await this.service.ticket(this.ctx.query); this.ctx.ok({ data }); } } module.exports = CrudController(StatisticsController, {});