'use strict'; const Schema = require('mongoose').Schema; const SchemaDefine = { // 排序 date: { type: Number, required: false, default: 0 }, // 添加时间 createAt: { type: Number, required: true }, // 修改时间 updateAt: { type: Number, required: true }, // 图片 img: { type: String, required: false }, // 绑定类型 bind: { type: String, required: true }, // 类型 type: { type: Number, required: false }, // 1 = 栏目 2 = 单页 0 = 链接 // 链接地址 url: { type: String, required: false }, // 描述 describe: { type: String, required: false }, // 内容 content: { type: String, required: false }, // 标题 title: { type: String, required: true }, // 二级标题 twoTitle: { type: String, required: true }, // 是否显示 isshow: { type: Boolean, required: false }, }; const schema = new Schema(SchemaDefine); module.exports = app => { const { mongoose } = app; return mongoose.model('imgnews', schema, 'imgnews'); };