'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 ManageMoneySchema = { title: { type: String, required: true, maxLength: 100}, //理财产品名称 top: { type: Number,maxLength: 100 ,default:'0'}, // 0:非热门推荐;1:热门推荐 rate: { type: Number, required: true, maxLength: 200 }, // 收益率 min_time: { type: Number, required: true, maxLength: 200 }, // 产品期限(个月)(小) max_time: { type: Number, required: true, maxLength: 500 }, // 产品期限(个月)(大) buymin: { type: Number, required: true, maxLength: 500 }, // 起购价格 jgid: { type: String, maxLength: 200 ,default:'0'}, //金融机构ID status: { type: String, maxLength: 200,default:'0'},//状态,0-未发布,1-发布,2-下架 video: {type: String, required: false,default:'0'}, // 视频附件 news:{ type: String,maxLength: 500} }; const schema = new Schema(ManageMoneySchema, { toJSON: { virtuals: true } }); schema.index({ title: 1 }); schema.index({ jgid: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Managemoney', schema, 'manage_money'); };