'use strict'; const Schema = require('mongoose').Schema; const moment = require('moment'); const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); // 提现表 const cash = { account: { type: String }, // 账户 name: { type: String, required: true }, // 用户名 mobile: { type: String, required: true }, // 手机号 b_point: { type: Number }, // 提现前积分 i_point: { type: Number }, // 本次提现积分 e_point: { type: Number }, // 剩余积分 remark: { type: String, maxLength: 200 }, create_time: { type: String, default: moment().format('YYYY-MM-DD HH:mm:ss'), }, }; const schema = new Schema(cash, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Cash', schema, 'cash'); };