'use strict'; module.exports = app => { const mongoose = app.mongoose; const Schema = mongoose.Schema; const conn = app.mongooseDB.get('etlDB'); // 用于消息中心统计分析 const MsgCenterRecordSchema = new Schema({ _id: { type: String }, // 主键 message_channel: { type: Number }, // 消息渠道1灰色 2彩色 message_type: { type: Number }, // 消息类型 reading_state: { type: Number }, // 消息已读1,未读0 create_time: { type: Number }, // 消息推送时间 }); MsgCenterRecordSchema.index({ create_time: -1 }); MsgCenterRecordSchema.index({ create_time: -1, message_channel: -1 }); MsgCenterRecordSchema.index({ create_time: -1, reading_state: -1 }); MsgCenterRecordSchema.index({ create_time: -1, message_type: -1, reading_state: -1 }); return conn.model('MsgCenterRecord', MsgCenterRecordSchema, 'msg_center_record'); };