1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- //站内短信发送表
- var mongoose = require("./mongodb");
- var Schema = mongoose.Schema;
- var moment=require('moment');
- var msgSendSchema = new Schema({
- smsID:{type: String,default:''},//smsID
- sendName:{type: String,default:''},//发送人
- rcvName:[
- String
- ],//接收人
- title:{type: String,default:''},//发送标题
- content:{type: String,default:''},//发送消息
- time:{type: Date,default:Date.now},//发送时间
- cancelled:{type: Number,default:0},//是否撤销 默认0未撤销 ,1已撤销
- cancelTime:{type: Date},//撤销时间
- UPDATE_TIME:{type: Date,default:Date.now},//信息更新时间
- Deleted:{type: Number,default:0},//是否已删除
- },{
- strict: true,
- toObject: {
- virtuals: true
- },
- toJSON: {
- virtuals: true
- }
- }
- );
- msgSendSchema.virtual('time2').get(function () {
- if(this.time =="")//判断传入的参数
- {
- return "";
- };
- return moment(this.time).format('YYYY-MM-DD HH:mm:ss');
- });
- msgSendSchema.virtual('UPDATE_TIME2').get(function () {
- if(this.UPDATE_TIME =="")//判断传入的参数
- {
- return "";
- };
- return moment(this.UPDATE_TIME).format('YYYY-MM-DD HH:mm:ss');
- });
- var msgSend = mongoose.model('msgSend',
- msgSendSchema,'t_msgSend');
- module.exports = msgSend;
|