imgnews.js 998 B

123456789101112131415161718192021222324252627282930313233
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const SchemaDefine = {
  4. // 排序
  5. date: { type: Number, required: false, default: 0 },
  6. // 添加时间
  7. createAt: { type: Number, required: true },
  8. // 修改时间
  9. updateAt: { type: Number, required: true },
  10. // 图片
  11. img: { type: String, required: false },
  12. // 绑定类型
  13. bind: { type: String, required: true },
  14. // 类型
  15. type: { type: Number, required: false }, // 1 = 栏目 2 = 单页 0 = 链接
  16. // 链接地址
  17. url: { type: String, required: false },
  18. // 描述
  19. describe: { type: String, required: false },
  20. // 内容
  21. content: { type: String, required: false },
  22. // 标题
  23. title: { type: String, required: true },
  24. // 二级标题
  25. twoTitle: { type: String, required: true },
  26. // 是否显示
  27. isshow: { type: Boolean, required: false },
  28. };
  29. const schema = new Schema(SchemaDefine);
  30. module.exports = app => {
  31. const { mongoose } = app;
  32. return mongoose.model('imgnews', schema, 'imgnews');
  33. };