tfinanceclaims.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. const { Secret } = require('naf-framework-mongoose/lib/model/schema');
  5. // 其他信息表
  6. const newsInfo = new Schema({
  7. news_name: { type: String, required: false, maxLength: 200 }, // 简介名称
  8. news_info: { type: String, required: false, maxLength: 500 }, // 简介内容
  9. });
  10. // 债权产品表(金融数字超市)
  11. const TfinanceClaimsSchema = {
  12. name: { type: String, required: true, maxLength: 200 }, // 产品名称
  13. top: { type: Number,maxLength: 100 ,default:'0'}, // 0:非热门推荐;1:热门推荐
  14. publish_time: { type: String,maxLength: 200 }, // 发布时间
  15. mongey_min_rate: { type: Number, required: true, maxLength: 200 }, // 利率范围(小)
  16. mongey_max_rate: { type: Number, required: true }, // 利率范围(大)
  17. claims_min_term: { type: Number, required: true, maxLength: 500 }, // 贷款期限(小)
  18. claims_max_term: { type: Number, required: true, maxLength: 500 }, // 贷款期限(大)
  19. ensure_id: { type: String, required: true, maxLength: 200 }, // 担保方式(应该是担保字典ID)
  20. repayment_id: { type: String, required: true, maxLength: 200 }, // 还款方式(应该是担保字典ID)
  21. cplx_id: { type: String, required: true, maxLength: 200 }, // 产品类型(对应字典CODE)
  22. claims_min_money: { type: Number, required: true, maxLength: 200 }, // 贷款额度(小)
  23. claims_max_money: { type: Number, required: true, maxLength: 200 }, // 贷款额度(大)
  24. uid: { type: String, required: true, maxLength: 200 }, //机构用户id
  25. status: { type: String,maxLength: 200,default:'0'}, // 状态,0-未发布,1-发布,2-下架
  26. video: {type: String, required: false,default:'0'}, // 视频附件
  27. videoimg: {type: String, required: false,default:'0'}, // 视频图片
  28. news: { type: [ newsInfo ], select: true }, // 产品简介(之前版本)废掉了已经
  29. cattribute:{type: [String], select: true },//产品属性
  30. nownews:{type: String,required: false, select: true },//产品简介(当前版本)
  31. };
  32. const schema = new Schema(TfinanceClaimsSchema, { toJSON: { virtuals: true } });
  33. schema.index({ uid: 1 });
  34. schema.index({ id: 1 });
  35. schema.plugin(metaPlugin);
  36. module.exports = app => {
  37. const { mongoose } = app;
  38. return mongoose.model('Tfinanceclaims', schema, 't_finance_claims');
  39. };