cashOut.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
  4. const MoneyPlugin = require('naf-framework-mongoose-free/lib/model/type-money-plugin');
  5. // 提现表
  6. const cashOut = {
  7. customer: { type: String, required: false, zh: '申请人', ref: 'User.User' }, //
  8. apply_time: { type: String, required: true, zh: '申请时间' }, //
  9. apply_reason: { type: String, required: true, zh: '申请理由' }, //
  10. deal_person: { type: String, required: false, zh: '审核处理人', ref: 'User.Admin' }, //
  11. exam_time: { type: String, required: false, zh: '审核时间' }, //
  12. exam_reason: { type: String, required: false, zh: '审核理由' }, //
  13. card: { type: String, required: false, zh: '银行卡号' }, //
  14. card_name: { type: String, required: false, zh: '银行卡所属' }, //
  15. card_bank: { type: String, required: false, zh: '所属银行' }, //
  16. status: { type: String, required: true, default: '0', zh: '审核状态' }, // 字典表:withdrawal_exam_status
  17. };
  18. const schema = new Schema(cashOut, { toJSON: { getters: true, virtuals: true } });
  19. schema.index({ id: 1 });
  20. schema.index({ 'meta.createdAt': 1 });
  21. schema.index({ customer: 1 });
  22. schema.index({ apply_time: 1 });
  23. schema.index({ deal_person: 1 });
  24. schema.index({ exam_time: 1 });
  25. schema.index({ status: 1 });
  26. schema.plugin(metaPlugin);
  27. schema.plugin(MoneyPlugin({ zh: '提现金额', required: true, key: 'money' }));
  28. module.exports = app => {
  29. const { mongoose } = app;
  30. return mongoose.model('CashOut', schema, 'cashOut');
  31. };