imgnews.js 877 B

1234567891011121314151617181920212223242526272829
  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: true },
  12. // 绑定类型
  13. bind: { type: String, required: true },
  14. // 类型
  15. type: { type: Number, required: true }, // 1 = 栏目 2 = 单页 0 = 链接
  16. // 链接地址
  17. url: { type: String, required: false },
  18. // 绑定栏目
  19. column: { type: String, required: false },
  20. // 绑定单页
  21. pages: { type: String, required: false },
  22. // 名称
  23. title: { type: String, required: false },
  24. };
  25. const schema = new Schema(SchemaDefine);
  26. module.exports = app => {
  27. const { mongoose } = app;
  28. return mongoose.model('imgnews', schema, 'imgnews');
  29. };