managemoney.js 1.3 KB

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