/**
 * 消息业务逻辑
 *
 * @author CaiAoLin
 * @date 2017/9/21
 * @version
 */
const BaseModel = require('../../common/base/base_model');
const mongoose = require('mongoose');

class MessageModel extends BaseModel {


    /**
     * 构造函数
     *
     * @return {void}
     */
    constructor() {
        let parent = super();
        parent.model = mongoose.model('message');
        parent.init();
    }

    /**
     * 获取对应时间点之后的数据
     *
     * @param {Number} lastTime
     * @return {Promise}
     */
    async getListByTime(lastTime) {
        let messageList = await this.findDataByCondition({release_time: {'$gte': lastTime}, message_type: 1, status: 1},
            null, false);
        return messageList;
    }


}

module.exports = MessageModel;