12345678910111213141516171819202122232425262728293031323334353637 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const moment = require('moment');
- const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
- const { ObjectId } = require('mongoose').Types;
- // 创新券申领表
- const coupons_apply = {
- user_id: { type: ObjectId }, // 申请人id
- coupons_id: { type: ObjectId }, // 创新券id
- company: { type: String }, // 申请企业
- apply_person: { type: String }, // 申请人
- phone: { type: String }, // 联系电话
- qyfr: { type: Array }, // 企业法人
- yyzz: { type: Array }, // 营业执照
- qylr: { type: Array }, // 企业利润表
- record: { type: Array }, // 审核记录
- apply_money: { type: Number }, // 申请金额
- actual_money: { type: Number }, // 实际申领金额
- section_time: { type: String }, // 使用期限
- remark: { type: String },
- status: { type: String, default: '0' }, // 0-待处理;1-已通过;2已拒绝
- is_use: { type: String, default: '0' },
- };
- const schema = new Schema(coupons_apply, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ user_id: 1 });
- schema.index({ coupons_id: 1 });
- schema.index({ company: 1 });
- schema.index({ apply_person: 1 });
- schema.index({ phone: 1 });
- schema.index({ is_use: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('CouponsApply', schema, 'couponsApply');
- };
|