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