smartdocking.js 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. const resultInfo = new Schema({
  5. productid: { type: String, required: false }, // 查询产品id
  6. match: { type: String, required: false }, // 匹配度
  7. });
  8. // 智能对接信息表
  9. const SmartdockingSchema = {
  10. company_name: { type: String, required: true, maxLength: 200 }, // 企业名称
  11. phone: { type: String, required: true, maxLength: 200 }, // 手机号
  12. passwd: { type: String, select: false, required: true, maxLength: 200 }, // 密码
  13. uid: { type: String, required: false, maxLength: 200 }, // 关联企业用户id
  14. claims_money: { type: String, required: true }, // 查询条件:贷款金额
  15. claims_term: { type: String, required: true }, // 查询条件:贷款期限
  16. ensure_id: { type: String, required: true }, // 查询条件:贷款方式
  17. create_time: { type: String, required: true, maxLength: 200 }, // 查询时间
  18. type: { type: String, required: true, maxLength: 200 }, // 用户类型,0-未注册,1-已注册
  19. result_info: { type: [ resultInfo ], required: false, select: true }, // 查询结果
  20. };
  21. const schema = new Schema(SmartdockingSchema, { toJSON: { virtuals: true } });
  22. schema.index({ id: 1 });
  23. schema.index({ uid: 1 });
  24. schema.plugin(metaPlugin);
  25. module.exports = app => {
  26. const { mongoose } = app;
  27. return mongoose.model('Smartdocking', schema, 'smart_docking');
  28. };