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