'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin'); // 提现申请 const billApply = { school_id: { type: String, required: false, zh: '学校id', ref: 'School', getProp: [ 'name' ] }, // coach_id: { type: String, required: false, zh: '教练id', ref: 'Coach', getProp: [ 'name' ] }, // salary: { type: Number, required: false, zh: '提现金额' }, // reason: { type: String, required: false, zh: '原因' }, // result: { type: String, required: false, default: '0', zh: '审核结果' }, // 0:未审核;1审核成功;2:审核失败 }; const schema = new Schema(billApply, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.index({ school_id: 1 }); schema.index({ coach_id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('BillApply', schema, 'billApply'); };