12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- 'use strict';
- const Controller = require('egg').Controller;
- // ivi活跃用户总数统计分析模块
- class IviActiveUserController extends Controller {
- // ivi活跃用户总数
- async index() {
- const { ctx, service } = this;
- // 校验参数 组装参数
- const payload = ctx.validate();
- // 调用 Service 进行业务处理
- let data = '';
- switch (payload.type) {
- case '0':
- data = await service.tRbacUserService.index(payload, 'activeIviTotal');
- break;
- case '1':
- data = await service.tRbacUserService.index(payload, 'activeIviMonth');
- break;
- case '2':
- data = await service.tRbacUserService.index(payload, 'activeIviYear');
- break;
- default:
- break;
- }
- // 设置响应内容和响应状态码
- ctx.success({ data });
- }
- // ivi活跃用户位置分布
- async location() {
- const { ctx, service } = this;
- // 调用 Service 进行业务处理
- const data = await service.onlineUserService2.place('iviActiveLocation');
- // 设置响应内容和响应状态码
- ctx.success({ data });
- }
- // ivi活跃用户性别和年龄
- async sexAndAge() {
- const { ctx, service } = this;
- // 调用 Service 进行业务处理
- const data = await service.tRbacUserService.sexAndAge('activeIviSexAndAgeTotal');
- // 设置响应内容和响应状态码
- ctx.success({ data });
- }
- }
- module.exports = IviActiveUserController;
|