|
@@ -0,0 +1,45 @@
|
|
|
+'use strict';
|
|
|
+const Schema = require('mongoose').Schema;
|
|
|
+const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
|
|
|
+
|
|
|
+
|
|
|
+// 视频信息
|
|
|
+const videos = {
|
|
|
+ title: { type: String, required: false, zh: '名称' }, //
|
|
|
+ brief: { type: String, required: false, zh: '简介' }, //
|
|
|
+ time_num: { type: String, required: false, zh: '时长' }, //
|
|
|
+ origin: { type: String, required: false, zh: '来源' }, //
|
|
|
+ firm_id: { type: String, required: false, zh: '厂商' }, //
|
|
|
+ type_id: { type: String, required: false, zh: '类型' }, //
|
|
|
+ place_id: { type: String, required: false, zh: '产地' }, //
|
|
|
+ year: { type: String, required: false, zh: '年份' }, //
|
|
|
+ head_actor: { type: String, required: false, zh: '领衔演员' }, //
|
|
|
+ actor: { type: String, required: false, zh: '演员' }, //
|
|
|
+ img_url: { type: Array, required: false, zh: '图片' }, //
|
|
|
+ video_url: { type: Array, required: false, zh: '视频路径' }, //
|
|
|
+ view_num: { type: Number, required: false, default: '0', zh: '观看次数' }, //
|
|
|
+ is_use: { type: String, required: false, default: '0', zh: '是否启用' }, //
|
|
|
+ is_hot: { type: String, required: false, default: '0', zh: '是否热推' }, //
|
|
|
+};
|
|
|
+const schema = new Schema(videos, { toJSON: { getters: true, virtuals: true } });
|
|
|
+schema.index({ id: 1 });
|
|
|
+schema.index({ 'meta.createdAt': 1 });
|
|
|
+schema.index({ title: 1 });
|
|
|
+schema.index({ brief: 1 });
|
|
|
+schema.index({ time_num: 1 });
|
|
|
+schema.index({ origin: 1 });
|
|
|
+schema.index({ firm_id: 1 });
|
|
|
+schema.index({ type_id: 1 });
|
|
|
+schema.index({ place_id: 1 });
|
|
|
+schema.index({ year: 1 });
|
|
|
+schema.index({ head_actor: 1 });
|
|
|
+schema.index({ view_num: 1 });
|
|
|
+schema.index({ is_use: 1 });
|
|
|
+schema.index({ is_hot: 1 });
|
|
|
+
|
|
|
+schema.plugin(metaPlugin);
|
|
|
+
|
|
|
+module.exports = app => {
|
|
|
+ const { mongoose } = app;
|
|
|
+ return mongoose.model('Videos', schema, 'videos');
|
|
|
+};
|