'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin'); const MoneyPlugin = require('naf-framework-mongoose-free/lib/model/type-money-plugin'); // 提现表 const cashOut = { customer: { type: String, required: false, zh: '申请人', ref: 'User.User' }, // apply_time: { type: String, required: true, zh: '申请时间' }, // apply_reason: { type: String, required: true, zh: '申请理由' }, // deal_person: { type: String, required: false, zh: '审核处理人', ref: 'User.Admin' }, // exam_time: { type: String, required: false, zh: '审核时间' }, // exam_reason: { type: String, required: false, zh: '审核理由' }, // card: { type: String, required: false, zh: '银行卡号' }, // status: { type: String, required: true, default: '0', zh: '审核状态' }, // 字典表:withdrawal_exam_status }; const schema = new Schema(cashOut, { toJSON: { getters: true, virtuals: true } }); schema.index({ id: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.index({ customer: 1 }); schema.index({ apply_time: 1 }); schema.index({ deal_person: 1 }); schema.index({ exam_time: 1 }); schema.index({ status: 1 }); schema.plugin(metaPlugin); schema.plugin(MoneyPlugin({ zh: '提现金额', required: true, key: 'money' })); module.exports = app => { const { mongoose } = app; return mongoose.model('CashOut', schema, 'cashOut'); };