msgCenterRecordModel.js 893 B

123456789101112131415161718192021
  1. 'use strict';
  2. module.exports = app => {
  3. const mongoose = app.mongoose;
  4. const Schema = mongoose.Schema;
  5. const conn = app.mongooseDB.get('etlDB');
  6. // 用于消息中心统计分析
  7. const MsgCenterRecordSchema = new Schema({
  8. _id: { type: String }, // 主键
  9. message_channel: { type: Number }, // 消息渠道1灰色 2彩色
  10. message_type: { type: Number }, // 消息类型
  11. reading_state: { type: Number }, // 消息已读1,未读0
  12. create_time: { type: Number }, // 消息推送时间
  13. });
  14. MsgCenterRecordSchema.index({ create_time: -1 });
  15. MsgCenterRecordSchema.index({ create_time: -1, message_channel: -1 });
  16. MsgCenterRecordSchema.index({ create_time: -1, reading_state: -1 });
  17. MsgCenterRecordSchema.index({ create_time: -1, message_type: -1, reading_state: -1 });
  18. return conn.model('MsgCenterRecord', MsgCenterRecordSchema, 'msg_center_record');
  19. };