appBehaviorRecordModel.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. 'use strict';
  2. module.exports = app => {
  3. const mongoose = app.mongoose;
  4. const Schema = mongoose.Schema;
  5. const conn = app.mongooseDB.get('etlLocalDB');
  6. // APP功能统计数据结构 本地清洗 数据结构
  7. const AppBehaviorRecordSchema = new Schema({
  8. create_date: { type: Number }, // 统计的数据是哪一天的
  9. year: { type: Number }, // 年 统计的数据
  10. month: { type: Number }, // 月 统计的数据
  11. day: { type: Number }, // 日 统计的数据
  12. dateString: { type: String }, // 时间字符串 yyyy-MM-dd
  13. start_time: { type: Date }, // 开始统计时间
  14. end_time: { type: Date, default: Date.now }, // 结束统计时间
  15. appBehavior: [// 功能时长统计
  16. {
  17. _id: { type: String }, // 分段
  18. behavior_name: { type: String }, // 功能名称
  19. duration: { type: Number }, // 时长ms
  20. count: { type: Number }, // 次数
  21. },
  22. ],
  23. remoteControl: [// 远控功能统计
  24. {
  25. _id: { behavior_id: { type: Number }, op: { type: String }, opType: { type: String }, closeType: { type: String },
  26. rc_execution_result: { type: String } }, // 分段
  27. count: { type: Number }, // 数量
  28. },
  29. ],
  30. remoteControlFailure: [
  31. {
  32. _id: { type: String }, // 分段
  33. count: { type: Number }, // 数量
  34. },
  35. ],
  36. });
  37. AppBehaviorRecordSchema.index({ create_date: -1 });
  38. return conn.model('AppBehaviorRecord', AppBehaviorRecordSchema, 'lc_app_behavior_record');
  39. };