12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- 'use strict';
- const Controller = require('egg').Controller;
- const { CrudController } = require('naf-framework-mongoose/lib/controller');
- // 统计
- class CountController extends Controller {
- constructor(ctx) {
- super(ctx);
- this.service = this.ctx.service.count;
- }
- /**
- * 首页四部分统计
- */
- async index() {
- const res = await this.service.index(this.ctx.query);
- this.ctx.ok({ data: res });
- }
- /**
- * 下面的四个是首页四部分详情,带条件,至少传入 r_mobile
- */
- async yesterday() {
- const res = await this.service.yesterday(this.ctx.query, 'find');
- this.ctx.ok({ data: res });
- }
- async week() {
- const res = await this.service.week(this.ctx.query, 'find');
- this.ctx.ok({ data: res });
- }
- async month() {
- const res = await this.service.month(this.ctx.query, 'find');
- this.ctx.ok({ data: res });
- }
- async group() {
- const res = await this.service.group(this.ctx.query, 'find');
- this.ctx.ok({ data: res });
- }
- }
- module.exports = CrudController(CountController, {});
|