'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); // ids详情 const info = new Schema({ jr_id: { type: String, required: false, maxLength: 200 }, // 资料名称 reason: { type: String, required: false, maxLength: 500 }, // 资料链接 }); // 智能对接信息表 const IntelligentDockingSchema = { uid: { type: String, required: true, maxLength: 200 }, // 企业用户id // 对接需求 company_name: { type: String, required: true, maxLength: 200 }, // 企业名称 code: { type: String, required: false, maxLength: 200 }, // 统一社会信用代码 person: { type: String, required: true, maxLength: 200 }, // 联系人 phone: { type: String, required: true, maxLength: 200 }, // 手机号 opening_bank: { type: String, required: false, maxLength: 200 }, // 首选开户行 orientation: { type: [ String ], required: true }, // 融资取向 money: { type: String, required: true, maxLength: 200 }, // 融资金额 claims_min_term: { type: String, required: false, maxLength: 200 }, // 融资期限(小) claims_max_term: { type: String, required: false, maxLength: 200 }, // 融资期限(大) mongey_min_rate: { type: String, required: false, maxLength: 200 }, // 融资利率(小) mongey_max_rate: { type: String, required: false, maxLength: 200 }, // 融资利率(小) ensure_id: { type: String, required: false, maxLength: 200 }, // 担保方式的code(字典表) ensure_name: { type: String, required: false, maxLength: 200 }, // 担保方式 when: { type: String, required: false, maxLength: 200 }, // 预计何时有融资需求 非必填 additional_information: { type: String, required: false, maxLength: 200 }, // 补充信息 非必填 // 对接结果 create_time: { type: String, required: false, maxLength: 200 }, // 查询时间 cid: { type: String, required: false, maxLength: 200 }, // 对接结果-产品 jg_id: { type: String, required: false, maxLength: 200 }, // 对接结果-银行 // 拒绝 refuse_times: { type: Number, default: 0 }, // 拒绝次数 默认为0 ids: { type: [ info ], required: false }, // 拒绝的银行id,理由 status: { type: String, default: '0' }, // 状态:进行中0,已完成1 }; const schema = new Schema(IntelligentDockingSchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('IntelligentDocking', schema, 'intelligent_docking'); };