guhongwei před 3 roky
rodič
revize
54ed73fb0e

+ 30 - 4
app/controller/patent/.tradeorder.js

@@ -1,6 +1,17 @@
 module.exports = {
 module.exports = {
   create: {
   create: {
-    requestBody: ["user_id", "content", "remark"],
+    requestBody: [
+      "order_id",
+      "buyer_id",
+      "buyer_contacts",
+      "buyer_phone",
+      "buyer_email",
+      "type",
+      "sell",
+      "purchase",
+      "status",
+      "remark",
+    ],
   },
   },
   destroy: {
   destroy: {
     params: ["!id"],
     params: ["!id"],
@@ -8,7 +19,18 @@ module.exports = {
   },
   },
   update: {
   update: {
     params: ["!id"],
     params: ["!id"],
-    requestBody: ["user_id", "content", "remark"],
+    requestBody: [
+      "order_id",
+      "buyer_id",
+      "buyer_contacts",
+      "buyer_phone",
+      "buyer_email",
+      "type",
+      "sell",
+      "purchase",
+      "status",
+      "remark",
+    ],
   },
   },
   show: {
   show: {
     parameters: {
     parameters: {
@@ -19,8 +41,12 @@ module.exports = {
   index: {
   index: {
     parameters: {
     parameters: {
       query: {
       query: {
-        user_id: "user_id",
-        content: "content",
+        order_id: "order_id",
+        buyer_contacts: "buyer_contacts",
+        buyer_phone: "buyer_phone",
+        buyer_email: "buyer_email",
+        type: "type",
+        status: "status",
         remark: "remark",
         remark: "remark",
       },
       },
       // options: {
       // options: {

+ 42 - 4
app/model/patent/tradeorder.js

@@ -4,15 +4,53 @@ const moment = require('moment');
 const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
 const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
 const { Secret } = require('naf-framework-mongoose/lib/model/schema');
 const { Secret } = require('naf-framework-mongoose/lib/model/schema');
 const { ObjectId } = require('mongoose').Types;
 const { ObjectId } = require('mongoose').Types;
-// 信息表
+// 出售信息
+const sells = new Schema({
+  sell_id: { type: ObjectId }, // 出售id
+  selluser_id: { type: ObjectId }, // 出售者id
+  contacts: { type: String }, // 出售者联系人
+  phone: { type: String }, // 出售者手机号
+  email: { type: String }, // 出售者电子邮箱
+  patent_id: { type: String }, // 出售者专利id
+  patent_type: { type: String }, // 出售者专利类型
+  selle_type: { type: String }, // 出售者交易类型
+  money: { type: String }, // 出售者钱(元/年)
+});
+// 求购信息
+const purchases = new Schema({
+  purchases_id: { type: ObjectId }, // 求购id
+  purchasesuser_id: { type: ObjectId }, // 求购者id
+  contacts: { type: String }, // 求购者联系人
+  phone: { type: String }, // 求购者手机号
+  email: { type: String }, // 求购者电子邮箱
+  demand: { type: String }, // 求购者需求
+  patent_type: { type: String }, // 求购者专利类型
+  purchases_type: { type: String }, // 求购者交易类型
+  money: { type: String }, // 出售者钱(万元)
+
+});
+// 订单表
 const tradeorder = {
 const tradeorder = {
-  user_id: { type: ObjectId }, // 用户id
-  content: { type: String }, // 正文内容
+  order_id: { type: ObjectId }, // 订单id
+  buyer_id: { type: ObjectId }, // 买家id
+  buyer_contacts: { type: String }, // 买家联系人
+  buyer_phone: { type: String }, // 买家手机号
+  buyer_email: { type: String }, // 买家邮箱
+  type: { type: String }, // 订单类型
+  sell: { type: [ sells ] }, // 出售信息
+  purchase: { type: [ purchases ] }, // 求购信息
+  status: { type: String }, // 状态
   remark: { type: String },
   remark: { type: String },
 };
 };
 const schema = new Schema(tradeorder, { toJSON: { virtuals: true } });
 const schema = new Schema(tradeorder, { toJSON: { virtuals: true } });
 schema.index({ id: 1 });
 schema.index({ id: 1 });
-schema.index({ user_id: 1 });
+schema.index({ order_id: 1 });
+schema.index({ buyer_id: 1 });
+schema.index({ sell_id: 1 });
+schema.index({ selluser_id: 1 });
+schema.index({ purchases_id: 1 });
+schema.index({ purchasesuser_id: 1 });
+schema.index({ status: 1 });
 schema.index({ 'meta.createdAt': 1 });
 schema.index({ 'meta.createdAt': 1 });
 schema.plugin(metaPlugin);
 schema.plugin(metaPlugin);
 module.exports = app => {
 module.exports = app => {