'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); const {Secret} = require('naf-framework-mongoose/lib/model/schema'); // 新闻中心发布管理 const TNewsCenterSchema = { title: {type: String, required: true},//标题 image: {type: String, required: false},//图片 brief_introduction: {type: String, required: false},//简介 description: {type: String, required: true},//内容 publish_time: {type: Number},//发布日期 publish_state: {type: String, default: '0'},//发布状态,0-未发布,1-已发布 publish_state_description: {type: String, default: '未发布'},//发布状态描述,0-未发布,1-已发布 source: {type: String, required: false},//来源 hot: {type: String, default: '0'},//是否热门,0-否,1-是 }; const schema = new Schema(TNewsCenterSchema, {toJSON: {virtuals: true}}); schema.index({id: 1}); schema.plugin(metaPlugin); module.exports = app => { const {mongoose} = app; return mongoose.model('TNewsCenter', schema, 't_news_center'); };