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