|
@@ -0,0 +1,29 @@
|
|
|
|
+'use strict';
|
|
|
|
+const Schema = require('mongoose').Schema;
|
|
|
|
+const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
|
|
|
|
+// content同下
|
|
|
|
+const act_time = {
|
|
|
|
+ value: { type: String, zh: '对应的值' },
|
|
|
|
+ is_use: { type: String, zh: '是否使用' }, // 字典:is_use
|
|
|
|
+};
|
|
|
|
+// 平台活动
|
|
|
|
+const platform_act = {
|
|
|
|
+ title: { type: String, required: false, zh: '活动标题' }, //
|
|
|
|
+ share: { type: Array, required: false, zh: '分享图片' }, //
|
|
|
|
+ cover: { type: Array, required: false, zh: '封面图片' }, //
|
|
|
|
+ act_time: { type: Object, required: false, zh: '活动时间' }, // value:值;is_use:字典(is_use)是否启用
|
|
|
|
+ content: { type: Object, required: false, zh: '活动说明' }, // 富文本;value:值;is_use:字典(is_use)是否启用
|
|
|
|
+ is_use: { type: String, required: false, default: '1', zh: '是否开启' }, // 字典:is_use,默认不开启
|
|
|
|
+};
|
|
|
|
+const schema = new Schema(platform_act, { toJSON: { getters: true, virtuals: true } });
|
|
|
|
+schema.index({ id: 1 });
|
|
|
|
+schema.index({ 'meta.createdAt': 1 });
|
|
|
|
+schema.index({ title: 1 });
|
|
|
|
+schema.index({ is_use: 1 });
|
|
|
|
+
|
|
|
|
+schema.plugin(metaPlugin);
|
|
|
|
+
|
|
|
|
+module.exports = app => {
|
|
|
|
+ const { mongoose } = app;
|
|
|
|
+ return mongoose.model('Platform_Act', schema, 'platform_act');
|
|
|
|
+};
|