'use strict'; const Controller = require('egg').Controller; // 车辆内饰硬件统计分析模块 class VehicleHardwareController2 extends Controller { // 驾驶行为 基础 async index() { const { ctx, service } = this; // 校验参数 组装参数 const payload = ctx.validate(); // // 调用 Service 进行业务处理 const data = await service.drivingBehaviorInfoService2.index(payload, this.ctx.params.id); // // 设置响应内容和响应状态码 ctx.success({ data }); } // 驾驶行为 月年 async mixMY() { const { ctx, service } = this; // 校验参数 组装参数 const payload = ctx.validate(); // // 调用 Service 进行业务处理 let key = this.ctx.params.id; switch (payload.type) { case '1': key += 'Month'; break; case '2': key += 'Year'; break; default: break; } const data = await service.drivingBehaviorInfoService2.mixMY(payload, key); // // 设置响应内容和响应状态码 ctx.success({ data }); } // 驾驶行为 空调 async air() { const { ctx, service } = this; // 校验参数 组装参数 const payload = ctx.validate(); // // 调用 Service 进行业务处理 const data = await service.drivingBehaviorInfoService2.air(payload); // // 设置响应内容和响应状态码 ctx.success({ data }); } // 驾驶行为 平均值 async count() { const { ctx, service } = this; // 校验参数 组装参数 const payload = ctx.validate(); // // 调用 Service 进行业务处理 const data = await service.drivingBehaviorInfoService2.count(payload, this.ctx.params.id); // // 设置响应内容和响应状态码 ctx.success({ data }); } } module.exports = VehicleHardwareController2;