'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 reward = { type: { type: String }, // 研发补贴/奖励兑换 company: { type: String }, // 申领企业 apply_person: { type: String }, // 申领人 phone: { type: String }, // 联系电话 qyfr: { type: Array }, // 企业法人 yyzz: { type: Array }, // 营业执照 qylr: { type: Array }, // 企业利润 is_cashing: { type: String, default: '0' }, // 是否兑付 status: { type: String, default: '0' }, // 状态:0:待审核;1-审核通过(生成订单);1-审核拒绝 remark: { type: String }, user_id: { type: ObjectId }, // 申领人id record: { type: Array }, // 记录 }; const schema = new Schema(reward, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ type: 1 }); schema.index({ company: 1 }); schema.index({ user_id: 1 }); schema.index({ status: 1 }); schema.index({ is_cashing: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Reward', schema, 'reward'); };