'use strict'; const Controller = require('egg').Controller; // APP用户总数统计分析模块 class AppUserController extends Controller { // app用户总数 async index() { const { ctx, service } = this; // 校验参数 组装参数 const payload = ctx.validate(); // 调用 Service 进行业务处理 if (ctx.isDev()) { const data = ctx.getData(payload); ctx.success({ data }); } else { const data = await service.tRbacUserService.index(payload, 'appTotal'); // 设置响应内容和响应状态码 ctx.success({ data }); } } // app用户位置分布 async location() { const { ctx, service } = this; // 调用 Service 进行业务处理 if (ctx.isDev()) { const data = ctx.getArea(); ctx.success({ data }); } else { const data = await service.onlineUserService2.place('appLocation'); // 设置响应内容和响应状态码 ctx.success({ data }); } } // app车主性别和年龄 async sexAndAge() { const { ctx, service } = this; // 调用 Service 进行业务处理 if (ctx.isDev()) { const data = ctx.getSex2Age(); ctx.success({ data }); } else { const data = await service.tRbacUserService.sexAndAge('appSexAndAgeTotal'); // 设置响应内容和响应状态码 ctx.success({ data }); } } } module.exports = AppUserController;