msgCenterRecordModel.js 1.2 KB

12345678910111213141516171819202122232425262728293031
  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. // 消息中心 本地清洗 数据结构
  7. const MsgCenterRecordSchema = 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. total: { type: Number }, // 当日总数
  16. colorTotal: { type: Number }, // 彩色
  17. grayTotal: { type: Number }, // 灰色
  18. readTotal: { type: Number }, // 已读
  19. unReadTotal: { type: Number }, // 未读
  20. msgType: [
  21. {
  22. _id: { type: Number }, // 类型
  23. count: { type: Number }, // 总数
  24. readCount: { type: Number }, // 查看数
  25. },
  26. ],
  27. });
  28. MsgCenterRecordSchema.index({ create_date: -1 });
  29. return conn.model('MsgCenterRecord', MsgCenterRecordSchema, 'lc_msg_center_record');
  30. };