content.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const SchemaDefine = {
  4. // 置顶
  5. istop: { type: Boolean, required: false, default: false },
  6. // 排序 发布时间
  7. date: { type: Number, required: false },
  8. // 添加时间
  9. createAt: { type: Number, required: true },
  10. // 修改时间
  11. updateAt: { type: Number, required: true },
  12. // 缩略图
  13. thumbnail: { type: String, required: false },
  14. // 标题
  15. title: { type: String, required: true },
  16. // 二级标题
  17. twoTitle: { type: String, required: false },
  18. // 描述
  19. describe: { type: String, required: false },
  20. // 来源
  21. source: { type: String, required: false },
  22. // 内容
  23. content: { type: String, required: true },
  24. // 绑定栏目
  25. bind: { type: String, required: true },
  26. // 访问量
  27. visit: { type: Number, required: false, default: 0 },
  28. // 推荐
  29. recommend: { type: Boolean, required: false, default: false },
  30. // 附件
  31. annex: { type: Array, required: false },
  32. // vip可见标识
  33. svip: { type: Boolean, required: false },
  34. // 是否显示
  35. isShow: { type: Boolean, required: false },
  36. // 状态 0=待发布 1=已发布
  37. status: { type: String, required: false },
  38. // 关键词
  39. keywords: { type: Array, required: false, default: [] },
  40. // 副标题
  41. curtTitle: { type: String, required: false },
  42. // 作者
  43. author: { type: String, required: false },
  44. };
  45. const schema = new Schema(SchemaDefine);
  46. module.exports = app => {
  47. const { mongoose } = app;
  48. return mongoose.model('content', schema, 'content');
  49. };