|
@@ -0,0 +1,51 @@
|
|
|
+'use strict';
|
|
|
+const Schema = require('mongoose').Schema;
|
|
|
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
|
|
|
+
|
|
|
+// 产品图片表
|
|
|
+const images = new Schema({
|
|
|
+ url: { type: String, required: true, maxLength: 500 }, // 图片路径
|
|
|
+});
|
|
|
+
|
|
|
+// 产品参数表
|
|
|
+const args = new Schema({
|
|
|
+ arg_name: { type: String, required: true, maxLength: 200 }, // 参数名称
|
|
|
+ memo: { type: String, required: true, maxLength: 200 }, // 内容
|
|
|
+});
|
|
|
+
|
|
|
+// 科技超市产品表
|
|
|
+const ProductSchema = {
|
|
|
+ name: { type: String, required: true, maxLength: 200 }, // 名称
|
|
|
+ userid: { type: String, required: true, maxLength: 500 }, // 创建人id
|
|
|
+ totaltype: { type: String, required: true, maxLength: 200 }, // 总分类(0.技术 1.产品 2.服务)
|
|
|
+ product_type_id: { type: String, required: false, maxLength: 200 }, // 类型id
|
|
|
+ product_type_name: { type: String, required: false, maxLength: 200 }, // 类型名称
|
|
|
+ introduction: { type: String, required: false }, // 简介
|
|
|
+ price: { type: String, required: false, maxLength: 200 }, // 单价
|
|
|
+ priceunit: { type: String, required: false, maxLength: 200 }, // 单位
|
|
|
+ image: { type: [ images ], select: true }, // 产品图片
|
|
|
+ product_args: { type: [ args ], select: true }, // 产品参数
|
|
|
+ business: { type: String, required: false, maxLength: 200 }, // 交易方式,0-公用,1-转让,2-竞价
|
|
|
+ phase: { type: String, required: false, maxLength: 200 }, // 研发阶段,1-阶段成果,2-最终成果
|
|
|
+ field: { type: String, required: false, maxLength: 500 }, // 应用领域
|
|
|
+ prospect: { type: String, required: false, maxLength: 500 }, // 市场前景
|
|
|
+ contract: { type: String, required: false, maxLength: 500 }, // 电子合同
|
|
|
+ gxtype: { type: String, required: false, maxLength: 500 }, // 0-需,1-供
|
|
|
+ scope: { type: String, required: false, maxLength: 500 }, // 服务范围
|
|
|
+ description: { type: String, required: false }, // 描述
|
|
|
+ property: { type: String, required: false, maxLength: 500 }, // 知识产权
|
|
|
+ state: { type: String, required: false, maxLength: 200 }, // 状态(0:待审核 1:通过审核 2:审核拒绝)
|
|
|
+ is_del: { type: String, required: false, maxLength: 200 }, // 是否删除,0-否,1-是
|
|
|
+ contact_user: { type: String, required: false, maxLength: 200 }, // 联系人
|
|
|
+ contact_tel: { type: String, required: false, maxLength: 500 }, // 联系电话
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+const schema = new Schema(ProductSchema, { toJSON: { virtuals: true } });
|
|
|
+schema.index({ id: 1 });
|
|
|
+schema.plugin(metaPlugin);
|
|
|
+
|
|
|
+module.exports = app => {
|
|
|
+ const { mongoose } = app;
|
|
|
+ return mongoose.model('Product', schema, 'market_product');
|
|
|
+};
|