浏览代码

服务端三个展会更新

guhongwei 3 年之前
父节点
当前提交
5f82482497
共有 39 个文件被更改,包括 424 次插入1032 次删除
  1. 27 5
      app/controller/channel/config/.channel.js
  2. 18 2
      app/controller/channel/config/.channelVideo.js
  3. 21 3
      app/controller/consultation/config/.trainChat.js
  4. 27 49
      app/controller/consultation/config/.trainLive.js
  5. 3 9
      app/controller/dock/config/.dockVip.js
  6. 13 0
      app/controller/consultation/trainVideo.js
  7. 6 3
      app/controller/dock/config/.dock.js
  8. 11 12
      app/controller/dock/config/.dockChat.js
  9. 10 4
      app/controller/dock/config/.dockImgtxt.js
  10. 3 0
      app/controller/dock/config/.dockTranscation.js
  11. 8 8
      app/controller/dock/config/.dockUser.js
  12. 2 3
      app/controller/dock/config/.dockVideo.js
  13. 0 92
      app/controller/dock/config/.patent.js
  14. 0 13
      app/controller/dock/dockVip.js
  15. 0 16
      app/controller/dock/patent.js
  16. 22 18
      app/model/channel/channel.js
  17. 17 15
      app/model/channel/channelVideo.js
  18. 7 9
      app/model/consultation/trainChat.js
  19. 28 36
      app/model/consultation/trainLive.js
  20. 23 0
      app/model/consultation/trainVideo.js
  21. 18 20
      app/model/dock/dock.js
  22. 14 14
      app/model/dock/dockChat.js
  23. 6 3
      app/model/dock/dockImgtxt.js
  24. 7 8
      app/model/dock/dockTranscation.js
  25. 5 5
      app/model/dock/dockUser.js
  26. 11 13
      app/model/dock/dockVideo.js
  27. 0 27
      app/model/dock/dockVip.js
  28. 0 33
      app/model/dock/patent.js
  29. 50 51
      app/router.js
  30. 9 9
      app/service/channel/channel.js
  31. 17 16
      app/service/consultation/trainChat.js
  32. 20 115
      app/service/consultation/trainLive.js
  33. 15 0
      app/service/consultation/trainVideo.js
  34. 3 3
      app/service/dock/dock.js
  35. 0 42
      app/service/dock/dockVip.js
  36. 0 331
      app/service/dock/patent.js
  37. 0 8
      app/z_router/consultation/trainLive.js
  38. 3 4
      app/z_router/dock/dockVip.js
  39. 0 33
      app/z_router/dock/patent.js

+ 27 - 5
app/controller/channel/config/.channel.js

@@ -1,6 +1,17 @@
 module.exports = {
   create: {
-    requestBody: ["user_id", "title", "origin", "type", "desc"],
+    requestBody: [
+      "room_id",
+      "password",
+      "title",
+      "origin",
+      "type",
+      "brief",
+      "create_time",
+      "status",
+      "role",
+      "remark",
+    ],
   },
   destroy: {
     params: ["!id"],
@@ -8,7 +19,18 @@ module.exports = {
   },
   update: {
     params: ["!id"],
-    requestBody: ["user_id", "title", "origin", "type", "desc"],
+    requestBody: [
+      "room_id",
+      "password",
+      "title",
+      "origin",
+      "type",
+      "brief",
+      "create_time",
+      "status",
+      "role",
+      "remark",
+    ],
   },
   show: {
     parameters: {
@@ -19,9 +41,9 @@ module.exports = {
   index: {
     parameters: {
       query: {
-        user_id:"user_id",
-        room_id:"room_id",
-        type:"type",
+        room_id: "room_id",
+        title: "title",
+        type: "type",
         "create_time@start": "create_time@start",
         "create_time@end": "create_time@end",
       },

+ 18 - 2
app/controller/channel/config/.channelVideo.js

@@ -1,6 +1,14 @@
 module.exports = {
   create: {
-    requestBody: ["channel_id", "title", "start_time", "end_time", "file_path"],
+    requestBody: [
+      "channel_id",
+      "title",
+      "start_time",
+      "end_time",
+      "video_url",
+      "create_time",
+      "remark",
+    ],
   },
   destroy: {
     params: ["!id"],
@@ -8,7 +16,15 @@ module.exports = {
   },
   update: {
     params: ["!id"],
-    requestBody: ["channel_id", "title", "start_time", "end_time", "file_path"],
+    requestBody: [
+      "channel_id",
+      "title",
+      "start_time",
+      "end_time",
+      "video_url",
+      "create_time",
+      "remark",
+    ],
   },
   show: {
     parameters: {

+ 21 - 3
app/controller/consultation/config/.trainChat.js

@@ -1,6 +1,13 @@
 module.exports = {
   create: {
-    requestBody: ["sender_id", "sender_name", "!content", "send_time", "role", "unit_id"],
+    requestBody: [
+      "dock_id",
+      "sender_id",
+      "sender_name",
+      "content",
+      "send_time",
+      "remark",
+    ],
   },
   destroy: {
     params: ["!id"],
@@ -8,7 +15,14 @@ module.exports = {
   },
   update: {
     params: ["!id"],
-    requestBody: ["sender_id", "sender_name", "content", "send_time", "role", "unit_id"],
+    requestBody: [
+      "dock_id",
+      "sender_id",
+      "sender_name",
+      "content",
+      "send_time",
+      "remark",
+    ],
   },
   show: {
     parameters: {
@@ -18,7 +32,11 @@ module.exports = {
   },
   index: {
     parameters: {
-      query: ["sender_id", "sender_name", "content", "send_time", "role", "unit_id"],
+      query: {
+        dock_id: "dock_id",
+        sender_id: "sender_id",
+        sender_name: "%sender_name%",
+      },
     },
     service: "query",
     options: {

+ 27 - 49
app/controller/consultation/config/.trainLive.js

@@ -1,16 +1,21 @@
 module.exports = {
   create: {
     requestBody: [
+      "room_id",
+      "password",
       "title",
+      "start_time",
+      "end_time",
       "province",
-      "place",
+      "city",
+      "admin",
+      "phone",
       "sponsor",
+      "organizer",
       "brief",
-      "user",
-      "phone",
-      "video_data",
-      "user_data",
-      "start_date",
+      "status",
+      "role",
+      "remark",
     ],
   },
   destroy: {
@@ -20,16 +25,21 @@ module.exports = {
   update: {
     params: ["!id"],
     requestBody: [
+      "room_id",
+      "password",
       "title",
+      "start_time",
+      "end_time",
       "province",
-      "place",
+      "city",
+      "admin",
+      "phone",
       "sponsor",
+      "organizer",
       "brief",
-      "user",
-      "phone",
-      "video_data",
-      "user_data",
-      "start_date",
+      "status",
+      "role",
+      "remark",
     ],
   },
   show: {
@@ -41,13 +51,13 @@ module.exports = {
   index: {
     parameters: {
       query: {
+        room_id: "room_id",
         title: "title",
-        province: "province",
-        place: "place",
+        start_time: "start_time",
+        end_time: "end_time",
+        admin: "admin",
         sponsor: "sponsor",
-        brief: "brief",
-        user: "user",
-        phone: "phone",
+        status: "status",
         "create_time@start": "create_time@start",
         "create_time@end": "create_time@end",
       },
@@ -63,40 +73,8 @@ module.exports = {
       count: true,
     },
   },
-  userData: {
-    params: ["!id"],
-    service: "userData",
-  },
-  addUser: {
-    params: ["!id"],
-    requestBody: ["users"],
-    service: "addUser",
-  },
-  updateUser: {
-    params: ["!id"],
-    requestBody: ["users"],
-    service: "updateUser",
-  },
-  deleteUser: {
-    params: ["!id"],
-    requestBody: ["users"],
-    service: "deleteUser",
-  },
-  userLogin: {
-    params: ["!id"],
-    requestBody: ["user_phone", "user_password"],
-    service: "userLogin",
-  },
-  userLogout: {
-    params: ["!id"],
-    service: "userLogout",
-  },
   login: {
     requestBody: ["room_id", "password"],
     service: "login",
   },
-  userLonger: {
-    params: ["!id"],
-    service: "userLonger",
-  },
 };

+ 3 - 9
app/controller/dock/config/.dockVip.js

@@ -1,6 +1,6 @@
 module.exports = {
   create: {
-    requestBody: ["dock_id", "name", "phone", "email", "brief", "remark"],
+    requestBody: ["dock_id", "title", "brief", "video_url", "remark"],
   },
   destroy: {
     params: ["!id"],
@@ -8,7 +8,7 @@ module.exports = {
   },
   update: {
     params: ["!id"],
-    requestBody: ["dock_id", "name", "phone", "email", "brief", "remark"],
+    requestBody: ["dock_id", "title", "brief", "video_url", "remark"],
   },
   show: {
     parameters: {
@@ -20,8 +20,7 @@ module.exports = {
     parameters: {
       query: {
         dock_id: "dock_id",
-        name: "name",
-        phone: "phone",
+        title: "title",
       },
       // options: {
       //   "meta.state": 0 // 默认条件
@@ -35,9 +34,4 @@ module.exports = {
       count: true,
     },
   },
-  login: {
-    params: ["!id"],
-    requestBody: ["phone", "password"],
-    service: "login",
-  },
 };

+ 13 - 0
app/controller/consultation/trainVideo.js

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./config/.trainVideo.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
+
+// 展会视频
+class TrainVideoController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.consultation.trainVideo;
+  }
+}
+module.exports = CrudController(TrainVideoController, meta);

+ 6 - 3
app/controller/dock/config/.dock.js

@@ -1,6 +1,8 @@
 module.exports = {
   create: {
     requestBody: [
+      "room_id",
+      "password",
       "title",
       "start_time",
       "end_time",
@@ -10,8 +12,8 @@ module.exports = {
       "phone",
       "sponsor",
       "organizer",
-      "user_id",
       "status",
+      "role",
       "remark",
     ],
   },
@@ -22,6 +24,8 @@ module.exports = {
   update: {
     params: ["!id"],
     requestBody: [
+      "room_id",
+      "password",
       "title",
       "start_time",
       "end_time",
@@ -31,8 +35,8 @@ module.exports = {
       "phone",
       "sponsor",
       "organizer",
-      "user_id",
       "status",
+      "role",
       "remark",
     ],
   },
@@ -51,7 +55,6 @@ module.exports = {
         end_time: "end_time",
         admin: "admin",
         sponsor: "sponsor",
-        user_id: "user_id",
         status: "status",
         "start_time@start": "start_time@start",
         "start_time@end": "start_time@end",

+ 11 - 12
app/controller/dock/config/.dockChat.js

@@ -1,11 +1,12 @@
 module.exports = {
   create: {
     requestBody: [
-      "!dock_id",
-      "!content",
-      "!sender_id",
-      "!sender_name",
-      "sender_time",
+      "dock_id",
+      "sender_id",
+      "sender_name",
+      "content",
+      "send_time",
+      "remark",
     ],
   },
   destroy: {
@@ -15,12 +16,12 @@ module.exports = {
   update: {
     params: ["!id"],
     requestBody: [
-      "!dock_id",
-      "!content",
-      "!sender_id",
-      "!sender_name",
+      "dock_id",
+      "sender_id",
+      "sender_name",
+      "content",
+      "send_time",
       "remark",
-      "sender_time",
     ],
   },
   show: {
@@ -35,8 +36,6 @@ module.exports = {
         dock_id: "dock_id",
         sender_id: "sender_id",
         sender_name: "%sender_name%",
-        "send_time@start": "send_time@start",
-        "send_time@end": "send_time@end",
       },
       // options: {
       //   "meta.state": 0 // 默认条件

+ 10 - 4
app/controller/dock/config/.dockImgtxt.js

@@ -2,10 +2,12 @@ module.exports = {
   create: {
     requestBody: [
       "dock_id",
+      "sender_id",
+      "sender_name",
       "content",
       "img_url",
-      "file_url",
-      "user_id",
+      "video_url",
+      "send_time",
       "remark",
     ],
   },
@@ -17,10 +19,12 @@ module.exports = {
     params: ["!id"],
     requestBody: [
       "dock_id",
+      "sender_id",
+      "sender_name",
       "content",
       "img_url",
-      "file_url",
-      "user_id",
+      "video_url",
+      "send_time",
       "remark",
     ],
   },
@@ -34,6 +38,8 @@ module.exports = {
     parameters: {
       query: {
         dock_id: "dock_id",
+        sender_id: "sender_id",
+        sender_name: "sender_name",
       },
       // options: {
       //   "meta.state": 0 // 默认条件

+ 3 - 0
app/controller/dock/config/.dockTranscation.js

@@ -3,6 +3,7 @@ module.exports = {
     requestBody: [
       "dock_id",
       "product_id",
+      "product_name",
       "s_id",
       "s_name",
       "s_phone",
@@ -23,6 +24,7 @@ module.exports = {
     requestBody: [
       "dock_id",
       "product_id",
+      "product_name",
       "s_id",
       "s_name",
       "s_phone",
@@ -45,6 +47,7 @@ module.exports = {
       query: {
         dock_id: "dock_id",
         product_id: "product_id",
+        product_name: "product_name",
         s_id: "s_id",
         s_name: "s_name",
         d_id: "d_id",

+ 8 - 8
app/controller/dock/config/.dockUser.js

@@ -2,12 +2,12 @@ module.exports = {
   create: {
     requestBody: [
       "dock_id",
-      "name",
-      "phone",
+      "user_id",
+      "user_name",
+      "user_phone",
       "create_time",
       "productList",
       "status",
-      "user_id",
       "remark",
     ],
   },
@@ -19,12 +19,12 @@ module.exports = {
     params: ["!id"],
     requestBody: [
       "dock_id",
-      "name",
-      "phone",
+      "user_id",
+      "user_name",
+      "user_phone",
       "create_time",
       "productList",
       "status",
-      "user_id",
       "remark",
     ],
   },
@@ -39,8 +39,8 @@ module.exports = {
       query: {
         dock_id: "dock_id",
         user_id: "user_id",
-        name: "name",
-        phone: "phone",
+        user_name: "user_name",
+        user_phone: "user_phone",
         status: "status",
       },
       // options: {

+ 2 - 3
app/controller/dock/config/.dockVideo.js

@@ -1,6 +1,6 @@
 module.exports = {
   create: {
-    requestBody: ["dock_id", "title", "brief", "file_url", "user_id", "remark"],
+    requestBody: ["dock_id", "title", "brief", "video_url", "remark"],
   },
   destroy: {
     params: ["!id"],
@@ -8,7 +8,7 @@ module.exports = {
   },
   update: {
     params: ["!id"],
-    requestBody: ["dock_id", "title", "brief", "file_url", "user_id", "remark"],
+    requestBody: ["dock_id", "title", "brief", "video_url", "remark"],
   },
   show: {
     parameters: {
@@ -21,7 +21,6 @@ module.exports = {
       query: {
         dock_id: "dock_id",
         title: "title",
-        user_id: "user_id",
       },
       // options: {
       //   "meta.state": 0 // 默认条件

+ 0 - 92
app/controller/dock/config/.patent.js

@@ -1,92 +0,0 @@
-module.exports = {
-  create: {
-    requestBody: [
-      "create_number",
-      "create_date",
-      "success_number",
-      "success_date",
-      "name",
-      "inventor",
-      "address",
-      "apply_personal",
-      "term",
-      "type",
-      "agent_personal",
-      "agent",
-      "abstract",
-      "img_url",
-      "origin",
-    ],
-  },
-  destroy: {
-    params: ["!id"],
-    service: "delete",
-  },
-  update: {
-    params: ["!id"],
-    requestBody: [
-      "create_number",
-      "create_date",
-      "success_number",
-      "success_date",
-      "name",
-      "inventor",
-      "address",
-      "apply_personal",
-      "term",
-      "type",
-      "agent_personal",
-      "agent",
-      "abstract",
-      "img_url",
-      "origin",
-    ],
-  },
-  show: {
-    parameters: {
-      params: ["!id"],
-    },
-    service: "fetch",
-  },
-  index: {
-    parameters: {
-      query: {
-        create_number: "create_number",
-        create_date: "create_date",
-        create_number: "create_number",
-        success_date: "success_date",
-        name: "%name%",
-        inventor: "%inventor%",
-        address: "address",
-        apply_personal: "%apply_personal%",
-        term: "term",
-        type: "type",
-        agent_personal: "agent_personal",
-        agent: "agent",
-        origin: "%origin%",
-        code:"code"
-      },
-    },
-    service: "query",
-    options: {
-      query: ["skip", "limit"],
-      sort: ["meta.createdAt"],
-      desc: true,
-      count: true,
-    },
-  },
-  toImport: {
-    requestBody: ["uri", "origin"],
-    service: "toImport",
-  },
-  toExport: {
-    requestBody: ["user"],
-    service: "toExport",
-  },
-  getByCN: {
-    parameters: {
-      params: ["!create_number"],
-    },
-    service: "getByCreateNumber",
-  },
-};

+ 0 - 13
app/controller/dock/dockVip.js

@@ -1,13 +0,0 @@
-'use strict';
-const meta = require('./config/.dockVip.js');
-const Controller = require('egg').Controller;
-const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
-
-// 展会vip
-class DockVipController extends Controller {
-  constructor(ctx) {
-    super(ctx);
-    this.service = this.ctx.service.dock.dockVip;
-  }
-}
-module.exports = CrudController(DockVipController, meta);

+ 0 - 16
app/controller/dock/patent.js

@@ -1,16 +0,0 @@
-'use strict';
-
-const _ = require('lodash');
-const meta = require('./config/.patent.js');
-const Controller = require('egg').Controller;
-const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
-
-// 专利表
-class PatentController extends Controller {
-  constructor(ctx) {
-    super(ctx);
-    this.service = this.ctx.service.dock.patent;
-  }
-}
-
-module.exports = CrudController(PatentController, meta);

+ 22 - 18
app/model/channel/channel.js

@@ -1,26 +1,30 @@
-'use strict';
-const Schema = require('mongoose').Schema;
-const moment = require('moment');
-const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
-const { Secret } = require('naf-framework-mongoose-free/lib/model/schema');
-const { ObjectId } = require('mongoose').Types;
+"use strict";
+const Schema = require("mongoose").Schema;
+const moment = require("moment");
+const metaPlugin = require("naf-framework-mongoose-free/lib/model/meta-plugin");
+const { Secret } = require("naf-framework-mongoose-free/lib/model/schema");
+const { ObjectId } = require("mongoose").Types;
 // 科技频道表
 const channel = {
-  user_id: { type: ObjectId }, // 关联的personal的id
-  title: { type: String, required: false, maxLength: 200 }, // 标题
-  origin: { type: String, required: false, maxLength: 200 }, // 来源
-  type: { type: String, required: false, maxLength: 200 }, // 类别
-  room_id: { type: String, required: false, maxLength: 200 }, // 房间id,服务生成,从2001开始
-  passwd: { type: Secret, required: false, maxLength: 200, select: false }, // 密码,房间号
-  desc: { type: String, maxLength: 1000 }, // 简介
-  remark: { type: String, maxLength: 200 },
-  create_time: { type: String },
+  room_id: { type: String }, // 房间id,服务生成,从2001开始
+  password: { type: Secret }, // 密码,房间号
+  title: { type: String }, // 标题
+  origin: { type: String }, // 来源
+  type: { type: String }, // 类别
+  brief: { type: String }, // 简介
+  create_time: { type: String }, //更新时间
+  status: { type: String, default: "0" }, // 0-准备中;1-开始;-1-结束
+  role: { type: String, required: false, default: "7" }, // 角色
+  remark: { type: String },
 };
 const schema = new Schema(channel, { toJSON: { virtuals: true } });
 schema.index({ id: 1 });
-schema.index({ 'meta.createdAt': 1 });
+schema.index({ room_id: 1 });
+schema.index({ title: 1 });
+schema.index({ type: 1 });
+schema.index({ "meta.createdAt": 1 });
 schema.plugin(metaPlugin);
-module.exports = app => {
+module.exports = (app) => {
   const { mongoose } = app;
-  return mongoose.model('Channel', schema, 'channel');
+  return mongoose.model("Channel", schema, "channel");
 };

+ 17 - 15
app/model/channel/channelVideo.js

@@ -1,24 +1,26 @@
-'use strict';
-const Schema = require('mongoose').Schema;
-const moment = require('moment');
-const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
-const { Secret } = require('naf-framework-mongoose-free/lib/model/schema');
-const { ObjectId } = require('mongoose').Types;
+"use strict";
+const Schema = require("mongoose").Schema;
+const moment = require("moment");
+const metaPlugin = require("naf-framework-mongoose-free/lib/model/meta-plugin");
+const { Secret } = require("naf-framework-mongoose-free/lib/model/schema");
+const { ObjectId } = require("mongoose").Types;
 // 科技频道-视频表
 const channel_video = {
-  channel_id: { type: ObjectId }, // 关联的personal的id
-  title: { type: String, required: false, maxLength: 200 }, // 标题
-  start_time: { type: String, required: false, maxLength: 200 }, // 开始时间
-  end_time: { type: String, required: false, maxLength: 200 }, // 结束时间
-  file_path: { type: String, required: false, maxLength: 200 }, // 视频路径
-  remark: { type: String, maxLength: 200 },
+  channel_id: { type: String }, // 关联的channel的id
+  title: { type: String }, // 标题
+  start_time: { type: String }, // 开始时间
+  end_time: { type: String }, // 结束时间
+  video_url: { type: Array }, // 视频文件
+  remark: { type: String },
   create_time: { type: String },
 };
 const schema = new Schema(channel_video, { toJSON: { virtuals: true } });
 schema.index({ id: 1 });
-schema.index({ 'meta.createdAt': 1 });
+schema.index({ channel_id: 1 });
+schema.index({ title: 1 });
+schema.index({ "meta.createdAt": 1 });
 schema.plugin(metaPlugin);
-module.exports = app => {
+module.exports = (app) => {
   const { mongoose } = app;
-  return mongoose.model('ChannelVideo', schema, 'channelVideo');
+  return mongoose.model("ChannelVideo", schema, "channelVideo");
 };

+ 7 - 9
app/model/consultation/trainChat.js

@@ -4,20 +4,18 @@ const moment = require('moment');
 const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
 // 培训问诊聊天记录表
 const train_chat = {
-  unit_id: { type: String, maxLength: 200 }, // 公共聊天区id
-  sender_id: { type: String, maxLength: 200 }, // 发言人id
-  sender_name: { type: String, required: true, maxLength: 200 }, // 发言人名称
-  content: { type: String, required: true, maxLength: 1000 }, // 发言内容
-  send_time: { type: String, maxLength: 100 }, // 发言时间:年月日时分秒
-  role: { type: String, maxLength: 200 }, // 用户身份
+  train_id: { type: String, maxLength: 200 }, // 展会id
+  sender_id: { type: String }, // 发送人id
+  sender_name: { type: String }, // 发送人姓名
+  content: { type: String }, // 发送内容
+  send_time: { type: String }, //发送时间
   remark: { type: String, maxLength: 200 },
-  create_time: { type: String },
 };
 const schema = new Schema(train_chat, { toJSON: { virtuals: true } });
 schema.index({ id: 1 });
-schema.index({ unit_id: 1 });
+schema.index({ train_id: 1 });
 schema.index({ sender_id: 1 });
-schema.index({ send_time: 1 });
+schema.index({ sender_name: 1 });
 schema.index({ 'meta.createdAt': 1 });
 schema.plugin(metaPlugin);
 module.exports = app => {

+ 28 - 36
app/model/consultation/trainLive.js

@@ -1,47 +1,39 @@
-'use strict';
-const Schema = require('mongoose').Schema;
-const moment = require('moment');
-const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
+"use strict";
+const Schema = require("mongoose").Schema;
+const moment = require("moment");
+const metaPlugin = require("naf-framework-mongoose-free/lib/model/meta-plugin");
+const { Secret } = require("naf-framework-mongoose-free/lib/model/schema");
+const { ObjectId } = require("mongoose").Types;
 
-const video = new Schema({
-  video_title: { type: String, maxLength: 500 }, // 标题
-  video_date: { type: String, maxLength: 500 }, // 时间
-  video_url: { type: String, maxLength: 500 }, // 视频路径
-});
-const user = new Schema({
-  user_title: { type: String, maxLength: 500 }, // 用户名
-  user_phone: { type: String, maxLength: 500 }, // 账号
-  user_password: { type: String, maxLength: 500 }, // 密码
-});
 // 培训问诊表
 const trainlive = {
-  room_id: { type: String, required: true, unique: true }, // 房间号
-  password: { type: String }, // 密码
-  title: { type: String }, // 标题
-  province: { type: String }, // 省份
-  place: { type: String }, // 市区
-  sponsor: { type: String }, // 主办方
-  brief: { type: String }, // 简介
-  user: { type: String }, // 负责人
-  phone: { type: String }, // 负责人手机号
-  video_data: { type: [ video ] }, // 视频
-  user_data: { type: [ user ], select: false }, // 参加用户
-  start_date: { type: String }, // 开始时间
-  type: { type: String, default: 'train' }, // 类型
-  remark: { type: String, maxLength: 200 },
-  create_time: { type: String },
+  room_id: { type: String, required: true }, // 房间号,从3001开始
+  password: { type: Secret, select: false }, // 密码
+  title: { type: String, required: false }, // 标题
+  start_time: { type: String, required: true }, // 开始时间
+  end_time: { type: String, required: true }, // 结束时间
+  province: { type: String, required: false }, // 省
+  city: { type: String, required: false }, // 市
+  admin: { type: String, required: false }, // 负责人
+  phone: { type: String, required: false }, // 负责人电话
+  sponsor: { type: String, required: false }, // 主办方
+  organizer: { type: String, required: false }, // 承办方
+  brief: { type: String, required: false }, // 信息简介
+  status: { type: String, default: "0" }, // 0-准备中;1-开始;-1-结束
+  role: { type: String, required: false, default: "8" }, // 角色
+  remark: { type: String },
 };
 const schema = new Schema(trainlive, { toJSON: { virtuals: true } });
 schema.index({ id: 1 });
 schema.index({ room_id: 1 });
 schema.index({ title: 1 });
-schema.index({ province: 1 });
-schema.index({ city: 1 });
-schema.index({ user: 1 });
-schema.index({ phone: 1 });
-schema.index({ 'meta.createdAt': 1 });
+schema.index({ start_time: 1 });
+schema.index({ end_time: 1 });
+schema.index({ admin: 1 });
+schema.index({ status: 1 });
+schema.index({ "meta.createdAt": 1 });
 schema.plugin(metaPlugin);
-module.exports = app => {
+module.exports = (app) => {
   const { mongoose } = app;
-  return mongoose.model('TrainLive', schema, 'trainLive');
+  return mongoose.model("TrainLive", schema, "trainLive");
 };

+ 23 - 0
app/model/consultation/trainVideo.js

@@ -0,0 +1,23 @@
+"use strict";
+const Schema = require("mongoose").Schema;
+const moment = require("moment");
+const metaPlugin = require("naf-framework-mongoose-free/lib/model/meta-plugin");
+const { ObjectId } = require("mongoose").Types;
+// 展会视频表表
+const train_video = {
+  train_id: { type: String }, // 展会id
+  title: { type: String }, // 标题
+  brief: { type: String }, // 简介
+  video_url: { type: String }, // 视频地址
+  remark: { type: String },
+};
+const schema = new Schema(train_video, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ dock_id: 1 });
+schema.index({ title: 1 });
+schema.index({ "meta.createdAt": 1 });
+schema.plugin(metaPlugin);
+module.exports = (app) => {
+  const { mongoose } = app;
+  return mongoose.model("TrainVideo", schema, "trainVideo");
+};

+ 18 - 20
app/model/dock/dock.js

@@ -1,24 +1,24 @@
-'use strict';
-const Schema = require('mongoose').Schema;
-const moment = require('moment');
-const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
-const { ObjectId } = require('mongoose').Types;
-const { Secret } = require('naf-framework-mongoose-free/lib/model/schema');
+"use strict";
+const Schema = require("mongoose").Schema;
+const moment = require("moment");
+const metaPlugin = require("naf-framework-mongoose-free/lib/model/meta-plugin");
+const { ObjectId } = require("mongoose").Types;
+const { Secret } = require("naf-framework-mongoose-free/lib/model/schema");
 // 展会表
 const dock = {
   room_id: { type: String, required: true }, // 房间号
   password: { type: Secret, select: false }, // 密码
-  title: { type: String, required: false, maxLength: 200 }, // 对接会标题
-  start_time: { type: String, required: true, maxLength: 200 }, // 开始时间
-  end_time: { type: String, required: true, maxLength: 200 }, // 结束时间
+  title: { type: String, required: false }, // 标题
+  start_time: { type: String, required: true }, // 开始时间
+  end_time: { type: String, required: true }, // 结束时间
   province: { type: String, required: false }, // 省
   city: { type: String, required: false }, // 市
-  admin: { type: String, required: false, maxLength: 200 }, // 负责人
-  phone: { type: String, required: false, maxLength: 200 }, // 负责人电话
-  sponsor: { type: String, required: false, maxLength: 200 }, // 主办方
-  organizer: { type: String, required: false, maxLength: 200 }, // 承办方
-  user_id: { type: ObjectId }, // 创建人
-  status: { type: String, default: '0' }, // 0-准备中;1-开始;-1-结束
+  admin: { type: String, required: false }, // 负责人
+  phone: { type: String, required: false }, // 负责人电话
+  sponsor: { type: String, required: false }, // 主办方
+  organizer: { type: String, required: false }, // 承办方
+  status: { type: String, default: "0" }, // 0-准备中;1-开始;-1-结束
+  role: { type: String, required: false, default: "6" }, // 角色
   remark: { type: String },
 };
 const schema = new Schema(dock, { toJSON: { virtuals: true } });
@@ -28,12 +28,10 @@ schema.index({ title: 1 });
 schema.index({ start_time: 1 });
 schema.index({ end_time: 1 });
 schema.index({ admin: 1 });
-schema.index({ sponsor: 1 });
-schema.index({ user_id: 1 });
 schema.index({ status: 1 });
-schema.index({ 'meta.createdAt': 1 });
+schema.index({ "meta.createdAt": 1 });
 schema.plugin(metaPlugin);
-module.exports = app => {
+module.exports = (app) => {
   const { mongoose } = app;
-  return mongoose.model('Dock', schema, 'dock');
+  return mongoose.model("Dock", schema, "dock");
 };

+ 14 - 14
app/model/dock/dockChat.js

@@ -1,25 +1,25 @@
-'use strict';
-const Schema = require('mongoose').Schema;
-const moment = require('moment');
-const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
-const { ObjectId } = require('mongoose').Types;
+"use strict";
+const Schema = require("mongoose").Schema;
+const moment = require("moment");
+const metaPlugin = require("naf-framework-mongoose-free/lib/model/meta-plugin");
+const { ObjectId } = require("mongoose").Types;
 // 展会公共聊天表
 const dock_chat = {
-  dock_id: { type: ObjectId, required: true }, // 展会id
-  content: { type: String, required: true }, // 内容
-  sender_id: { type: String, required: true }, // 发送人id
-  sender_name: { type: String, required: true }, // 发送人
+  dock_id: { type: String }, // 展会id
+  sender_id: { type: String }, // 发送人id
+  sender_name: { type: String }, // 发送人姓名
+  content: { type: String }, // 发送内容
+  send_time: { type: String }, //发送时间
   remark: { type: String, maxLength: 200 },
-  send_time: { type: String, default: moment().format('YYYY-MM-DD HH:mm:ss') },
 };
 const schema = new Schema(dock_chat, { toJSON: { virtuals: true } });
 schema.index({ id: 1 });
 schema.index({ dock_id: 1 });
-schema.index({ send_time: 1 });
 schema.index({ sender_id: 1 });
-schema.index({ 'meta.createdAt': 1 });
+schema.index({ sender_name: 1 });
+schema.index({ "meta.createdAt": 1 });
 schema.plugin(metaPlugin);
-module.exports = app => {
+module.exports = (app) => {
   const { mongoose } = app;
-  return mongoose.model('DockChat', schema, 'dockChat');
+  return mongoose.model("DockChat", schema, "dockChat");
 };

+ 6 - 3
app/model/dock/dockImgtxt.js

@@ -5,16 +5,19 @@ const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
 const { ObjectId } = require('mongoose').Types;
 // 展会图片表
 const dock_imgtxt = {
-  dock_id: { type: ObjectId, required: true }, // 展会id
+  dock_id: { type: String }, // 展会id
+  sender_id: { type: String }, // 发送人id
+  sender_name: { type: String }, // 发送人姓名
   content: { type: String }, // 信息内容
   img_url: { type: Array }, // 图片
-  file_url: { type: Array }, // 视频地址
-  user_id: { type: ObjectId }, // 创建人
+  video_url: { type: Array }, // 视频地址
+  send_time: { type: String }, // 发送时间
   remark: { type: String },
 };
 const schema = new Schema(dock_imgtxt, { toJSON: { virtuals: true } });
 schema.index({ id: 1 });
 schema.index({ dock_id: 1 });
+schema.index({ sender_id: 1 });
 schema.index({ 'meta.createdAt': 1 });
 schema.plugin(metaPlugin);
 module.exports = app => {

+ 7 - 8
app/model/dock/dockTranscation.js

@@ -5,16 +5,17 @@ const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
 const { ObjectId } = require('mongoose').Types;
 // 表
 const dock_transcation = {
-  dock_id: { type: ObjectId }, // 展会id
-  product_id: { type: ObjectId }, // 产品id
-  s_id: { type: ObjectId }, // 供给者id
+  dock_id: { type: String }, // 展会id
+  product_id: { type: String }, // 产品id
+  product_name: { type: String }, // 产品名称
+  s_id: { type: String }, // 供给者id
   s_name: { type: String }, // 供给者姓名
   s_phone: { type: String }, // 供给者电话
-  d_id: { type: ObjectId }, // 需求者id
+  d_id: { type: String }, // 需求者id
   d_name: { type: String }, // 需求者姓名
   d_phone: { type: String }, // 需求者电话
-  status: { type: String, default: '0' }, // 0-正在洽谈,1-达成意向,2-交易备案,3-交易完成,4-交易失败
-  contact: { type: String }, // 合同备份
+  status: { type: String, default: "0" }, // 0-正在洽谈,1-达成意向,2-交易备案,3-交易完成,4-交易失败
+  contact: { type: Array }, // 合同文件
   remark: { type: String },
 };
 const schema = new Schema(dock_transcation, { toJSON: { virtuals: true } });
@@ -22,9 +23,7 @@ schema.index({ id: 1 });
 schema.index({ dock_id: 1 });
 schema.index({ product_id: 1 });
 schema.index({ s_id: 1 });
-schema.index({ s_name: 1 });
 schema.index({ d_id: 1 });
-schema.index({ d_name: 1 });
 schema.index({ status: 1 });
 schema.index({ 'meta.createdAt': 1 });
 schema.plugin(metaPlugin);

+ 5 - 5
app/model/dock/dockUser.js

@@ -5,13 +5,13 @@ const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
 const { ObjectId } = require('mongoose').Types;
 // 展会用户表
 const dock_user = {
-  dock_id: { type: ObjectId, required: true }, // 展会id
-  user_id: { type: ObjectId }, // 申请人
-  name: { type: String }, // 名
-  phone: { type: String, required: false, maxLength: 200 }, // 电话
+  dock_id: { type: String }, // 展会id
+  user_id: { type: String }, // 用户id
+  user_name: { type: String }, // 用户姓
+  user_phone: { type: String, }, // 用户电话
   create_time: { type: String }, // 申请时间
   productList: { type: Array }, // 参展项目
-  status: { type: String, default: '0' }, // 0-待审核;1-审核通过;-1-审核拒绝
+  status: { type: String, default: "0" }, // 0-待审核;1-审核通过;-1-审核拒绝
   remark: { type: String },
 };
 const schema = new Schema(dock_user, { toJSON: { virtuals: true } });

+ 11 - 13
app/model/dock/dockVideo.js

@@ -1,25 +1,23 @@
-'use strict';
-const Schema = require('mongoose').Schema;
-const moment = require('moment');
-const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
-const { ObjectId } = require('mongoose').Types;
+"use strict";
+const Schema = require("mongoose").Schema;
+const moment = require("moment");
+const metaPlugin = require("naf-framework-mongoose-free/lib/model/meta-plugin");
+const { ObjectId } = require("mongoose").Types;
 // 展会视频表表
 const dock_video = {
-  dock_id: { type: ObjectId, required: true }, // 展会id
-  title: { type: String, required: false, maxLength: 200 }, // 标题
+  dock_id: { type: String }, // 展会id
+  title: { type: String }, // 标题
   brief: { type: String }, // 简介
-  file_url: { type: String }, // 视频地址
-  user_id: { type: ObjectId }, // 创建人
+  video_url: { type: String }, // 视频地址
   remark: { type: String },
 };
 const schema = new Schema(dock_video, { toJSON: { virtuals: true } });
 schema.index({ id: 1 });
 schema.index({ dock_id: 1 });
 schema.index({ title: 1 });
-schema.index({ user_id: 1 });
-schema.index({ 'meta.createdAt': 1 });
+schema.index({ "meta.createdAt": 1 });
 schema.plugin(metaPlugin);
-module.exports = app => {
+module.exports = (app) => {
   const { mongoose } = app;
-  return mongoose.model('DockVideo', schema, 'dockVideo');
+  return mongoose.model("DockVideo", schema, "dockVideo");
 };

+ 0 - 27
app/model/dock/dockVip.js

@@ -1,27 +0,0 @@
-'use strict';
-const Schema = require('mongoose').Schema;
-const moment = require('moment');
-const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
-const { ObjectId } = require('mongoose').Types;
-const { Secret } = require('naf-framework-mongoose-free/lib/model/schema');
-// 展会vip表
-const dock_vip = {
-  dock_id: { type: ObjectId, required: true }, // 展会id
-  name: { type: String }, // 名称
-  phone: { type: String, required: false, maxLength: 200 }, // 电话
-  password: { type: Secret, select: false }, // 密码
-  email: { type: String, required: false, maxLength: 200 }, // 邮箱
-  brief: { type: String, required: false, maxLength: 200 }, // 简介
-  remark: { type: String },
-};
-const schema = new Schema(dock_vip, { toJSON: { virtuals: true } });
-schema.index({ id: 1 });
-schema.index({ dock_id: 1 });
-schema.index({ name: 1 });
-schema.index({ phone: 1 });
-schema.index({ 'meta.createdAt': 1 });
-schema.plugin(metaPlugin);
-module.exports = app => {
-  const { mongoose } = app;
-  return mongoose.model('DockVip', schema, 'dockVip');
-};

+ 0 - 33
app/model/dock/patent.js

@@ -1,33 +0,0 @@
-'use strict';
-const Schema = require('mongoose').Schema;
-const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
-const { ObjectId } = require('mongoose').Types;
-// 专利表
-const PatentSchema = {
-  create_number: { type: String, required: false }, // 申请号
-  create_date: { type: String, required: false }, // 申请日
-  success_number: { type: String, required: false }, // 公开(公告)号
-  success_date: { type: String, required: false }, //  公开(公告)日
-  name: { type: String, required: false }, // 标题
-  inventor: { type: String, required: false }, // 发明人
-  address: { type: String, required: false }, // 发明人地址
-  apply_personal: { type: String, required: false }, // 申请人
-  term: { type: String, required: false }, // 专利有效性
-  type: { type: String, required: false }, // 专利类型
-  agent_personal: { type: String, required: false }, // 代理人
-  agent: { type: String, required: false }, // 代理机构
-  abstract: { type: String, required: false }, // 摘要
-  img_url: { type: String, required: false }, // 图片
-  origin: { type: String }, // 数据来源(手写的)
-  user_id: { type: [ ObjectId ] },
-};
-
-const schema = new Schema(PatentSchema, { toJSON: { virtuals: true } });
-schema.index({ id: 1 });
-schema.index({ 'meta.createdAt': 1 });
-schema.plugin(metaPlugin);
-
-module.exports = app => {
-  const { mongoose } = app;
-  return mongoose.model('Patent', schema, 'patent');
-};

+ 50 - 51
app/router.js

@@ -16,7 +16,7 @@ function getIPAdress() {
     }
   }
 }
-module.exports = app => {
+module.exports = (app) => {
   const { router, controller } = app;
   const { routePrefix, cluster } = app.config;
   const ipAddress = getIPAdress();
@@ -24,70 +24,69 @@ module.exports = app => {
   router.get(`${routePrefix}`, controller.home.index);
   router.get(`${routePrefix}/util/getConfig`, controller.util.getConfig);
   // user
-  require('./z_router/user/admin')(app); // 管理员
-  require('./z_router/user/expert')(app); // 专家
-  require('./z_router/user/inviteCode')(app); // 邀请码
-  require('./z_router/user/mechanism')(app); // 机构
-  require('./z_router/user/organization')(app); // 机构(o)
-  require('./z_router/user/personal')(app); // 个人账号
-  require('./z_router/user/personChat')(app); // 聊天消息
-  require('./z_router/user/personRoom')(app); // 聊天室
+  require("./z_router/user/admin")(app); // 管理员
+  require("./z_router/user/expert")(app); // 专家
+  require("./z_router/user/inviteCode")(app); // 邀请码
+  require("./z_router/user/mechanism")(app); // 机构
+  require("./z_router/user/organization")(app); // 机构(o)
+  require("./z_router/user/personal")(app); // 个人账号
+  require("./z_router/user/personChat")(app); // 聊天消息
+  require("./z_router/user/personRoom")(app); // 聊天室
 
   // channel
-  require('./z_router/channel/channel')(app); // 科技频道
-  require('./z_router/channel/channelVideo')(app); // 科技频道视频
+  require("./z_router/channel/channel")(app); // 科技频道
+  require("./z_router/channel/channelVideo")(app); // 科技频道视频
 
-  // consultation
-  require('./z_router/consultation/trainChat')(app); // 培训问诊聊天
-  require('./z_router/consultation/trainLive')(app); // 培训问诊
+  // consultation\
+  require("./z_router/consultation/trainLive")(app); // 培训问诊
+  require("./z_router/consultation/trainChat")(app); // 培训问诊聊天
+  require("./z_router/consultation/trainVideo")(app); // 培训问诊视频表
 
   // cysci
-  require('./z_router/cysci/cashing')(app); // 高企申报兑换
-  require('./z_router/cysci/coupons')(app); // 创新券
-  require('./z_router/cysci/couponsApply')(app); // 创新券申领
-  require('./z_router/cysci/declare')(app); // 高企申报
-  require('./z_router/cysci/reward')(app); // 研发补贴,奖励兑换申领
+  require("./z_router/cysci/cashing")(app); // 高企申报兑换
+  require("./z_router/cysci/coupons")(app); // 创新券
+  require("./z_router/cysci/couponsApply")(app); // 创新券申领
+  require("./z_router/cysci/declare")(app); // 高企申报
+  require("./z_router/cysci/reward")(app); // 研发补贴,奖励兑换申领
 
   // dock
-  require('./z_router/dock/dock')(app); // 展会
-  require('./z_router/dock/dockChat')(app); // 展会公共聊天
-  require('./z_router/dock/dockImgtxt')(app); // 展会图文
-  require('./z_router/dock/dockTranscation')(app); // 展会合同备份
-  require('./z_router/dock/dockUser')(app); // 展会用户
-  require('./z_router/dock/dockVideo')(app); // 展会视频
-  require('./z_router/dock/dockVip')(app); // 展会vip
-  require('./z_router/dock/patent')(app); // 专利
+  require("./z_router/dock/dock")(app); // 展会
+  require("./z_router/dock/dockChat")(app); // 展会公共聊天
+  require("./z_router/dock/dockImgtxt")(app); // 展会图文
+  require("./z_router/dock/dockTranscation")(app); // 展会合同备份
+  require("./z_router/dock/dockUser")(app); // 展会用户
+  require("./z_router/dock/dockVideo")(app); // 展会视频
 
   // kjzl
-  require('./z_router/kjzl/kjzlChat')(app); // 科教之旅-评价表
-  require('./z_router/kjzl/kjzlExpertView')(app); // 科教之旅-专家视点
-  require('./z_router/kjzl/kjzlMedium')(app); // 科教之旅-机构
-  require('./z_router/kjzl/kjzlMiniVideo')(app); // 科教微视频
-  require('./z_router/kjzl/kjzlOrder')(app); // 科教之旅-订单
-  require('./z_router/kjzl/kjzlRefute')(app); // 科教之旅-辟谣
+  require("./z_router/kjzl/kjzlChat")(app); // 科教之旅-评价表
+  require("./z_router/kjzl/kjzlExpertView")(app); // 科教之旅-专家视点
+  require("./z_router/kjzl/kjzlMedium")(app); // 科教之旅-机构
+  require("./z_router/kjzl/kjzlMiniVideo")(app); // 科教微视频
+  require("./z_router/kjzl/kjzlOrder")(app); // 科教之旅-订单
+  require("./z_router/kjzl/kjzlRefute")(app); // 科教之旅-辟谣
 
   // news
-  require('./z_router/news/column')(app); // 栏目
-  require('./z_router/news/interview')(app); // 嘉宾访谈
-  require('./z_router/news/news')(app); // 信息
-  require('./z_router/news/notice')(app); // 通知管理
-  require('./z_router/news/product')(app); // 产品
-  require('./z_router/news/projectSolic')(app); // 项目征集
-  require('./z_router/news/question')(app); // 调研考察
-  require('./z_router/news/roadShow')(app); // 项目路演
-  require('./z_router/news/science')(app); // 科技新闻
-  require('./z_router/news/survey')(app); // 建言献策,网上调查
-  require('./z_router/news/universal')(app); // 科学普及
-  require('./z_router/news/viewPoint')(app); // 智库视点
+  require("./z_router/news/column")(app); // 栏目
+  require("./z_router/news/interview")(app); // 嘉宾访谈
+  require("./z_router/news/news")(app); // 信息
+  require("./z_router/news/notice")(app); // 通知管理
+  require("./z_router/news/product")(app); // 产品
+  require("./z_router/news/projectSolic")(app); // 项目征集
+  require("./z_router/news/question")(app); // 调研考察
+  require("./z_router/news/roadShow")(app); // 项目路演
+  require("./z_router/news/science")(app); // 科技新闻
+  require("./z_router/news/survey")(app); // 建言献策,网上调查
+  require("./z_router/news/universal")(app); // 科学普及
+  require("./z_router/news/viewPoint")(app); // 智库视点
 
   // system
-  require('./z_router/system/category')(app); // 字典分类
-  require('./z_router/system/code')(app); // 字典
-  require('./z_router/system/menu')(app); // 菜单
-  require('./z_router/system/role')(app); // 角色
+  require("./z_router/system/category")(app); // 字典分类
+  require("./z_router/system/code")(app); // 字典
+  require("./z_router/system/menu")(app); // 菜单
+  require("./z_router/system/role")(app); // 角色
 
   // statistics
-  require('./z_router/statistics/index')(app); // 统计
+  require("./z_router/statistics/index")(app); // 统计
 
   // patent
-};
+};;;

+ 9 - 9
app/service/channel/channel.js

@@ -15,25 +15,25 @@ class ChannelService extends CrudService {
 
   async create(body) {
     const last = await this.model.findOne().sort({ room_id: -1 });
-    let room_id = 2001;
+    let room_id = "2001";
     if (last) room_id = last.room_id + 1;
     body.room_id = room_id;
-    body.passwd = { secret: room_id };
+    body.password = { secret: room_id };
     return await this.model.create(body);
   }
 
   /**
    * 管理者登陆
-   * @param {Object} { room_id, passwd } 登陆参数
+   * @param {Object} { room_id, password } 登陆参数
    * @property {String} room_id 房间号
-   * @property {String} passwd 密码
+   * @property {String} password 密码
    */
-  async login({ room_id, passwd }) {
-    const object = await this.model.findOne({ room_id }, '+passwd');
+  async login({ room_id, password }) {
+    const object = await this.model.findOne({ room_id }, '+password');
     if (!object) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, `未找到展会号为: ${room_id} 的展会`);
-    const op = _.get(object, 'passwd.secret');
-    if (!_.isEqual(op, passwd)) throw new BusinessError(ErrorCode.BAD_PASSWORD, '密码错误');
-    const data = _.omit(JSON.parse(JSON.stringify(object)), [ 'meta', 'passwd', '__v' ]);
+    const op = _.get(object, "password.secret");
+    if (!_.isEqual(op, password)) throw new BusinessError(ErrorCode.BAD_PASSWORD, '密码错误');
+    const data = _.omit(JSON.parse(JSON.stringify(object)), [ 'meta', 'password', '__v' ]);
     const { secret: jwts } = this.config.jwt;
     const token = jwt.sign(data, jwts);
     return token;

+ 17 - 16
app/service/consultation/trainChat.js

@@ -11,22 +11,23 @@ class TrainChatService extends CrudService {
     super(ctx, 'train_chat');
     this.model = this.ctx.model.Consultation.TrainChat;
   }
-  async create(query, { unit_id, sender_id, sender_name, content, role }) {
-    assert(sender_name, '缺少发言人信息');
-    assert(unit_id, '缺少会场id');
-    assert(content, '缺少发言内容');
-    const send_time = moment().format('YYYY-MM-DD HH:mm:ss');
-    const res = await this.model.create({ sender_id, sender_name, content, send_time, role, unit_id });
-    // TODO MQ
-    const { mq } = this.ctx;
-    if (mq) {
-      const exchange = 'train_live';
-      const parm = {
-        durable: true,
-        headers: {
-          userid: 1,
-        } };
-      await mq.fanout(exchange, unit_id, JSON.stringify(res), parm);
+  async create(data) {
+    const res = await this.model.create(data);
+    if (res) {
+      const exchange = "train_live";
+      const routeKey = `${res.train_id}`;
+      const content = JSON.stringify(_.pick(res, [ 'sender_id', 'sender_name', 'train_id', 'send_time', 'content' ]));
+      const param = { durable: true };
+      const { mq } = this.ctx;
+      if (mq) {
+        try {
+          await mq.topic(exchange, routeKey, content, param);
+        } catch (error) {
+          this.ctx.logger.error(error);
+        }
+      } else {
+        this.ctx.logger.error('!!!!!!没有配置MQ插件!!!!!!');
+      }
     }
     return res;
   }

+ 20 - 115
app/service/consultation/trainLive.js

@@ -1,14 +1,14 @@
-'use strict';
-const { CrudService } = require('naf-framework-mongoose-free/lib/service');
-const { BusinessError, ErrorCode } = require('naf-core').Error;
-const { ObjectId } = require('mongoose').Types;
-const assert = require('assert');
-const _ = require('lodash');
-const jwt = require('jsonwebtoken');
+"use strict";
+const { CrudService } = require("naf-framework-mongoose-free/lib/service");
+const { BusinessError, ErrorCode } = require("naf-core").Error;
+const { ObjectId } = require("mongoose").Types;
+const assert = require("assert");
+const _ = require("lodash");
+const jwt = require("jsonwebtoken");
 // 培训问诊表
 class TrainLiveService extends CrudService {
   constructor(ctx) {
-    super(ctx, 'trainlive');
+    super(ctx, "trainlive");
     this.model = this.ctx.model.Consultation.TrainLive;
   }
   /**
@@ -17,124 +17,29 @@ class TrainLiveService extends CrudService {
    */
   async create(body) {
     const last = await this.model.findOne().sort({ room_id: -1 });
-    let room_id = '3001',
-      password = '3001';
-    if (last) {
-      room_id = parseInt(_.get(last, 'room_id', '3000')) + 1;
-      password = room_id;
-    }
+    let room_id = "3001";
+    if (last) room_id = parseInt(last.room_id) + 1;
     body.room_id = room_id;
-    body.password = password;
+    body.password = { secret: room_id };
     return await this.model.create(body);
   }
 
   /**
-   * 查询指定培训问诊的参会人员
-   * @param {Object} {id} 培训问诊id
-   */
-  async userData({ id }) {
-    const object = await this.model.findOne({ _id: ObjectId(id) }, 'user_data');
-    if (!object) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到指定的培训问诊信息!');
-    return _.get(object, 'user_data');
-  }
-
-  /**
-   * 培训问诊管理登陆
-   * @param {Object} {room_id,password} 房间号,密码
+   * 展会管理者登陆
+   * @param {Object} { room_id, password } 登陆参数
+   * @property {String} room_id 房间号/电话
+   * @property {String} password 密码
    */
   async login({ room_id, password }) {
-    const object = await this.model.findOne({ room_id });
-    if (!object) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到指定的培训问诊信息!');
-    if (object.password !== password) throw new BusinessError(ErrorCode.BAD_PASSWORD, '密码错误!');
-    const data = _.omit(JSON.parse(JSON.stringify(object)), [ 'meta', 'passwd', '__v' ]);
+    const object = await this.model.findOne({ room_id }, '+password');
+    if (!object) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, `未找到展会号为: ${room_id} 的展会`);
+    const op = _.get(object, 'password.secret');
+    if (!_.isEqual(op, password)) throw new BusinessError(ErrorCode.BAD_PASSWORD, '密码错误');
+    const data = _.omit(JSON.parse(JSON.stringify(object)), [ 'meta', 'password', '__v' ]);
     const { secret: jwts } = this.config.jwt;
     const token = jwt.sign(data, jwts);
     return token;
   }
-
-  /**
-   * 为培训问诊添加参加用户
-   * @param {Object} {id} 培训问诊的数据id
-   * @param {Array} {users} 培训问诊的参加用户
-   */
-  async addUser({ id }, { users }) {
-    const object = await this.model.findOne({ _id: ObjectId(id) }, '+ user_data');
-    if (!object) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到指定的培训问诊信息!');
-    object.user_data.push(...users);
-    await object.save();
-  }
-
-  /**
-   * 更改培训问诊下指定用户的数据
-   * @param {Object} {id} 培训问诊的数据id
-   * @param {Array} {users} 用户的数据
-   */
-  async updateUser({ id }, { users }) {
-    const object = await this.model.findOne({ _id: ObjectId(id) }, '+ user_data');
-    if (!object) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到指定的培训问诊信息!');
-    for (const user of users) {
-      const { _id, ...info } = user;
-      if (_id) {
-        // 存在_id,修改
-        const oldData = object.user_data.id(ObjectId(_id));
-        if (!oldData) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到培训问诊下指定的参会人员信息!');
-        const keys = Object.keys(info);
-        for (const key of keys) {
-          oldData[key] = info[key];
-        }
-      }
-    }
-    await object.save();
-  }
-
-  /**
-   *移除培训问诊下指定用户
-   * @param {Object} {id} 培训问诊的数据id
-   * @param {Object} {users} 用户的数据id集合
-   */
-  async deleteUser({ id }, { users }) {
-    const object = await this.model.findOne({ _id: ObjectId(id) }, '+ user_data');
-    if (!object) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到指定的培训问诊信息!');
-    object.user_data = object.user_data.filter(f => !users.find(uf => ObjectId(uf).equals(f._id)));
-    await object.save();
-  }
-  /**
-   * 参会人员登陆
-   * @param {Object} {id} 培训问诊的数据id
-   * @param {Object} user 参会人员的信息,手机号和密码
-   */
-  async userLogin({ id }, { user_phone, user_password }) {
-    assert(user_phone, '缺少登陆的参会人员 手机号');
-    assert(user_password, '缺少登陆的参会人员 密码');
-    const object = await this.model.findOne({ _id: ObjectId(id) }, '+ user_data');
-    if (!object) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到指定的培训问诊信息!');
-    const user = object.user_data.find(f => f.user_phone === user_phone);
-    if (!user) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到培训问诊下该手机号的用户信息!');
-    const is_login = this.ctx.session[`trainlive/${user._id}`];
-    if (is_login) throw new BusinessError(ErrorCode.BUSINESS, '用户已登录');
-    if (user.user_password !== user_password) throw new BusinessError(ErrorCode.BAD_PASSWORD, '用户密码错误!');
-    this.ctx.session[`trainlive/${user._id}`] = user;
-    const { secret: jwts } = this.config.jwt;
-    const token = jwt.sign(JSON.parse(JSON.stringify(user)), jwts);
-    return token;
-  }
-
-  /**
-   * 延长用户登陆时效
-   * @param {Object} {id} 用户id
-   */
-  async userLonger({ id }) {
-    const is_login = this.ctx.session[`trainlive/${id}`];
-    if (!is_login) throw new BusinessError(ErrorCode.BUSINESS, '用户登陆已失效,请重新登陆');
-  }
-
-  /**
-   * 参会人员注销
-   * @param {String} {id} 参会人员id
-   */
-  async userLogout({ id }) {
-    this.ctx.session[`trainlive/${id}`] = null;
-  }
 }
 
 module.exports = TrainLiveService;

+ 15 - 0
app/service/consultation/trainVideo.js

@@ -0,0 +1,15 @@
+'use strict';
+const { CrudService } = require('naf-framework-mongoose-free/lib/service');
+const { BusinessError, ErrorCode } = require('naf-core').Error;
+const _ = require('lodash');
+const assert = require('assert');
+
+// 展会视频
+class TrainVideoService extends CrudService {
+  constructor(ctx) {
+    super(ctx, "train_video");
+    this.model = this.ctx.model.Consultation.TrainVideo;
+  }
+}
+
+module.exports = TrainVideoService;

+ 3 - 3
app/service/dock/dock.js

@@ -13,7 +13,7 @@ class DockService extends CrudService {
   }
   async create(body) {
     const last = await this.model.findOne().sort({ room_id: -1 });
-    let room_id = '1001';
+    let room_id = "1001";
     if (last) room_id = parseInt(last.room_id) + 1;
     body.room_id = room_id;
     body.password = { secret: room_id };
@@ -22,8 +22,8 @@ class DockService extends CrudService {
 
   /**
    * 展会管理者登陆
-   * @param {Object} { room_phone, password } 登陆参数
-   * @property {String} room_phone 房间号/电话
+   * @param {Object} { room_id, password } 登陆参数
+   * @property {String} room_id 房间号/电话
    * @property {String} password 密码
    */
   async login({ room_id, password }) {

+ 0 - 42
app/service/dock/dockVip.js

@@ -1,42 +0,0 @@
-'use strict';
-const { CrudService } = require('naf-framework-mongoose-free/lib/service');
-const { BusinessError, ErrorCode } = require('naf-core').Error;
-const _ = require('lodash');
-const assert = require('assert');
-const jwt = require('jsonwebtoken');
-
-// 展会vip
-class DockVipService extends CrudService {
-  constructor(ctx) {
-    super(ctx, 'dock_vip');
-    this.model = this.ctx.model.Dock.DockVip;
-    this.dock = this.ctx.model.Dock.Dock;
-  }
-  async create(data) {
-    const { dock_id } = data;
-    const dock = await this.dock.findById(dock_id);
-    if (!dock) new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到指定展会!');
-    const { room_id } = dock;
-    data.password = { secret: room_id };
-    return await this.model.create(data);
-  }
-  /**
-   * 展会管理者登陆
-   * @param {Object} { dock_id } 展会id
-   * @param {Object} { phone, password } 登陆参数
-   * @property {String} phone 电话
-   * @property {String} password 密码
-   */
-  async login({ dock_id }, { phone, password }) {
-    const object = await this.model.findOne({ phone, dock_id }, '+password');
-    if (!object) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到vip用户');
-    const op = _.get(object, 'password.secret');
-    if (!_.isEqual(op, password)) throw new BusinessError(ErrorCode.BAD_PASSWORD, '密码错误');
-    const data = _.omit(JSON.parse(JSON.stringify(object)), [ 'meta', 'password', '__v' ]);
-    const { secret: jwts } = this.config.jwt;
-    const token = jwt.sign(data, jwts);
-    return token;
-  }
-}
-
-module.exports = DockVipService;

+ 0 - 331
app/service/dock/patent.js

@@ -1,331 +0,0 @@
-'use strict';
-
-const assert = require('assert');
-const moment = require('moment');
-const Excel = require('exceljs');
-const Path = require('path');
-const _ = require('lodash');
-const { sep } = require('path');
-const fs = require('fs');
-const { CrudService } = require('naf-framework-mongoose-free/lib/service');
-const { BusinessError, ErrorCode } = require('naf-core').Error;
-const { trimData } = require('naf-core').Util;
-
-class PatentService extends CrudService {
-  constructor(ctx) {
-    super(ctx, 'patent');
-    this.model = this.ctx.model.Dock.Patent;
-    this.personalModel = this.ctx.model.User.Personal;
-    this.organizationModel = this.ctx.model.User.Organization;
-    this.root_path = _.get(this.ctx.app.config.export, 'root_path');
-    if (process.env.NODE_ENV === 'development') this.root_path = 'E:\\exportFile\\';
-    this.file_type = '';
-    if (!fs.existsSync(`${this.root_path}${this.file_type}`)) {
-      // 如果不存在文件夹,就创建
-      fs.mkdirSync(`${this.root_path}${this.file_type}`);
-    }
-    this.excel_path = `${sep}excel${sep}`;
-    this.domain = 'http://127.0.0.1';
-    this.export_limit = 50;
-  }
-
-  async query(query, { skip = 0, limit = 0 }) {
-    query = await this.resetCode(query);
-    const res = await this.model.find(query).skip(parseInt(skip)).limit(parseInt(limit))
-      .sort({ 'meta.createdAt': -1 });
-    return res;
-
-  }
-  async count(query) {
-    query = await this.resetCode(query);
-    const res = await this.model.countDocuments(trimData(query)).exec();
-    return res;
-  }
-
-  async resetCode(query) {
-    query = this.ctx.service.util.util.dealQuery(query);
-    const { type } = query;
-    if (type === 'else') {
-      query.$and = [{ type: { $ne: '发明' } }, { type: { $ne: '实用新型' } }];
-      delete query.type;
-    }
-    const { code } = query;
-    let ids = [];
-    if (code) {
-      const plist = await this.personalModel.find({ code });
-      ids = plist.map(i => i._id);
-      const olist = await this.organizationModel.find({ code });
-      ids = [ ...ids, ...olist.map(i => i._id) ];
-    }
-    if (ids.length > 0) {
-      query.user_id = { $elemMatch: { $in: ids } };
-      delete query.code;
-    }
-    return query;
-  }
-
-  async toImport({ uri, origin }) {
-    assert(uri, '未获取到文件地址');
-    const file = await this.ctx.curl(`${this.domain}${uri}`);
-    if (!(file && file.data)) {
-      throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到指定文件');
-    }
-    const workbook = new Excel.Workbook();
-    await workbook.xlsx.load(file.data);
-    const sheet = workbook.getWorksheet(1);
-    const arr = [];
-    const allNotice = [];
-    const sheetImageInfo = sheet.getImages();
-    const imgids = _.compact(sheetImageInfo.map(i => {
-      const { imageId, range } = i;
-      const row = _.get(range, 'tl.nativeRow');
-      if (row) return { row, imageId };
-    }));
-    sheet.eachRow((row, rindex) => {
-      if (rindex !== 1) {
-        // 组织数据,图片的索引和行索引不一致,准确的说是:图片索引比行索引少1
-        // 原因:图片在工作簿中获取,按照1,2,3...顺序排序,但是行的第一行是表头(当前文件),所以当前行数需要减掉表头那一行
-        const imgid = imgids.find(f => f.row === rindex - 1);
-        let img_url;
-        if (imgid) { img_url = this.turnImageToBase64(workbook.getImage(imgid.imageId)); }
-        const create_number = row.getCell(2).value || undefined,
-          create_date =
-            moment(row.getCell(3).value).format('YYYY-MM-DD') || undefined,
-          success_number = row.getCell(4).value || undefined,
-          success_date =
-            moment(row.getCell(5).value).format('YYYY-MM-DD') || undefined,
-          inventor = row.getCell(6).value || undefined,
-          agent = row.getCell(7).value || undefined,
-          agent_personal = row.getCell(8).value || undefined,
-          abstract = row.getCell(9).value || undefined,
-          address = row.getCell(10).value || undefined,
-          name = row.getCell(11).value || undefined,
-          apply_personal = row.getCell(12).value || undefined,
-          term = row.getCell(13).value || undefined,
-          type = row.getCell(14).value || undefined,
-          number = row.getCell(1).value || undefined;
-        const obj = {
-          create_number,
-          create_date,
-          success_number,
-          success_date,
-          inventor,
-          agent,
-          agent_personal,
-          abstract,
-          address,
-          name,
-          apply_personal,
-          term,
-          type,
-          img_url,
-          number,
-          origin,
-        };
-        // 此处添加判断条件,不限制则不需要加,直接放过即可
-        const { result, notice } = this.tocheckData(obj);
-        if (result) {
-          arr.push(obj);
-        } else {
-          allNotice.push(notice);
-        }
-      }
-    });
-    if (allNotice.length > 0) return allNotice;
-    await this.model.insertMany(arr);
-
-  }
-  async toExport({ user }) {
-    const data = {
-      title: '专利导出',
-      params: {
-        project: 'market',
-        service: 'dock.patent',
-        method: 'export',
-      },
-      user,
-      teannt: 'live',
-    };
-    try {
-      await this.ctx.service.util.httpUtil.cpost('/api/mission', 'mission', data);
-    } catch (error) {
-      console.log(error);
-      throw new BusinessError(ErrorCode.SERVICE_FAULT, '任务创建失败');
-
-    }
-  }
-
-  async export({ missionid }) {
-    const nowDate = new Date().getTime();
-    const filename = `导出结果-${nowDate}.xlsx`;
-    const path = `${this.root_path}${this.file_type}${this.excel_path}`;
-    if (!path) {
-      throw new BusinessError(ErrorCode.BUSINESS, '服务端没有设置存储路径');
-    }
-    if (!fs.existsSync(path)) {
-      // 如果不存在文件夹,就创建
-      fs.mkdirSync(path);
-    }
-    const total = await this.model.count();
-    let skip = 0;
-    let downloadPath;
-    // 将数据分割,否则容易直接把js堆栈干满了,服务就炸了
-    for (let i = 0; i < total; i = i + this.export_limit) {
-      const list = await this.model.find().skip(skip).limit(this.export_limit);
-      skip = skip + this.export_limit;
-      downloadPath = await this.asyncExport(list, filename, path, downloadPath);
-      try {
-        const data = {
-          progress: _.ceil((skip / total) * 100),
-          status: '1',
-          id: missionid,
-        };
-        this.ctx.service.util.httpUtil.cpost('/api/mission/progress', 'mission', data);
-      } catch (error) {
-        this.logger.error(`任务id:${missionid},进度更新失败`);
-      }
-    }
-    try {
-      const data = {
-        progress: 100,
-        status: '2',
-        uri: downloadPath,
-      };
-      await this.ctx.service.util.httpUtil.cpost(`/api/mission/update/${missionid}`, 'mission', data);
-    } catch (error) {
-      this.logger.error(`任务id:${missionid},已完成更新失败`);
-    }
-    return downloadPath;
-
-  }
-
-  async asyncExport(list, filename, path, downloadPath) {
-    const workbook = new Excel.Workbook();
-    let sheet;
-    if (!downloadPath) {
-      sheet = workbook.addWorksheet('sheet');
-    } else {
-      const file = await this.ctx.curl(`${this.domain}${downloadPath}`);
-      if (!(file && file.data)) {
-        throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到指定文件');
-      }
-      await workbook.xlsx.load(file.data);
-      sheet = workbook.getWorksheet('sheet');
-    }
-    const rowNumber = sheet.rowCount || 1;
-    const meta = this.getHeader();
-    sheet.columns = meta;
-    sheet.addRows(list);
-    for (let i = 0; i < list.length; i++) {
-      const e = list[i];
-      const { img_url, _id } = e;
-      try {
-        if (img_url) {
-          const is_base64 = img_url.includes('base64,');
-          let imgid;
-          if (is_base64) {
-            imgid = workbook.addImage({
-              base64: img_url,
-              extension: 'jpeg',
-            });
-          } else if (img_url.includes('/files')) {
-            const prefix = `${this.root_path}`;
-            const new_url = img_url.replace('/files', prefix);
-            const suffix = Path.extname(img_url).substring(1);
-            imgid = workbook.addImage({
-              filename: new_url,
-              extension: suffix,
-            });
-          } else {
-            // 什么都不是,那就下一个
-            continue;
-          }
-
-          sheet.addImage(imgid, {
-            tl: { col: 13.2, row: i + rowNumber + 0.2 },
-            br: { col: 14, row: i + rowNumber + 1 },
-          });
-        }
-      } catch (error) {
-        this.ctx.logger.error(`导出,id为:${_id}的图片处理出现错误!`);
-      }
-
-    }
-    const filepath = `${path}${filename}`;
-    if (list.length <= 0) return;
-    await workbook.xlsx.writeFile(filepath);
-    return `/files/excel/${filename}`;
-  }
-
-  /**
-   * 检查数据是否没填 必填项
-   * @param {Object} object 每行数据,已转换成model的字段名
-   */
-  tocheckData(object) {
-    let result = true;
-    const { number } = object;
-    let notice;
-    const arr = [
-      { column: 'create_number', zh: '申请号' },
-      { column: 'create_date', zh: '申请日' },
-      { column: 'success_number', zh: '公开(公告)号' },
-      { column: 'success_date', zh: '公开(公告)日' },
-      { column: 'name', zh: '标题' },
-    ];
-    const word = [];
-    for (const o of arr) {
-      const { column, zh } = o;
-      if (!_.get(object, column)) {
-        result = false;
-        word.push(`${zh}`);
-      }
-    }
-    if (!result) {
-      notice = `序号${number}缺少:${word.join(';')}`;
-    }
-    return { result, notice };
-  }
-
-  /**
-   * 转换图片为base64
-   * @param {Object} object excel获取的图片object
-   * @property extension  后缀,文件类型
-   * @property buffer 图片内容,不含头部信息的,
-   */
-  turnImageToBase64(object = {}) {
-    const { extension, buffer } = object;
-    if (extension && buffer) {
-      const suffix = object.extension;
-      const ib = object.buffer.toString('base64');
-      const base64 = `data:image/${suffix};base64,${ib}`;
-      return base64;
-    }
-  }
-
-  getHeader() {
-    const arr = [
-      { header: '申请号', key: 'create_number', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
-      { header: '申请日', key: 'create_date', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
-      { header: '公开(公告)号', key: 'success_number', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
-      { header: '公开(公告)日', key: 'success_date', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
-      { header: '发明人', key: 'inventor', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
-      { header: '代理机构', key: 'agent', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
-      { header: '代理人', key: 'agent_personal', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
-      { header: '摘要', key: 'abstract', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
-      { header: '发明人地址', key: 'address', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
-      { header: '标题', key: 'name', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
-      { header: '申请人', key: 'apply_personal', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
-      { header: '专利有效性', key: 'term', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
-      { header: '专利类型', key: 'type', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
-      { header: '首页附图', width: 30, style: { alignment: { wrapText: true, vertical: 'middle', horizontal: 'center' } } },
-    ];
-    return arr;
-  }
-
-  async getByCreateNumber({ create_number }) {
-    const data = await this.model.findOne({ create_number });
-    return data;
-  }
-}
-
-module.exports = PatentService;

+ 0 - 8
app/z_router/consultation/trainLive.js

@@ -4,15 +4,7 @@ const rkey = 'trainLive';
 const ckey = 'consultation.trainLive';
 const keyZh = '培训问诊';
 const routes = [
-  { method: 'get', path: `${rkey}/user/longer/:id`, controller: `${ckey}.userLonger`, name: `${ckey}userLonger`, zh: `${keyZh}延长登陆` },
   { method: 'post', path: `${rkey}/login`, controller: `${ckey}.login`, name: `${ckey}login`, zh: `${keyZh}管理登陆` },
-  { method: 'post', path: `${rkey}/user/login/:id`, controller: `${ckey}.userLogin`, name: `${ckey}userLogin`, zh: `${keyZh}用户登陆` },
-  { method: 'post', path: `${rkey}/user/logout/:id`, controller: `${ckey}.userLogout`, name: `${ckey}userLogout`, zh: `${keyZh}用户登出` },
-  { method: 'post', path: `${rkey}/user/:id`, controller: `${ckey}.addUser`, name: `${ckey}addUser`, zh: `${keyZh}添加用户` },
-  { method: 'delete', path: `${rkey}/user/:id`, controller: `${ckey}.deleteUser`, name: `${ckey}deleteUser`, zh: `${keyZh}删除用户` },
-  { method: 'post', path: `${rkey}/user/update/:id`, controller: `${ckey}.updateUser`, name: `${ckey}updateUser`, zh: `${keyZh}修改用户` },
-  { method: 'get', path: `${rkey}/user/:id`, controller: `${ckey}.userData`, name: `${ckey}userData`, zh: `${keyZh}获取用户` },
-
   { method: 'get', path: `${rkey}`, controller: `${ckey}.index`, name: `${ckey}Query`, zh: `${keyZh}列表查询` },
   { method: 'get', path: `${rkey}/:id`, controller: `${ckey}.show`, name: `${ckey}Show`, zh: `${keyZh}查询` },
   { method: 'post', path: `${rkey}`, controller: `${ckey}.create`, name: `${ckey}Create`, zh: `创建${keyZh}` },

+ 3 - 4
app/z_router/dock/dockVip.js

@@ -1,10 +1,9 @@
 'use strict';
 // 路由配置
-const rkey = 'dockVip';
-const ckey = 'dock.dockVip';
-const keyZh = '展会vip';
+const rkey = "trainLive";
+const ckey = "consultation.trainVideo";
+const keyZh = '展会视频';
 const routes = [
-  { method: 'post', path: `${rkey}/login/:id`, controller: `${ckey}.login`, name: `${ckey}login`, zh: `${keyZh}登陆` },
   { method: 'get', path: `${rkey}`, controller: `${ckey}.index`, name: `${ckey}Query`, zh: `${keyZh}列表查询` },
   { method: 'get', path: `${rkey}/:id`, controller: `${ckey}.show`, name: `${ckey}Show`, zh: `${keyZh}查询` },
   { method: 'post', path: `${rkey}`, controller: `${ckey}.create`, name: `${ckey}Create`, zh: `创建${keyZh}` },

+ 0 - 33
app/z_router/dock/patent.js

@@ -1,33 +0,0 @@
-'use strict';
-// 路由配置
-const rkey = 'patent';
-const ckey = 'dock.patent';
-const keyZh = '专利';
-const routes = [
-  { method: 'post', path: `${rkey}/import`, controller: `${ckey}.toImport`, name: `${ckey}import`, zh: `${keyZh}导入` },
-  { method: 'post', path: `${rkey}/export`, controller: `${ckey}.toExport`, name: `${ckey}export`, zh: `${keyZh}导出` },
-  { method: 'get', path: `${rkey}/getByCN/:create_number`, controller: `${ckey}.getByCN`, name: `${ckey}getByCN`, zh: `查询${keyZh}-由申请号获取` },
-
-  { method: 'get', path: `${rkey}`, controller: `${ckey}.index`, name: `${ckey}Query`, zh: `${keyZh}列表查询` },
-  { method: 'get', path: `${rkey}/:id`, controller: `${ckey}.show`, name: `${ckey}Show`, zh: `${keyZh}查询` },
-  { method: 'post', path: `${rkey}`, controller: `${ckey}.create`, name: `${ckey}Create`, zh: `创建${keyZh}` },
-  { method: 'post', path: `${rkey}/:id`, controller: `${ckey}.update`, name: `${ckey}Update`, zh: `修改${keyZh}` },
-  { method: 'delete', path: `${rkey}/:id`, controller: `${ckey}.destroy`, name: `${ckey}Delete`, zh: `删除${keyZh}` },
-];
-
-module.exports = app => {
-  const { router, config } = app;
-  const mwares = app.middleware;
-  console.log(`${keyZh}:  ${rkey}`);
-  for (const route of routes) {
-    const { method, path, controller: ctl, zh } = route;
-    let { middleware = [] } = route;
-    if (!method || !path || !ctl) continue;
-    // 拼全路径
-    const allPath = `${config.routePrefix}/${path}`;
-    // 处理中间件
-    if (middleware.length > 0) middleware = middleware.map(i => mwares[i]({ enable: true }));
-    // 注册路由
-    router[method](zh, allPath, ...middleware, ctl);
-  }
-};