'use strict'; const Schema = require('mongoose').Schema; const SchemaDefine = { // 置顶 istop: { type: Boolean, required: false, default: false }, // 排序 发布时间 date: { type: Number, required: false }, // 添加时间 createAt: { type: Number, required: true }, // 修改时间 updateAt: { type: Number, required: true }, // 缩略图 thumbnail: { type: String, required: false }, // 标题 title: { type: String, required: true }, // 二级标题 twoTitle: { type: String, required: false }, // 描述 describe: { type: String, required: false }, // 来源 source: { type: String, required: false }, // 内容 content: { type: String, required: true }, // 绑定栏目 bind: { type: String, required: true }, // 访问量 visit: { type: Number, required: false, default: 0 }, // 推荐 recommend: { type: Boolean, required: false, default: false }, // 附件 annex: { type: Array, required: false }, // vip可见标识 svip: { type: Boolean, required: false }, // 是否显示 isShow: { type: Boolean, required: false }, // 状态 0=待发布 1=已发布 status: { type: String, required: false }, // 关键词 keywords: { type: Array, required: false, default: [] }, // 副标题 curtTitle: { type: String, required: false }, // 作者 author: { type: String, required: false }, }; const schema = new Schema(SchemaDefine); module.exports = app => { const { mongoose } = app; return mongoose.model('content', schema, 'content'); };