'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); const resultInfo = new Schema({ productid: { type: String, required: false }, // 查询产品id match: { type: String, required: false }, // 匹配度 }); // 智能对接信息表 const SmartdockingSchema = { company_name: { type: String, required: true, maxLength: 200 }, // 企业名称 phone: { type: String, required: true, maxLength: 200 }, // 手机号 passwd: { type: String, select: false, required: true, maxLength: 200 }, // 密码 uid: { type: String, required: false, maxLength: 200 }, // 关联企业用户id claims_money: { type: String, required: true }, // 查询条件:贷款金额 claims_term: { type: String, required: true }, // 查询条件:贷款期限 ensure_id: { type: String, required: true }, // 查询条件:贷款方式 create_time: { type: String, required: true, maxLength: 200 }, // 查询时间 type: { type: String, required: true, maxLength: 200 }, // 用户类型,0-未注册,1-已注册 result_info: { type: [ resultInfo ], required: false, select: true }, // 查询结果 }; const schema = new Schema(SmartdockingSchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ uid: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Smartdocking', schema, 'smart_docking'); };