|
@@ -0,0 +1,71 @@
|
|
|
+'use strict';
|
|
|
+const Schema = require('mongoose').Schema;
|
|
|
+const moment = require('moment');
|
|
|
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
|
|
|
+// 产品图片表
|
|
|
+const file = new Schema({
|
|
|
+ name: { type: String, required: true, maxLength: 500 }, // 图片名
|
|
|
+ url: { type: String, required: true, maxLength: 500 }, // 图片路径
|
|
|
+});
|
|
|
+// 专利信息
|
|
|
+const patents = new Schema({
|
|
|
+ patentinfo: { type: String, required: false, maxLength: 200 }, // 专利信息,
|
|
|
+ patentstatus: { type: String, required: false, maxLength: 200 }, // 专利状态,
|
|
|
+});
|
|
|
+// 产品表
|
|
|
+const product = {
|
|
|
+ name: { type: String, required: false, maxLength: 200 }, // 名称
|
|
|
+ contacts: { type: String, required: false, maxLength: 200 }, // 联系人
|
|
|
+ phone: { type: String, required: false, maxLength: 11 }, // 联系电话
|
|
|
+ qqwx: { type: String, required: false, maxLength: 200 }, // qq&微信
|
|
|
+ email: { type: String, required: false, maxLength: 200 }, // 邮箱
|
|
|
+ type: { type: String, required: false, maxLength: 200 }, // 类型: 0-科技需求;1-技术成果;2-商务服务
|
|
|
+ status: { type: String, required: false, maxLength: 200, default: '0' }, // 状态(0:草稿 1:审核中 2:审核通过 3:审核拒绝)
|
|
|
+ user_id: { type: String, required: false, maxLength: 500 }, // 创建人id
|
|
|
+ // 共同字段
|
|
|
+ field: { type: String, required: false, maxLength: 500 }, // 所属领域
|
|
|
+ cooperation: { type: String, required: false, maxLength: 500 }, // 合作方式
|
|
|
+ company: { type: String, required: false, maxLength: 500 }, // 企业名称
|
|
|
+ condition: { type: String, required: false, maxLength: 500 }, // 合作条件及要求
|
|
|
+ image: { type: [ file ] }, // 图片,产品图片都为此字段
|
|
|
+ expect: { type: String, required: false, maxLength: 500 }, // 预期, 所有的预期都合并为此字段
|
|
|
+ demand: { type: String, required: false, maxLength: 200 }, // 需求程度:技术的需求紧急程度和服务的需求程度改为此字段
|
|
|
+
|
|
|
+ // 技术需求字段
|
|
|
+ budget: { type: String, required: false, maxLength: 300 }, // 投资预算
|
|
|
+ requirementdesc: { type: String, required: false, maxLength: 500 }, // 需求说明
|
|
|
+ present: { type: String, required: false, maxLength: 500 }, // 需求现状
|
|
|
+
|
|
|
+ // 技术成果字段
|
|
|
+ achievestatus: { type: String, required: false, maxLength: 200 }, // 成果状态
|
|
|
+ achieveown: { type: String, required: false, maxLength: 200 }, // 成果权属
|
|
|
+ achievesource: { type: String, required: false, maxLength: 200 }, // 成果来源
|
|
|
+ intentionprice: { type: String, required: false, maxLength: 200 }, // 意向价格
|
|
|
+ patent: { type: [ patents ] },
|
|
|
+ roadshow: { type: Array, required: false, maxLength: 200 }, // 项目路演
|
|
|
+ achievebrief: { type: String, required: false, maxLength: 500 }, // 成果简介
|
|
|
+ features: { type: String, required: false, maxLength: 500 }, // 技术特点
|
|
|
+ team: { type: String, required: false, maxLength: 500 }, // 技术团队
|
|
|
+
|
|
|
+ // 商务需求
|
|
|
+ messattribute: { type: String, required: false, maxLength: 200 }, // 信息属性
|
|
|
+ informationdesc: { type: String, required: false, maxLength: 500 }, // 信息描述
|
|
|
+ coreelements: { type: String, required: false, maxLength: 500 }, // 核心要素
|
|
|
+ priceinfo: { type: String, required: false, maxLength: 500 }, // 价格信息
|
|
|
+
|
|
|
+ remark: { type: String, maxLength: 200 },
|
|
|
+ create_time: { type: String, default: moment().format('YYYY-MM-DD HH:mm:ss') },
|
|
|
+};
|
|
|
+const schema = new Schema(product, { toJSON: { virtuals: true } });
|
|
|
+schema.index({ id: 1 });
|
|
|
+schema.index({ name: 1 });
|
|
|
+schema.index({ qqwx: 1 });
|
|
|
+schema.index({ type: 1 });
|
|
|
+schema.index({ status: 1 });
|
|
|
+schema.index({ company: 1 });
|
|
|
+schema.index({ 'meta.createdAt': 1 });
|
|
|
+schema.plugin(metaPlugin);
|
|
|
+module.exports = app => {
|
|
|
+ const { mongoose } = app;
|
|
|
+ return mongoose.model('Product', schema, 'product');
|
|
|
+};
|