123456789101112131415161718192021222324252627282930313233343536373839404142 |
- 'use strict';
- module.exports = app => {
- const mongoose = app.mongoose;
- const Schema = mongoose.Schema;
- const conn = app.mongooseDB.get('etlLocalDB');
- // APP功能统计数据结构 本地清洗 数据结构
- const AppBehaviorRecordSchema = new Schema({
- create_date: { type: Number }, // 统计的数据是哪一天的
- year: { type: Number }, // 年 统计的数据
- month: { type: Number }, // 月 统计的数据
- day: { type: Number }, // 日 统计的数据
- dateString: { type: String }, // 时间字符串 yyyy-MM-dd
- start_time: { type: Date }, // 开始统计时间
- end_time: { type: Date, default: Date.now }, // 结束统计时间
- appBehavior: [// 功能时长统计
- {
- _id: { type: String }, // 分段
- behavior_name: { type: String }, // 功能名称
- duration: { type: Number }, // 时长ms
- count: { type: Number }, // 次数
- },
- ],
- remoteControl: [// 远控功能统计
- {
- _id: { behavior_id: { type: Number }, op: { type: String }, opType: { type: String }, closeType: { type: String },
- rc_execution_result: { type: String } }, // 分段
- count: { type: Number }, // 数量
- },
- ],
- remoteControlFailure: [
- {
- _id: { type: String }, // 分段
- count: { type: Number }, // 数量
- },
- ],
- });
- AppBehaviorRecordSchema.index({ create_date: -1 });
- return conn.model('AppBehaviorRecord', AppBehaviorRecordSchema, 'lc_app_behavior_record');
- };
|