'use strict'; module.exports = app => { const mongoose = app.mongoose; const Schema = mongoose.Schema; const conn = app.mongooseDB.get('etlAutoDB'); // TBOX自动测试 数据结构 const TBoxAutoTestingStatsSchema = new Schema({ _id: { type: String }, // request_id vin: { type: String }, // VIN号 serviceType: { type: String }, // applicationID messageType: { type: String }, // 消息类型 reqTime: { type: Date }, // 请求时间 resTime: { type: Date }, // 回复时间 reqSource: { type: String }, // 请求服务名:fawiovvgdebug是运维平台的 source: { type: Number }, // 协议命令源 authToken: { type: Number }, // 协议 请求令牌 items: { type: Array }, // 命令参数 vgCode: { type: Object }, // vg 命令参数 reqSourceType: { type: String }, // 协议 请求端类型 0:调试系统1:管理员 Portal2:用户 Portal3:手机 APP result: { type: String }, // 执行结果 resultDesc: { type: String }, // 失败原因 testFlag: { type: String }, // 测试标识 isRecive: { type: String }, // 是否回复应用端 1:回复 0:不回复 iccid: { type: String }, // iccid productId: { type: String }, // 产品id relevancyId: { type: String }, // 流程绑定id vehicleSeries: { type: String }, // 车系 errorCode: { type: String }, // 异常编码 repeatNum: { type: Number }, // 重试次数 }); TBoxAutoTestingStatsSchema.index({ reqTime: -1, reqSource: -1 }); TBoxAutoTestingStatsSchema.index({ reqTime: -1, reqSource: -1, relevancyId: -1, serviceType: -1 }); return conn.model('TBoxAutoTestingStats', TBoxAutoTestingStatsSchema, 'rcCommand'); };