1234567891011121314151617181920212223242526 |
- 'use strict';
- const Controller = require('egg').Controller;
- // 车辆流量统计分析模块
- class CarFlowController extends Controller {
- // 车辆流量
- async index() {
- const { ctx, service } = this;
- // 校验参数 组装参数
- const payload = ctx.validate();
- // 调用 Service 进行业务处理
- if (ctx.isDev()) {
- const data = ctx.getData(payload, { value: [ 'total', 'successTotal', 'failTotal' ] });
- ctx.success({ data });
- } else {
- const data = await service.msgQueryRecordService.index(payload);
- // 设置响应内容和响应状态码
- ctx.success({ data });
- }
- }
- }
- module.exports = CarFlowController;
|