1234567891011121314151617181920212223242526272829303132 |
- 'use strict';
- module.exports = app => {
- const mongoose = app.mongoose;
- const Schema = mongoose.Schema;
- const conn = app.mongooseDB.get('etlDB');
- // APP功能统计数据结构 按日为维度提供单个用户单个行为以及对应行为使用时长元数据
- const AppBehaviorRecordSchema = new Schema({
- _id: { type: String }, // 日月年+序列号
- user_id: { type: String }, //
- parent_behavior_id: { type: Number }, // 一级功能行为id
- parent_name: { type: String }, // 一级功能行为描述
- behavior_id: { type: Number }, // 行为ID,APP功能
- use_duration: { type: Number }, // 当日单个功能使用时长 (单位:ms, 精度:1)
- create_time: { type: Number }, // 行为发生时间
- rc_execution_result: { type: String }, // (远控制)功能执行结果:
- // 成功/失败 FAILED/SUCCEED/true/false
- op: { type: String }, // (远控制)指令类型:解锁/上锁、启动/熄火、开启/关闭
- // OPEN/LOCK/UNLOCK/CLOSE
- op_type: { type: String },
- closeType: { type: String },
- rc_fail_type: { type: String }, // (远控制)失败类型 错误、车辆处于本地模式、车辆远程认证不匹配、tbox自身系统故障、动力系统启动失败
- // VEH.HMI.0198/VEH.HMI.0199(具体定义是什么需要问APP)
- });
- AppBehaviorRecordSchema.index({ create_time: -1 });
- AppBehaviorRecordSchema.index({ create_time: -1, parent_behavior_id: -1 });
- AppBehaviorRecordSchema.index({ create_time: -1, parent_behavior_id: -1, rc_execution_result: -1 });
- AppBehaviorRecordSchema.index({ create_time: -1, parent_behavior_id: -1, rc_execution_result: -1, rc_fail_type: -1 });
- AppBehaviorRecordSchema.index({ create_time: -1, user_id: -1 });
- return conn.model('AppBehaviorRecord', AppBehaviorRecordSchema, 'app_behavior_record');
- };
|