lrf 3 năm trước cách đây
commit
41cbed7a2f
100 tập tin đã thay đổi với 3524 bổ sung0 xóa
  1. 29 0
      .autod.conf.js
  2. 1 0
      .eslintignore
  3. 3 0
      .eslintrc
  4. 46 0
      .github/workflows/nodejs.yml
  5. 14 0
      .gitignore
  6. 12 0
      .travis.yml
  7. 5 0
      README.md
  8. 28 0
      app.js
  9. 13 0
      app/controller/channel/channel.js
  10. 13 0
      app/controller/channel/channelVideo.js
  11. 45 0
      app/controller/channel/config/.channel.js
  12. 39 0
      app/controller/channel/config/.channelVideo.js
  13. 31 0
      app/controller/consultation/config/.trainChat.js
  14. 102 0
      app/controller/consultation/config/.trainLive.js
  15. 13 0
      app/controller/consultation/trainChat.js
  16. 13 0
      app/controller/consultation/trainLive.js
  17. 13 0
      app/controller/cysci/cashing.js
  18. 96 0
      app/controller/cysci/config/.cashing.js
  19. 73 0
      app/controller/cysci/config/.coupons.js
  20. 76 0
      app/controller/cysci/config/.couponsApply.js
  21. 70 0
      app/controller/cysci/config/.declare.js
  22. 72 0
      app/controller/cysci/config/.mechanism.js
  23. 68 0
      app/controller/cysci/config/.reward.js
  24. 13 0
      app/controller/cysci/coupons.js
  25. 13 0
      app/controller/cysci/couponsApply.js
  26. 17 0
      app/controller/cysci/declare.js
  27. 13 0
      app/controller/cysci/reward.js
  28. 33 0
      app/controller/home.js
  29. 13 0
      app/controller/user/admin.js
  30. 55 0
      app/controller/user/config/.admin.js
  31. 81 0
      app/controller/user/config/.expert.js
  32. 39 0
      app/controller/user/config/.inviteCode.js
  33. 54 0
      app/controller/user/config/.mechanism.js
  34. 133 0
      app/controller/user/config/.organization.js
  35. 64 0
      app/controller/user/config/.personChat.js
  36. 42 0
      app/controller/user/config/.personRoom.js
  37. 122 0
      app/controller/user/config/.personal.js
  38. 17 0
      app/controller/user/expert.js
  39. 13 0
      app/controller/user/inviteCode.js
  40. 13 0
      app/controller/user/mechanism.js
  41. 13 0
      app/controller/user/organization.js
  42. 14 0
      app/controller/user/personChat.js
  43. 17 0
      app/controller/user/personRoom.js
  44. 13 0
      app/controller/user/personal.js
  45. 68 0
      app/controller/util.js
  46. 42 0
      app/middleware/coupons_apply.js
  47. 24 0
      app/middleware/create_password.js
  48. 36 0
      app/middleware/create_time.js
  49. 41 0
      app/middleware/disclosure_report.js
  50. 36 0
      app/middleware/dock_transcation.js
  51. 34 0
      app/middleware/medium.js
  52. 34 0
      app/middleware/patentapply_record.js
  53. 37 0
      app/middleware/person_room.js
  54. 53 0
      app/middleware/request-log.js
  55. 26 0
      app/model/channel/channel.js
  56. 24 0
      app/model/channel/channelVideo.js
  57. 26 0
      app/model/consultation/trainChat.js
  58. 47 0
      app/model/consultation/trainLive.js
  59. 44 0
      app/model/cysci/cashing.js
  60. 37 0
      app/model/cysci/coupons.js
  61. 37 0
      app/model/cysci/couponsApply.js
  62. 37 0
      app/model/cysci/declare.js
  63. 33 0
      app/model/cysci/reward.js
  64. 39 0
      app/model/dock/dock.js
  65. 25 0
      app/model/dock/dockChat.js
  66. 23 0
      app/model/dock/dockImgtxt.js
  67. 34 0
      app/model/dock/dockTranscation.js
  68. 30 0
      app/model/dock/dockUser.js
  69. 25 0
      app/model/dock/dockVideo.js
  70. 27 0
      app/model/dock/dockVip.js
  71. 33 0
      app/model/dock/patent.js
  72. 12 0
      app/model/index.md
  73. 28 0
      app/model/kjzl/kjzlChat.js
  74. 22 0
      app/model/kjzl/kjzlExpertView.js
  75. 38 0
      app/model/kjzl/kjzlMedium.js
  76. 22 0
      app/model/kjzl/kjzlMiniVideo.js
  77. 40 0
      app/model/kjzl/kjzlOrder.js
  78. 25 0
      app/model/kjzl/kjzlRefute.js
  79. 20 0
      app/model/news/column.js
  80. 28 0
      app/model/news/interview.js
  81. 37 0
      app/model/news/news.js
  82. 28 0
      app/model/news/notice.js
  83. 70 0
      app/model/news/product.js
  84. 47 0
      app/model/news/projectSolic.js
  85. 26 0
      app/model/news/question.js
  86. 32 0
      app/model/news/roadShow.js
  87. 25 0
      app/model/news/science.js
  88. 31 0
      app/model/news/survey.js
  89. 30 0
      app/model/news/universal.js
  90. 33 0
      app/model/news/viewPoint.js
  91. 30 0
      app/model/patent/agentMech.js
  92. 41 0
      app/model/patent/answerTea.js
  93. 29 0
      app/model/patent/dimension.js
  94. 41 0
      app/model/patent/disclosure.js
  95. 18 0
      app/model/patent/importTemp.js
  96. 22 0
      app/model/patent/notice.js
  97. 36 0
      app/model/patent/patentanalysis.js
  98. 47 0
      app/model/patent/patentapply.js
  99. 47 0
      app/model/patent/patentassess.js
  100. 0 0
      app/model/patent/patentchat.js

+ 29 - 0
.autod.conf.js

@@ -0,0 +1,29 @@
+'use strict';
+
+module.exports = {
+  write: true,
+  prefix: '^',
+  plugin: 'autod-egg',
+  test: [
+    'test',
+    'benchmark',
+  ],
+  dep: [
+    'egg',
+    'egg-scripts',
+  ],
+  devdep: [
+    'egg-ci',
+    'egg-bin',
+    'egg-mock',
+    'autod',
+    'autod-egg',
+    'eslint',
+    'eslint-config-egg',
+  ],
+  exclude: [
+    './test/fixtures',
+    './dist',
+  ],
+};
+

+ 1 - 0
.eslintignore

@@ -0,0 +1 @@
+coverage

+ 3 - 0
.eslintrc

@@ -0,0 +1,3 @@
+{
+  "extends": "eslint-config-egg"
+}

+ 46 - 0
.github/workflows/nodejs.yml

@@ -0,0 +1,46 @@
+# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
+# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
+
+name: Node.js CI
+
+on:
+  push:
+    branches:
+      - main
+      - master
+  pull_request:
+    branches:
+      - main
+      - master
+  schedule:
+    - cron: '0 2 * * *'
+
+jobs:
+  build:
+    runs-on: ${{ matrix.os }}
+
+    strategy:
+      fail-fast: false
+      matrix:
+        node-version: [10]
+        os: [ubuntu-latest, windows-latest, macos-latest]
+
+    steps:
+    - name: Checkout Git Source
+      uses: actions/checkout@v2
+
+    - name: Use Node.js ${{ matrix.node-version }}
+      uses: actions/setup-node@v1
+      with:
+        node-version: ${{ matrix.node-version }}
+
+    - name: Install Dependencies
+      run: npm i -g npminstall && npminstall
+
+    - name: Continuous Integration
+      run: npm run ci
+
+    - name: Code Coverage
+      uses: codecov/codecov-action@v1
+      with:
+        token: ${{ secrets.CODECOV_TOKEN }}

+ 14 - 0
.gitignore

@@ -0,0 +1,14 @@
+logs/
+npm-debug.log
+yarn-error.log
+node_modules/
+package-lock.json
+yarn.lock
+coverage/
+.idea/
+run/
+.DS_Store
+*.sw*
+*.un~
+typings/
+.nyc_output/

+ 12 - 0
.travis.yml

@@ -0,0 +1,12 @@
+
+language: node_js
+node_js:
+  - '10'
+before_install:
+  - npm i npminstall -g
+install:
+  - npminstall
+script:
+  - npm run ci
+after_script:
+  - npminstall codecov && codecov

+ 5 - 0
README.md

@@ -0,0 +1,5 @@
+# 中科在线 V2 服务端-前台
+## 有 网站内容 和 用户管理
+
+### 文件,变量,表名 统一以驼峰方式命名
+

+ 28 - 0
app.js

@@ -0,0 +1,28 @@
+'use strict';
+class AppBootHook {
+  constructor(app) {
+    this.app = app;
+  }
+
+  async willReady() {
+    // const data = await this.app.model.Admin.findOne();
+    // if (!data) {
+    //   // 没有管理员,初始化一个
+    //   const data = {
+    //     account: 'admin',
+    //     password: { secret: '1qaz2wsx' },
+    //   };
+    //   await this.app.model.Admin.create(data);
+    // }
+  }
+
+  async serverDidReady() {
+    // 应用已经启动完毕
+    // const ctx = await this.app.createAnonymousContext();
+    // 检查种子
+    // await ctx.service.install.index();
+    // await ctx.service.util.rabbitMq.mission();
+  }
+
+}
+module.exports = AppBootHook;

+ 13 - 0
app/controller/channel/channel.js

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./config/.channel.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
+
+// 科技频道
+class ChannelController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.channel.channel;
+  }
+}
+module.exports = CrudController(ChannelController, meta);

+ 13 - 0
app/controller/channel/channelVideo.js

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./config/.channelVideo.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
+
+// 科技频道-视频
+class ChannelVideoController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.channel.channelVideo;
+  }
+}
+module.exports = CrudController(ChannelVideoController, meta);

+ 45 - 0
app/controller/channel/config/.channel.js

@@ -0,0 +1,45 @@
+module.exports = {
+  create: {
+    requestBody: ["user_id", "title", "origin", "type", "desc"],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: ["user_id", "title", "origin", "type", "desc"],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        user_id:"user_id",
+        room_id:"room_id",
+        type:"type",
+        "create_time@start": "create_time@start",
+        "create_time@end": "create_time@end",
+      },
+      // options: {
+      //   "meta.state": 0 // 默认条件
+      // },
+    },
+    service: "query",
+    options: {
+      query: ["skip", "limit"],
+      sort: ["meta.createdAt"],
+      desc: true,
+      count: true,
+    },
+  },
+  // 登陆
+  login: {
+    requestBody: ["room_id", "passwd"],
+    service: "login",
+  },
+};

+ 39 - 0
app/controller/channel/config/.channelVideo.js

@@ -0,0 +1,39 @@
+module.exports = {
+  create: {
+    requestBody: ["channel_id", "title", "start_time", "end_time", "file_path"],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: ["channel_id", "title", "start_time", "end_time", "file_path"],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        channel_id: "channel_id",
+        title: "title",
+        "create_time@start": "create_time@start",
+        "create_time@end": "create_time@end",
+      },
+      // options: {
+      //   "meta.state": 0 // 默认条件
+      // },
+    },
+    service: "query",
+    options: {
+      query: ["skip", "limit"],
+      sort: ["meta.createdAt"],
+      desc: true,
+      count: true,
+    },
+  },
+};

+ 31 - 0
app/controller/consultation/config/.trainChat.js

@@ -0,0 +1,31 @@
+module.exports = {
+  create: {
+    requestBody: ["sender_id", "sender_name", "!content", "send_time", "role", "unit_id"],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: ["sender_id", "sender_name", "content", "send_time", "role", "unit_id"],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: ["sender_id", "sender_name", "content", "send_time", "role", "unit_id"],
+    },
+    service: "query",
+    options: {
+      query: ["skip", "limit"],
+      sort: ["meta.createdAt"],
+      desc: true,
+      count: true,
+    },
+  },
+};

+ 102 - 0
app/controller/consultation/config/.trainLive.js

@@ -0,0 +1,102 @@
+module.exports = {
+  create: {
+    requestBody: [
+      "title",
+      "province",
+      "place",
+      "sponsor",
+      "brief",
+      "user",
+      "phone",
+      "video_data",
+      "user_data",
+      "start_date",
+    ],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: [
+      "title",
+      "province",
+      "place",
+      "sponsor",
+      "brief",
+      "user",
+      "phone",
+      "video_data",
+      "user_data",
+      "start_date",
+    ],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        title: "title",
+        province: "province",
+        place: "place",
+        sponsor: "sponsor",
+        brief: "brief",
+        user: "user",
+        phone: "phone",
+        "create_time@start": "create_time@start",
+        "create_time@end": "create_time@end",
+      },
+      // options: {
+      //   "meta.status": 0 // 默认条件
+      // },
+    },
+    service: "query",
+    options: {
+      query: ["skip", "limit"],
+      sort: ["meta.createdAt"],
+      desc: true,
+      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",
+  },
+};

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

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./config/.trainChat.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
+
+// 培训问诊聊天
+class TrainChatController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.consultation.trainChat;
+  }
+}
+module.exports = CrudController(TrainChatController, meta);

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

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./config/.trainLive.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
+
+// 培训问诊
+class TrainLiveController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.consultation.trainLive;
+  }
+}
+module.exports = CrudController(TrainLiveController, meta);

+ 13 - 0
app/controller/cysci/cashing.js

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./config/.cashing.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
+
+// 高企申报兑换
+class CashingController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.cysci.cashing;
+  }
+}
+module.exports = CrudController(CashingController, meta);

+ 96 - 0
app/controller/cysci/config/.cashing.js

@@ -0,0 +1,96 @@
+module.exports = {
+  create: {
+    requestBody: [
+      "no",
+      "coupons_id",
+      "company",
+      "apply_person",
+      "phone",
+      "money",
+      "allowance",
+      "total",
+      "create_time",
+      "end_time",
+      "contract",
+      "accept",
+      "cost",
+      "result",
+      "result_else",
+      "status",
+      "record",
+      "user_id",
+      "remark",
+      "declare_id",
+      "reward_id",
+      "from_id",
+    ],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: [
+      "no",
+      "coupons_id",
+      "company",
+      "apply_person",
+      "phone",
+      "money",
+      "allowance",
+      "total",
+      "create_time",
+      "end_time",
+      "contract",
+      "accept",
+      "cost",
+      "result",
+      "result_else",
+      "status",
+      "record",
+      "user_id",
+      "remark",
+      "from_id",
+    ],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        no: "no",
+        coupons_id: "coupons_id",
+        company: "company",
+        apply_person: "apply_person",
+        status: "status",
+        create_time: "create_time",
+        user_id: "user_id",
+        "create_time@start": "create_time@start",
+        "create_time@end": "create_time@end",
+        end_time: "end_time",
+        from_id: "from_id",
+        "end_time@start": "end_time@start",
+        "end_time@end": "end_time@end",
+      },
+      // options: {
+      //   "meta.state": 0 // 默认条件
+      // },
+    },
+    service: "query",
+    options: {
+      query: ["skip", "limit"],
+      sort: ["meta.createdAt"],
+      desc: true,
+      count: true,
+    },
+  },
+  from: {
+    params: ["!from_id"],
+    service: "getFromId",
+  },
+};

+ 73 - 0
app/controller/cysci/config/.coupons.js

@@ -0,0 +1,73 @@
+module.exports = {
+  create: {
+    requestBody: [
+      "user_id",
+      "name",
+      "discount_type",
+      "coupons_type",
+      "use_type",
+      "classify",
+      "limit_time",
+      "scale",
+      "allowance",
+      "total_allowance",
+      "desc",
+      "status",
+      "remark",
+    ],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: [
+      "user_id",
+      "name",
+      "discount_type",
+      "coupons_type",
+      "use_type",
+      "classify",
+      "limit_time",
+      "scale",
+      "allowance",
+      "total_allowance",
+      "desc",
+      "status",
+      "remark",
+    ],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        user_id: "user_id",
+        name: "name",
+        coupons_type: "coupons_type",
+        discount_type: "discount_type",
+        use_type: "use_type",
+        classify: "classify",
+        limit_time: "limit_time",
+        status: "status",
+        "create_time@start": "meta.createdAt@start",
+        "create_time@end": "meta.createdAt@end",
+      },
+      // options: {
+      //   "meta.state": 0 // 默认条件
+      // },
+    },
+    service: "query",
+    options: {
+      query: ["skip", "limit"],
+      sort: ["meta.createdAt"],
+      desc: true,
+      count: true,
+    },
+  },
+};

+ 76 - 0
app/controller/cysci/config/.couponsApply.js

@@ -0,0 +1,76 @@
+module.exports = {
+  create: {
+    requestBody: [
+      "user_id",
+      "coupons_id",
+      "company",
+      "apply_person",
+      "phone",
+      "qyfr",
+      "yyzz",
+      "qylr",
+      "record",
+      "apply_money",
+      "actual_money",
+      "section_time",
+      "status",
+      "is_use",
+      "remark",
+    ],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: [
+      "user_id",
+      "coupons_id",
+      "company",
+      "apply_person",
+      "phone",
+      "qyfr",
+      "yyzz",
+      "qylr",
+      "record",
+      "apply_money",
+      "actual_money",
+      "section_time",
+      "status",
+      "is_use",
+      "remark",
+    ],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        user_id: "user_id",
+        coupons_id: "coupons_id",
+        company: "company",
+        apply_person: "apply_person",
+        phone: "phone",
+        status: "status",
+        is_use: "is_use",
+        "create_time@start": "meta.createdAt@start",
+        "create_time@end": "meta.createdAt@end",
+      },
+      // options: {
+      //   "meta.state": 0 // 默认条件
+      // },
+    },
+    service: "query",
+    options: {
+      query: ["skip", "limit"],
+      sort: ["meta.createdAt"],
+      desc: true,
+      count: true,
+    },
+  },
+};

+ 70 - 0
app/controller/cysci/config/.declare.js

@@ -0,0 +1,70 @@
+module.exports = {
+  create: {
+    requestBody: [
+      "company",
+      "apply_person",
+      "phone",
+      "material",
+      "medium_id",
+      "medium_material",
+      "contract",
+      "is_cashing",
+      "status",
+      "record",
+      "remark",
+      "user_id",
+    ],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: [
+      "company",
+      "apply_person",
+      "phone",
+      "material",
+      "medium_id",
+      "medium_material",
+      "contract",
+      "is_cashing",
+      "status",
+      "record",
+      "remark",
+      "user_id",
+    ],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        name: "name",
+        user_id: "user_id",
+        medium_id: "medium_id",
+        status: "status",
+        company: "company",
+        apply_person: "apply_person",
+        is_cashing: "is_cashing",
+        "create_time@start": "create_time@start",
+        "create_time@end": "create_time@end",
+      },
+      // options: {
+      //   "meta.state": 0 // 默认条件
+      // },
+    },
+    service: "query",
+    options: {
+      query: ["skip", "limit"],
+      sort: ["meta.createdAt"],
+      desc: true,
+      count: true,
+    },
+  },
+};

+ 72 - 0
app/controller/cysci/config/.mechanism.js

@@ -0,0 +1,72 @@
+module.exports = {
+  create: {
+    requestBody: [
+      "name",
+      "contacts",
+      "phone",
+      "passwd",
+      "email",
+      "address",
+      "juris",
+      "industry",
+    ],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: [
+      "name",
+      "contacts",
+      "phone",
+      "email",
+      "address",
+      "industry",
+      "juris",
+      "status",
+    ],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        name: "name",
+        industry: "industry",
+        juris: "juris",
+        "create_time@start": "create_time@start",
+        "create_time@end": "create_time@end",
+      },
+      // options: {
+      //   "meta.state": 0 // 默认条件
+      // },
+      options: {
+        isdel: "0", // 默认条件
+      },
+    },
+    service: "query",
+    options: {
+      query: ["skip", "limit"],
+      sort: ["meta.createdAt"],
+      desc: true,
+      count: true,
+    },
+  },
+  //修改密码
+  password: {
+    params: ["!id"],
+    requestBody: ["passwd"],
+    service: "password",
+  },
+  // 登陆
+  login: {
+    requestBody: ["phone", "passwd"],
+    service: "login",
+  },
+};

+ 68 - 0
app/controller/cysci/config/.reward.js

@@ -0,0 +1,68 @@
+module.exports = {
+  create: {
+    requestBody: [
+      "type",
+      "company",
+      "apply_person",
+      "phone",
+      "qyfr",
+      "yyzz",
+      "qylr",
+      "user_id",
+      "status",
+      "remark",
+      "record",
+      "is_cashing",
+    ],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: [
+      "type",
+      "company",
+      "apply_person",
+      "phone",
+      "qyfr",
+      "yyzz",
+      "qylr",
+      "user_id",
+      "status",
+      "remark",
+      "record",
+      "is_cashing",
+    ],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        type: "type",
+        company: "company",
+        user_id: "user_id",
+        status: "status",
+        is_cashing: "is_cashing",
+        "create_time@start": "create_time@start",
+        "create_time@end": "create_time@end",
+      },
+      // options: {
+      //   "meta.state": 0 // 默认条件
+      // },
+    },
+    service: "query",
+    options: {
+      query: ["skip", "limit"],
+      sort: ["meta.createdAt"],
+      desc: true,
+      count: true,
+    },
+  },
+};

+ 13 - 0
app/controller/cysci/coupons.js

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./config/.coupons.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
+
+// 创新券
+class CouponsController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.cysci.coupons;
+  }
+}
+module.exports = CrudController(CouponsController, meta);

+ 13 - 0
app/controller/cysci/couponsApply.js

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./config/.couponsApply.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
+
+// 创新券申领
+class CouponsApplyController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.cysci.couponsApply;
+  }
+}
+module.exports = CrudController(CouponsApplyController, meta);

+ 17 - 0
app/controller/cysci/declare.js

@@ -0,0 +1,17 @@
+'use strict';
+const meta = require('./config/.declare.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
+
+// 高企申报
+class DeclareController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.cysci.declare;
+  }
+  async index() {
+    const data = await this.service.query(this.ctx.query);
+    this.ctx.ok(data);
+  }
+}
+module.exports = CrudController(DeclareController, meta);

+ 13 - 0
app/controller/cysci/reward.js

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./config/.reward.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
+
+// 研发补贴,奖励兑换申领
+class RewardController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.cysci.reward;
+  }
+}
+module.exports = CrudController(RewardController, meta);

+ 33 - 0
app/controller/home.js

@@ -0,0 +1,33 @@
+'use strict';
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
+const { BusinessError, ErrorCode } = require('naf-core').Error;
+
+// 项目测试及管理员登陆
+class HomeController extends Controller {
+  async index() {
+    const { ctx } = this;
+    ctx.body = 'hi, egg';
+  }
+  /**
+   * 系统管理员登陆
+   * 太简单了,就不写service了,直接在这处理完完事了
+   */
+  async login() {
+    let admin = await this.ctx.model.Admin.findOne({}, '+password').exec();
+    if (!admin) throw new BusinessError(ErrorCode.FILE_FAULT, '未初始化管理员,拒绝请求!');
+    const { account, password } = this.ctx.request.body;
+    if (!account) throw new BusinessError(ErrorCode.BADPARAM, '未找到要登陆用户账号');
+    if (!password) throw new BusinessError(ErrorCode.BADPARAM, '未找到要登陆用户密码');
+    if (admin.account !== account) throw new BusinessError(ErrorCode.USER_NOT_EXIST, '未找到要登录的用户');
+    if (admin.password.secret !== password) throw new BusinessError(ErrorCode.BAD_PASSWORD, '密码错误');
+    admin = JSON.parse(JSON.stringify(admin));
+    delete admin.password;
+    delete admin.meta;
+    delete admin.__v;
+    delete admin._id;
+    const token = this.ctx.service.util.jwt.encrypt(admin);
+    this.ctx.ok({ data: token });
+  }
+}
+module.exports = CrudController(HomeController, {});

+ 13 - 0
app/controller/user/admin.js

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./config/.admin.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
+
+// 管理员
+class AdminController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.user.admin;
+  }
+}
+module.exports = CrudController(AdminController, meta);

+ 55 - 0
app/controller/user/config/.admin.js

@@ -0,0 +1,55 @@
+module.exports = {
+  create: {
+    requestBody: ['!name', '!phone', '!passwd', 'openid', '!role', 'menus', '!pid', 'deptname', 'code', 'isdel', 'remark'],
+  },
+  destroy: {
+    params: ['!id'],
+    service: 'delete',
+  },
+  update: {
+    params: ['!id'],
+    requestBody: ['name', 'phone', 'openid', 'role', 'menus', 'pid', 'deptname', 'code', 'isdel', 'remark'],
+  },
+  show: {
+    parameters: {
+      params: ['!id'],
+    },
+    service: 'fetch',
+  },
+  index: {
+    parameters: {
+      query: {
+        name: '%name%',
+        phone: 'phone',
+        role: 'role',
+        pid: 'pid',
+        deptname: '%deptname%',
+        code: 'code',
+        isdel: 'isdel',
+        'create_time@start': 'create_time@start',
+        'create_time@end': 'create_time@end',
+      },
+      // options: {
+      //   "meta.state": 0 // 默认条件
+      // },
+    },
+    service: 'query',
+    options: {
+      query: ['skip', 'limit'],
+      sort: ['meta.createdAt'],
+      desc: true,
+      count: true,
+    },
+  },
+  //修改密码
+  password: {
+    params: ['!id'],
+    requestBody: ['passwd'],
+    service: 'password',
+  },
+  // 登陆
+  login: {
+    requestBody: ['code_phone', 'passwd'],
+    service: 'login',
+  },
+};

+ 81 - 0
app/controller/user/config/.expert.js

@@ -0,0 +1,81 @@
+module.exports = {
+  create: {
+    requestBody: [
+      "code",
+      "education",
+      "school",
+      "birthDate",
+      "qqwx",
+      "email",
+      "company",
+      "zwzc",
+      "expertise",
+      "img_path",
+      "workexperience",
+      "scientific",
+      "undertakingproject",
+      "scienceaward",
+      "social",
+      "status",
+      "remark",
+      "major",
+      "card",
+    ],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: [
+      "education",
+      "school",
+      "birthDate",
+      "qqwx",
+      "email",
+      "company",
+      "zwzc",
+      "expertise",
+      "img_path",
+      "workexperience",
+      "scientific",
+      "undertakingproject",
+      "scienceaward",
+      "social",
+      "status",
+      "remark",
+      "major",
+      "card",
+    ],
+  },
+  show: {
+    parameters: {
+      params: ["!user_id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        name: "%name%",
+        phone: "phone",
+        code: "code",
+        company: "company",
+        status: "status",
+        "create_time@start": "create_time@start",
+        "create_time@end": "create_time@end",
+      },
+      options: {
+        isdel: "0", // 默认条件
+      },
+    },
+    service: "query",
+    options: {
+      query: ["skip", "limit"],
+      sort: ["meta.createdAt"],
+      desc: true,
+      count: true,
+    },
+  },
+};

+ 39 - 0
app/controller/user/config/.inviteCode.js

@@ -0,0 +1,39 @@
+module.exports = {
+  create: {
+    requestBody: [],
+  },
+  destroy: {
+    params: ['!id'],
+    service: 'delete',
+  },
+  update: {
+    params: ['!id'],
+    requestBody: [],
+  },
+  show: {
+    parameters: {
+      params: ['!id'],
+    },
+    service: 'fetch',
+  },
+  index: {
+    parameters: {
+      query: {
+        code: 'code',
+        user_id: 'user_id',
+        'create_time@start': 'create_time@start',
+        'create_time@end': 'create_time@end',
+      },
+      // options: {
+      //   "meta.state": 0 // 默认条件
+      // },
+    },
+    service: 'query',
+    options: {
+      query: ['skip', 'limit'],
+      sort: ['meta.createdAt'],
+      desc: true,
+      count: true,
+    },
+  },
+};

+ 54 - 0
app/controller/user/config/.mechanism.js

@@ -0,0 +1,54 @@
+module.exports = {
+  create: {
+    requestBody: ['name', 'contacts', 'phone', 'passwd', 'email', 'address', 'juris', 'industry'],
+  },
+  destroy: {
+    params: ['!id'],
+    service: 'delete',
+  },
+  update: {
+    params: ['!id'],
+    requestBody: ['name', 'contacts', 'phone', 'email', 'address', 'industry', 'juris', 'status'],
+  },
+  show: {
+    parameters: {
+      params: ['!id'],
+    },
+    service: 'fetch',
+  },
+  index: {
+    parameters: {
+      query: {
+        name: 'name',
+        industry: 'industry',
+        juris: 'juris',
+        'create_time@start': 'create_time@start',
+        'create_time@end': 'create_time@end',
+      },
+      // options: {
+      //   "meta.state": 0 // 默认条件
+      // },
+      options: {
+        isdel: '0', // 默认条件
+      },
+    },
+    service: 'query',
+    options: {
+      query: ['skip', 'limit'],
+      sort: ['meta.createdAt'],
+      desc: true,
+      count: true,
+    },
+  },
+  //修改密码
+  password: {
+    params: ['!id'],
+    requestBody: ['passwd'],
+    service: 'password',
+  },
+  // 登陆
+  login: {
+    requestBody: ['phone', 'passwd'],
+    service: 'login',
+  },
+};

+ 133 - 0
app/controller/user/config/.organization.js

@@ -0,0 +1,133 @@
+module.exports = {
+  create: {
+    requestBody: [
+      "!name",
+      "!password",
+      "phone",
+      "email",
+      "addr",
+      "code",
+      "office_phone",
+      "profession",
+      "institution_code",
+      "companytype",
+      "companydate",
+      "companycapital",
+      "companyperson",
+      "sndqyzsr",
+      "sndyffy",
+      "companytotal",
+      "zjzyfrs",
+      "companybrief",
+      "mainproduct",
+      "qualifications",
+      "remark",
+      "juris",
+      "status",
+    ],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: [
+      "name",
+      "phone",
+      "email",
+      "addr",
+      "code",
+      "office_phone",
+      "profession",
+      "institution_code",
+      "companytype",
+      "companydate",
+      "companycapital",
+      "companyperson",
+      "sndqyzsr",
+      "sndyffy",
+      "companytotal",
+      "zjzyfrs",
+      "companybrief",
+      "mainproduct",
+      "qualifications",
+      "juris",
+      "remark",
+      "status",
+    ],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        phone: "phone",
+        code: "code",
+        profession: "profession",
+        institution_code: "institution_code",
+        companyperson: "companyperson",
+        status: "status",
+        juris: "juris",
+        "create_time@start": "create_time@start",
+        "create_time@end": "create_time@end",
+      },
+      options: {
+        isdel: "0", // 默认条件
+      },
+    },
+    service: "query",
+    options: {
+      query: ["skip", "limit"],
+      sort: ["meta.createdAt"],
+      desc: true,
+      count: true,
+    },
+  },
+  //修改密码
+  password: {
+    params: ["!id"],
+    requestBody: ["password"],
+    service: "password",
+  },
+  // 登陆
+  login: {
+    requestBody: ["institution_code", "password"],
+    service: "login",
+  },
+  // 获取指定电话号关联的所有企业
+  getList: {
+    parameters: {
+      query: {
+        phone: "phone",
+        name: "name",
+      },
+      options: {
+        query: ["skip", "limit"],
+        sort: ["meta.createdAt"],
+        desc: true,
+        count: true,
+      },
+    },
+    service: "getList",
+  },
+  // 绑定微信
+  bind: {
+    requestBody: ["id", "openid"],
+    service: "bind",
+  },
+  // 解除绑定
+  bindRemove: {
+    requestBody: ["id", "openid"],
+    service: "bindRemove",
+  },
+  // 微信登录
+  wxLogin: {
+    requestBody: ["openid"],
+    service: "wxLogin",
+  },
+};

+ 64 - 0
app/controller/user/config/.personChat.js

@@ -0,0 +1,64 @@
+module.exports = {
+  create: {
+    requestBody: [
+      "!sender_id",
+      "sender_name",
+      "!receiver_id",
+      "receiver_name",
+      "!content",
+      "!room_id",
+    ],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: [
+      "sender_id",
+      "sender_name",
+      "receiver_id",
+      "receiver_name",
+      "room_id",
+      "content",
+      "is_read",
+    ],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        sender_id: "sender_id",
+        receiver_id: "receiver_id",
+        room_id: "room_id",
+        "create_time@start": "create_time@start",
+        "create_time@end": "create_time@end",
+      },
+      // options: {
+      //   "meta.state": 0 // 默认条件
+      // },
+    },
+    service: "query",
+    options: {
+      query: ["skip", "limit"],
+      sort: ["send_time"],
+      asc: true,
+      count: true,
+    },
+  },
+  allRead: {
+    parameters: {
+      query: {
+        user_id: "user_id",
+        room_id: "room_id",
+      },
+    },
+    service: "allRead",
+  },
+};

+ 42 - 0
app/controller/user/config/.personRoom.js

@@ -0,0 +1,42 @@
+module.exports = {
+  create: {
+    requestBody: ["!p1_id", "p1", "!p2_id", "p2", "product_id"],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: ["p1_id", "p1", "p2_id", "p2", "product_id"],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        p1_id: "p1_id",
+        p1: "p1",
+        p2_id: "p2_id",
+        p2: "p2",
+        product_id: "product_id",
+        "create_time@start": "create_time@start",
+        "create_time@end": "create_time@end",
+      },
+      // options: {
+      //   "meta.state": 0 // 默认条件
+      // },
+    },
+    service: "query",
+    options: {
+      query: ["skip", "limit"],
+      sort: ["last_time"],
+      desc: true,
+      count: true,
+    },
+  },
+};

+ 122 - 0
app/controller/user/config/.personal.js

@@ -0,0 +1,122 @@
+module.exports = {
+  create: {
+    requestBody: [
+      "!name",
+      "!password",
+      "!phone",
+      "email",
+      "addr",
+      "office_phone",
+      "profession",
+      "code",
+      "openid",
+      "status",
+      "remark",
+      "juris",
+      "create_time",
+      "is_expert",
+      "school",
+      "major",
+      "card",
+      "zwzc",
+    ],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: [
+      "name",
+      "phone",
+      "email",
+      "addr",
+      "office_phone",
+      "profession",
+      "code",
+      "openid",
+      "status",
+      "remark",
+      "juris",
+      "create_time",
+      "is_expert",
+      "school",
+      "major",
+      "card",
+      "zwzc",
+      "isdel",
+    ],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        name: "name",
+        phone: "phone",
+        code: "code",
+        juris: "juris",
+        status: "status",
+        profession: "profession",
+        role: "role",
+        "create_time@start": "create_time@start",
+        "create_time@end": "create_time@end",
+      },
+      options: {
+        isdel: "0", // 默认条件
+      },
+    },
+    service: "query",
+    options: {
+      query: ["skip", "limit"],
+      sort: ["meta.createdAt"],
+      desc: true,
+      count: true,
+    },
+  },
+  //修改密码
+  password: {
+    params: ["!id"],
+    requestBody: ["password"],
+    service: "password",
+  },
+  // 登陆
+  login: {
+    requestBody: ["phone", "password", "!code"],
+    service: "login",
+  },
+  upgrade: {
+    requestBody: [
+      "education",
+      "school",
+      "birthDate",
+      "qqwx",
+      "email",
+      "company",
+      "zwzc",
+      "expertise",
+      "img_path",
+      "workexperience",
+      "scientific",
+      "undertakingproject",
+      "scienceaward",
+      "social",
+      "status",
+      "remark",
+      "!id",
+    ],
+    service: "upgrade",
+  },
+
+  import: {
+    requestBody: ["uri"],
+  },
+  export: {
+    requestBody: [],
+  },
+};

+ 17 - 0
app/controller/user/expert.js

@@ -0,0 +1,17 @@
+'use strict';
+const meta = require('./config/.expert.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
+
+// 专家
+class ExpertController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.user.expert;
+  }
+  async index() {
+    const { data, total } = await this.service.query(this.ctx.query);
+    this.ctx.ok({ data, total });
+  }
+}
+module.exports = CrudController(ExpertController, meta);

+ 13 - 0
app/controller/user/inviteCode.js

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./config/.inviteCode.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
+
+// 邀请码
+class InviteCodeController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.user.inviteCode;
+  }
+}
+module.exports = CrudController(InviteCodeController, meta);

+ 13 - 0
app/controller/user/mechanism.js

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./config/.mechanism.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
+
+// 机构
+class MechanismController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.user.mechanism;
+  }
+}
+module.exports = CrudController(MechanismController, meta);

+ 13 - 0
app/controller/user/organization.js

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./config/.organization.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
+
+// 机构
+class OrganizationController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.user.organization;
+  }
+}
+module.exports = CrudController(OrganizationController, meta);

+ 14 - 0
app/controller/user/personChat.js

@@ -0,0 +1,14 @@
+'use strict';
+const meta = require('./config/.personChat.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
+
+// 个人聊天
+class Person_chatController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.user.personChat;
+  }
+
+}
+module.exports = CrudController(Person_chatController, meta);

+ 17 - 0
app/controller/user/personRoom.js

@@ -0,0 +1,17 @@
+'use strict';
+const meta = require('./config/.personRoom.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
+
+// 个人聊天房间
+class Person_roomController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.user.personRoom;
+  }
+  async index() {
+    const { data, total } = await this.service.query(this.ctx.query);
+    this.ctx.ok({ data, total });
+  }
+}
+module.exports = CrudController(Person_roomController, meta);

+ 13 - 0
app/controller/user/personal.js

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./config/.personal.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
+
+// 个人用户
+class PersonalController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.user.personal;
+  }
+}
+module.exports = CrudController(PersonalController, meta);

+ 68 - 0
app/controller/util.js

@@ -0,0 +1,68 @@
+'use strict';
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose-free/lib/controller');
+const assert = require('assert');
+const _ = require('lodash');
+
+//
+class UtilController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.util;
+  }
+  async getConfig() {
+    if (process.env.NODE_ENV !== 'development') {
+      this.ctx.fail(-1, '无法在非开发环境使用该接口');
+      return;
+    }
+    let { index, model } = this.ctx.query;
+    assert(model, '缺少model');
+    index = _.upperFirst(_.camelCase(index));
+    model = _.upperFirst(_.camelCase(model));
+    try {
+      const mr = this.ctx.model[index][model];
+      assert(mr, '未找到model信息');
+      const sch = mr.schema.obj;
+      const cols = Object.keys(sch);
+      const q = { 'meta.createdAt@start': 'meta.createdAt@start', 'meta.createdAt@end': 'meta.createdAt@end' };
+      for (const k in cols) {
+        q[`${cols[k]}`] = cols[k];
+      }
+
+      const obj = {
+        create: { requestBody: cols },
+        destroy: {
+          params: [ '!id' ],
+          service: 'delete',
+        },
+        update: {
+          params: [ '!id' ],
+          requestBody: cols,
+        },
+        show: {
+          parameters: {
+            params: [ '!id' ],
+          },
+          service: 'fetch',
+        },
+        index: {
+          parameters: {
+            query: q,
+          },
+          service: 'query',
+          options: {
+            query: [ 'skip', 'limit' ],
+            sort: [ 'meta.createdAt' ],
+            desc: true,
+            count: true,
+          },
+        },
+      };
+      // this.ctx.ok({ data: JSON.parse(JSON.stringify(obj), 1) });
+      this.ctx.body = `module.exports = ${JSON.stringify(obj, null, 2)}`;
+    } catch (error) {
+      this.ctx.fail(-1, '获取config失败');
+    }
+  }
+}
+module.exports = CrudController(UtilController, {});

+ 42 - 0
app/middleware/coupons_apply.js

@@ -0,0 +1,42 @@
+'use strict';
+const _ = require('lodash');
+
+const idToData = async (ctx, id) => {
+  let res = await ctx.service.cysci.coupons.fetch({ id });
+  if (res) {
+    res = JSON.parse(JSON.stringify(res));
+    const { user_id } = res;
+    if (user_id) {
+      const user = await ctx.model.User.Admin.findById(user_id);
+      if (user) res.user = user;
+    }
+  }
+  return res;
+};
+
+module.exports = options => {
+  return async function couponsApply(ctx, next) {
+    const request = ctx.request;
+    await next();
+    const { method } = request;
+    if (method === 'GET') {
+      // 处理get的时coupons_id换成对应的数据
+      let { data } = ctx.body;
+      data = JSON.parse(JSON.stringify(data));
+      if (_.isArray(data)) {
+        // 数组,多个,循环查
+        for (const i of data) {
+          const { coupons_id } = i;
+          const res = await idToData(ctx, coupons_id);
+          if (res)i.coupons = res;
+        }
+      } else if (_.isObject(data)) {
+        // 一个,找完就完事
+        const { coupons_id } = data;
+        const res = await idToData(ctx, coupons_id);
+        if (res) data.coupons = res;
+      }
+      ctx.body.data = data;
+    }
+  };
+};

+ 24 - 0
app/middleware/create_password.js

@@ -0,0 +1,24 @@
+'use strict';
+/**
+ * 处理密码类型的数据的中间件
+ * 在处理前拦截,在传来的数据中 找是否有 key 在keyWord列表中.
+ * 将在列表中的key的值转换成{secret:${value}},再去提交,免去重写create函数
+ */
+const _ = require('lodash');
+const { ObjectId } = require('mongoose').Types;
+const keyWord = [ 'password', 'passwd', 'pwd' ];
+module.exports = options => {
+  return async function createPassword(ctx, next) {
+    const { method, url } = ctx.request;
+    if (method === 'POST') {
+      const body = ctx.request.body;
+      const mid = _.pick(body, keyWord);
+      if (Object.keys(mid).length > 0) {
+        for (const key of Object.keys(mid)) {
+          ctx.request.body[key] = { secret: body[key] };
+        }
+      }
+    }
+    await next();
+  };
+};

+ 36 - 0
app/middleware/create_time.js

@@ -0,0 +1,36 @@
+'use strict';
+const _ = require('lodash');
+const moment = require('moment');
+const toTime = meta => {
+  if (!meta) return;
+  const { createdAt } = meta;
+  if (!createdAt) return;
+  const time = moment(createdAt).format('YYYY-MM-DD HH:mm:ss');
+  return time;
+};
+module.exports = options => {
+  return async function create_time(ctx, next) {
+    await next();
+    const request = ctx.request;
+    const { method } = request;
+    if (method === 'GET') {
+      // 处理get的时coupons_id换成对应的数据
+      let { data } = ctx.body;
+      data = JSON.parse(JSON.stringify(data));
+      if (_.isArray(data)) {
+        // 数组,多个,循环查
+        for (const i of data) {
+          const { meta } = i;
+          const create_time = toTime(meta);
+          if (create_time) i.create_time = create_time;
+        }
+      } else if (_.isObject(data)) {
+        // 一个,找完就完事
+        const { meta } = data;
+        const create_time = toTime(meta);
+        if (create_time) data.create_time = create_time;
+      }
+      ctx.body.data = data;
+    }
+  };
+};

+ 41 - 0
app/middleware/disclosure_report.js

@@ -0,0 +1,41 @@
+'use strict';
+const _ = require('lodash');
+const { ObjectId } = require('mongoose').Types;
+
+const checkReport = async (ctx, data) => {
+  return await ctx.service.patent.report.checkReport(data);
+};
+
+module.exports = options => {
+  return async function disclosure_report(ctx, next) {
+    await next();
+    const { method } = ctx.request;
+    if (method === 'GET') {
+      let { data } = ctx.body;
+      if (data || data.length > 0) {
+        data = JSON.parse(JSON.stringify(data));
+        const ids = [];
+        if (_.isArray(data)) {
+          for (const i of data) {
+            ids.push(i._id);
+          }
+        } else {
+          ids.push(data._id);
+        }
+        const res = await checkReport(ctx, ids);
+        if (_.isArray(data)) {
+          for (const i of data) {
+            const r = res.find(f => ObjectId(f.disclosure_id).equals(i._id));
+            if (r) i.has_report = r._id;
+            else i.has_report = false;
+          }
+        } else {
+          if (res.length > 0) data.has_report = res[0]._id;
+          else data.has_report = false;
+        }
+        ctx.body.data = data;
+      }
+
+    }
+  };
+};

+ 36 - 0
app/middleware/dock_transcation.js

@@ -0,0 +1,36 @@
+'use strict';
+const _ = require('lodash');
+const idToData = async (ctx, id) => {
+  let res = {};
+  // 1,是产品
+  res = await ctx.service.users.product.fetch({ id });
+  if (res) return res;
+  // 2,是专家
+  res = await ctx.service.users.personal.fetch({ id });
+  return res;
+};
+module.exports = options => {
+  return async function dock_transcation(ctx, next) {
+    await next();
+    const request = ctx.request;
+    const { method } = request;
+    if (method === 'GET') {
+      let { data } = ctx.body;
+      data = JSON.parse(JSON.stringify(data));
+      const dataKey = 'product_id';
+      const key = 'product';
+      if (_.isArray(data)) {
+        // 数组,多个,循环查
+        for (const i of data) {
+          const res = await idToData(ctx, i[dataKey]);
+          if (res)i[key] = res;
+        }
+      } else if (_.isObject(data)) {
+        // 一个,找完就完事
+        const res = await idToData(ctx, data[dataKey]);
+        if (res) data[key] = res;
+      }
+      ctx.body.data = data;
+    }
+  };
+};

+ 34 - 0
app/middleware/medium.js

@@ -0,0 +1,34 @@
+'use strict';
+const _ = require('lodash');
+
+const idToData = async (ctx, id) => {
+  const res = await ctx.service.util.httpUtil.cget(`/mechanism/${id}`, 'hnhmain');
+  return res;
+};
+
+module.exports = options => {
+  return async function medium(ctx, next) {
+    await next();
+    const request = ctx.request;
+    const { method } = request;
+    if (method === 'GET') {
+      // 处理get的时coupons_id换成对应的数据
+      let { data } = ctx.body;
+      data = JSON.parse(JSON.stringify(data));
+      if (_.isArray(data)) {
+        // 数组,多个,循环查
+        for (const i of data) {
+          const { medium_id } = i;
+          const res = await idToData(ctx, medium_id);
+          if (res)i.medium = res;
+        }
+      } else if (_.isObject(data)) {
+        // 一个,找完就完事
+        const { medium_id } = data;
+        const res = await idToData(ctx, medium_id);
+        if (res) data.medium = res;
+      }
+      ctx.body.data = data;
+    }
+  };
+};

+ 34 - 0
app/middleware/patentapply_record.js

@@ -0,0 +1,34 @@
+'use strict';
+const _ = require('lodash');
+const { ObjectId } = require('mongoose').Types;
+
+const addRecord = async (ctx, service, args) => {
+  const arr = service.split('.');
+  let s = ctx.service;
+  for (const key of arr) {
+    s = s[key];
+  }
+  const service_method = 'record';
+  return await s[service_method](args);
+};
+
+module.exports = options => {
+  return async function patentapply_record(ctx, next) {
+    const { url, method } = ctx.request;
+    await next();
+    let id;
+    if (method === 'POST') {
+      // 将添加,修改拦截,给加上记录
+      const arr = url.split('/');
+      const last = _.last(arr);
+      let word = '';
+      if (ObjectId.isValid(last) && url.includes('update')) word = 'update';
+      else {
+        word = 'create';
+      }
+      id = _.get(ctx.body, 'data._id');
+      const nd = await addRecord(ctx, options, { id, method: word });
+      ctx.body.data = nd;
+    }
+  };
+};

+ 37 - 0
app/middleware/person_room.js

@@ -0,0 +1,37 @@
+'use strict';
+const _ = require('lodash');
+const idToData = async (ctx, id) => {
+  let res = {};
+  // 1,是产品
+  res = await ctx.service.users.product.fetch({ id });
+  if (res) return res;
+  // 2,是专家
+  res = await ctx.service.users.personal.fetch({ id });
+  return res;
+};
+module.exports = options => {
+  return async function person_room(ctx, next) {
+    console.log('function in person_room middleware');
+    await next();
+    const request = ctx.request;
+    const { method } = request;
+    if (method === 'GET') {
+      let { data } = ctx.body;
+      data = JSON.parse(JSON.stringify(data));
+      const dataKey = 'product_id';
+      const key = 'product';
+      if (_.isArray(data)) {
+        // 数组,多个,循环查
+        for (const i of data) {
+          const res = await idToData(ctx, i[dataKey]);
+          if (res)i[key] = res;
+        }
+      } else if (_.isObject(data)) {
+        // 一个,找完就完事
+        const res = await idToData(ctx, data[dataKey]);
+        if (res) data[key] = res;
+      }
+      ctx.body.data = data;
+    }
+  };
+};

+ 53 - 0
app/middleware/request-log.js

@@ -0,0 +1,53 @@
+'use strict';
+module.exports = ({ toMongoDB = false }) =>
+  async function requestLog(ctx, next) {
+    await next();
+    try {
+      const request = ctx.request;
+      // 请求路由
+      const url = request.url;
+      // 请求方法
+      const method = request.method;
+      // get 请求不发日志
+      if (method === 'GET') return;
+      // 请求的分站标识
+      const tenant = ctx.tenant || 'master';
+      // 请求的用户
+      const user = ctx.user;
+      // 当前模块
+      const module = ctx.app.config.module;
+      // 所有的请求路由
+      const routers = ctx.router.stack;
+      // 匹配路由及http请求方法
+      const route = routers.find(route => {
+        const reg = new RegExp(route.regexp);
+        // 正则验证
+        const regResult = reg.test(url);
+        // http方法验证
+        const methodResult = route.methods.includes(method);
+        if (regResult && methodResult) return true;
+        return false;
+      });
+      if (!route) return;
+      // 不往数据库里写,就回去
+      if (!toMongoDB) return;
+      // 组织数据,给MQ,让日志服务去写
+      const { id: user_id, account, name } = user;
+      const logData = { user_id, account, name, _tenant: tenant, opera: route.name, path: url, module };
+      // 先用mq发送,不行再用http发
+      if (ctx.mq) {
+        ctx.service.util.rabbitMq.sendToMqQueue(logData, 'logs');
+      } else {
+        // http请求
+        const httpPrefix = ctx.app.config.httpPrefix;
+        if (httpPrefix && httpPrefix.logs) {
+          const uri = `${httpPrefix.logs}/logs`;
+          ctx.service.util.httpUtil.cpost(uri, logData);
+        }
+      }
+    } catch (error) {
+      // 没啥可输出,别中断就行
+    }
+
+
+  };

+ 26 - 0
app/model/channel/channel.js

@@ -0,0 +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;
+// 科技频道表
+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 },
+};
+const schema = new Schema(channel, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Channel', schema, 'channel');
+};

+ 24 - 0
app/model/channel/channelVideo.js

@@ -0,0 +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 { 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 },
+  create_time: { type: String },
+};
+const schema = new Schema(channel_video, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('ChannelVideo', schema, 'channelVideo');
+};

+ 26 - 0
app/model/consultation/trainChat.js

@@ -0,0 +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 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 }, // 用户身份
+  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({ sender_id: 1 });
+schema.index({ send_time: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('TrainChat', schema, 'trainChat');
+};

+ 47 - 0
app/model/consultation/trainLive.js

@@ -0,0 +1,47 @@
+'use strict';
+const Schema = require('mongoose').Schema;
+const moment = require('moment');
+const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
+
+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 },
+};
+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.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('TrainLive', schema, 'trainLive');
+};

+ 44 - 0
app/model/cysci/cashing.js

@@ -0,0 +1,44 @@
+'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 cashing = {
+  no: { type: String }, // 兑付申请号(自动生成)
+  coupons_id: { type: ObjectId }, // 券的id
+  company: { type: String }, // 申请单位
+  apply_person: { type: String }, // 申请人
+  phone: { type: String }, // 联系电话
+  money: { type: Number }, // 订单金额
+  allowance: { type: Number }, // 抵扣金额
+  total: { type: Number }, // 应收金额
+  create_time: { type: String }, // 提交时间,服务端生成
+  end_time: { type: String }, // 最后审核时间
+  contract: { type: Array }, // 上传合同
+  accept: { type: Array }, // 官方受理通知书
+  cost: { type: Array }, // 官方缴费证明
+  result: { type: Array }, // 服务结果证明
+  result_else: { type: Array }, // 其他能够证明服务真是发生的材料
+  status: { type: String, default: '0' }, // 0-待审核;1-通过;-1-拒绝
+  record: { type: Array }, // 记录
+  user_id: { type: ObjectId }, // 用户id
+  from_id: { type: ObjectId }, // 高企申报/ 研发补贴/奖励兑换的数据id
+  remark: { type: String },
+};
+const schema = new Schema(cashing, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ no: 1 });
+schema.index({ coupons_id: 1 });
+schema.index({ company: 1 });
+schema.index({ apply_person: 1 });
+schema.index({ create_time: 1 });
+schema.index({ end_time: 1 });
+schema.index({ from_id: 1 });
+schema.index({ status: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Cashing', schema, 'cashing');
+};

+ 37 - 0
app/model/cysci/coupons.js

@@ -0,0 +1,37 @@
+'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 coupons = {
+  user_id: { type: ObjectId }, // 创建者id
+  coupons_type: { type: String }, // 类型:科技创新券;研发补贴;奖励兑现
+  name: { type: String }, // 名称
+  discount_type: { type: String }, // 折扣类型: 全额折扣券;折扣券;定额折扣券
+  use_type: { type: String }, // 使用服务类型
+  classify: { type: String }, // 所属分类
+  limit_time: { type: Number }, // 期限
+  scale: { type: String }, // 抵扣比例-为折扣券
+  allowance: { type: String }, // 面额
+  total_allowance: { type: String }, // 券总额度
+  desc: { type: String }, // 描述
+  status: { type: String, default: '0' }, // 0:待上架;1:上架;-1:下架
+  remark: { type: String },
+};
+const schema = new Schema(coupons, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ user_id: 1 });
+schema.index({ type: 1 });
+schema.index({ name: 1 });
+schema.index({ coupons_type: 1 });
+schema.index({ discount_type: 1 });
+schema.index({ use_type: 1 });
+schema.index({ classify: 1 });
+schema.index({ limit_time: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Coupons', schema, 'coupons');
+};

+ 37 - 0
app/model/cysci/couponsApply.js

@@ -0,0 +1,37 @@
+'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 coupons_apply = {
+  user_id: { type: ObjectId }, // 申请人id
+  coupons_id: { type: ObjectId }, // 创新券id
+  company: { type: String }, // 申请企业
+  apply_person: { type: String }, // 申请人
+  phone: { type: String }, // 联系电话
+  qyfr: { type: Array }, // 企业法人
+  yyzz: { type: Array }, // 营业执照
+  qylr: { type: Array }, // 企业利润表
+  record: { type: Array }, // 审核记录
+  apply_money: { type: Number }, // 申请金额
+  actual_money: { type: Number }, // 实际申领金额
+  section_time: { type: String }, // 使用期限
+  remark: { type: String },
+  status: { type: String, default: '0' }, // 0-待处理;1-已通过;2已拒绝
+  is_use: { type: String, default: '0' },
+};
+const schema = new Schema(coupons_apply, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ user_id: 1 });
+schema.index({ coupons_id: 1 });
+schema.index({ company: 1 });
+schema.index({ apply_person: 1 });
+schema.index({ phone: 1 });
+schema.index({ is_use: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('CouponsApply', schema, 'couponsApply');
+};

+ 37 - 0
app/model/cysci/declare.js

@@ -0,0 +1,37 @@
+'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 declare = {
+  company: { type: String }, // 申请单位
+  apply_person: { type: String }, // 申请人
+  phone: { type: String }, // 联系电话
+  material: { type: Array }, // 审核资料
+  medium_id: { type: ObjectId }, // 中介机构id
+  medium_material: { type: Array }, // 中介机构审核资料
+  contract: { type: Array }, // 合同
+  is_cashing: { type: String, default: '0' }, // 是否兑付
+  status: { type: String, default: '0' }, // 0-待审;1-通过;2-拒绝
+  // 0-初审;
+  // 1-初审通过(企业,中介上传合同);-1-初审失败;
+  // 2-高企申报成功;-2:高企申报失败
+  record: { type: Array },
+  remark: { type: String },
+  user_id: { type: ObjectId }, // 用户id
+};
+const schema = new Schema(declare, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ company: 1 });
+schema.index({ apply_person: 1 });
+schema.index({ medium_id: 1 });
+schema.index({ is_cashing: 1 });
+schema.index({ status: 1 });
+schema.index({ user_id: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Declare', schema, 'declare');
+};

+ 33 - 0
app/model/cysci/reward.js

@@ -0,0 +1,33 @@
+'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 reward = {
+  type: { type: String }, // 研发补贴/奖励兑换
+  company: { type: String }, // 申领企业
+  apply_person: { type: String }, // 申领人
+  phone: { type: String }, // 联系电话
+  qyfr: { type: Array }, // 企业法人
+  yyzz: { type: Array }, // 营业执照
+  qylr: { type: Array }, // 企业利润
+  is_cashing: { type: String, default: '0' }, // 是否兑付
+  status: { type: String, default: '0' }, // 状态:0:待审核;1-审核通过(生成订单);1-审核拒绝
+  remark: { type: String },
+  user_id: { type: ObjectId }, // 申领人id
+  record: { type: Array }, // 记录
+};
+const schema = new Schema(reward, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ type: 1 });
+schema.index({ company: 1 });
+schema.index({ user_id: 1 });
+schema.index({ status: 1 });
+schema.index({ is_cashing: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Reward', schema, 'reward');
+};

+ 39 - 0
app/model/dock/dock.js

@@ -0,0 +1,39 @@
+'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 }, // 结束时间
+  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-结束
+  remark: { type: String },
+};
+const schema = new Schema(dock, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ room_id: 1 });
+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.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Dock', schema, 'dock');
+};

+ 25 - 0
app/model/dock/dockChat.js

@@ -0,0 +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;
+// 展会公共聊天表
+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 }, // 发送人
+  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.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('DockChat', schema, 'dockChat');
+};

+ 23 - 0
app/model/dock/dockImgtxt.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 dock_imgtxt = {
+  dock_id: { type: ObjectId, required: true }, // 展会id
+  content: { type: String }, // 信息内容
+  img_url: { type: Array }, // 图片
+  file_url: { type: Array }, // 视频地址
+  user_id: { type: ObjectId }, // 创建人
+  remark: { type: String },
+};
+const schema = new Schema(dock_imgtxt, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ dock_id: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('DockImgtxt', schema, 'dockImgtxt');
+};

+ 34 - 0
app/model/dock/dockTranscation.js

@@ -0,0 +1,34 @@
+'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_transcation = {
+  dock_id: { type: ObjectId }, // 展会id
+  product_id: { type: ObjectId }, // 产品id
+  s_id: { type: ObjectId }, // 供给者id
+  s_name: { type: String }, // 供给者姓名
+  s_phone: { type: String }, // 供给者电话
+  d_id: { type: ObjectId }, // 需求者id
+  d_name: { type: String }, // 需求者姓名
+  d_phone: { type: String }, // 需求者电话
+  status: { type: String, default: '0' }, // 0-正在洽谈,1-达成意向,2-交易备案,3-交易完成,4-交易失败
+  contact: { type: String }, // 合同备份
+  remark: { type: String },
+};
+const schema = new Schema(dock_transcation, { toJSON: { virtuals: true } });
+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);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('DockTranscation', schema, 'dockTranscation');
+};

+ 30 - 0
app/model/dock/dockUser.js

@@ -0,0 +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 { 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 }, // 电话
+  create_time: { type: String }, // 申请时间
+  productList: { type: Array }, // 参展项目
+  status: { type: String, default: '0' }, // 0-待审核;1-审核通过;-1-审核拒绝
+  remark: { type: String },
+};
+const schema = new Schema(dock_user, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ dock_id: 1 });
+schema.index({ name: 1 });
+schema.index({ phone: 1 });
+schema.index({ status: 1 });
+schema.index({ user_id: 1 });
+schema.index({ create_time: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('DockUser', schema, 'dockUser');
+};

+ 25 - 0
app/model/dock/dockVideo.js

@@ -0,0 +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;
+// 展会视频表表
+const dock_video = {
+  dock_id: { type: ObjectId, required: true }, // 展会id
+  title: { type: String, required: false, maxLength: 200 }, // 标题
+  brief: { type: String }, // 简介
+  file_url: { type: String }, // 视频地址
+  user_id: { type: ObjectId }, // 创建人
+  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.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('DockVideo', schema, 'dockVideo');
+};

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

@@ -0,0 +1,27 @@
+'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');
+};

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

@@ -0,0 +1,33 @@
+'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');
+};

+ 12 - 0
app/model/index.md

@@ -0,0 +1,12 @@
+### model目录
+|en|zh|
+|:-|:-|
+|channel|科技频道|
+|consultation|培训问诊|
+|cysci|创新券|
+|dock|直播大厅|
+|kjzl|科教之旅|
+|news|新闻|
+|patent|专利|
+|system|系统设置|
+|user|用户|

+ 28 - 0
app/model/kjzl/kjzlChat.js

@@ -0,0 +1,28 @@
+'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 kjzl_chat = {
+  medium_id: { type: ObjectId }, // 机构id
+  openid: { type: String }, // 用户id
+  project: { type: Object }, // 服务项目
+  orderid: { type: String }, // 订单id
+  create_time: { type: String }, // 时间
+  content: { type: String }, // 评价内容
+  remark: { type: String },
+};
+const schema = new Schema(kjzl_chat, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ medium_id: 1 });
+schema.index({ openid: 1 });
+schema.index({ project: 1 });
+schema.index({ orderid: 1 });
+schema.index({ create_time: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('KjzlChat', schema, 'kjzlChat');
+};

+ 22 - 0
app/model/kjzl/kjzlExpertView.js

@@ -0,0 +1,22 @@
+'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 kjzl_expert_view = {
+  title: { type: String }, // 标题
+  origin: { type: String }, // 来源
+  content: { type: String }, // 内容
+  remark: { type: String },
+};
+const schema = new Schema(kjzl_expert_view, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ title: 1 });
+schema.index({ origin: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('KjzlExpertView', schema, 'kjzlExpertView');
+};

+ 38 - 0
app/model/kjzl/kjzlMedium.js

@@ -0,0 +1,38 @@
+'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 kjzl_medium = {
+  name: { type: String }, // 名称
+  contact: { type: String }, // 联系人
+  phone: { type: String }, // 联系电话
+  addr: { type: String }, // 地址
+  belong: { type: String }, // 所属:中科/吉科
+  password: { type: Secret, required: true, select: false }, // 登录密码
+  openid: { type: String }, // 微信openid
+  natural: { type: String }, // 资质
+  achieve: { type: String }, // 成果
+  condition: { type: String }, // 条件
+  team: { type: String }, // 团队
+  img_file: { type: Array }, // 图片
+  project: { type: Array }, // 服务项目
+  equipment: { type: Array }, // 设备共享
+  remark: { type: String },
+};
+const schema = new Schema(kjzl_medium, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ name: 1 });
+schema.index({ contact: 1 });
+schema.index({ phone: 1 });
+schema.index({ addr: 1 });
+schema.index({ belong: 1 });
+schema.index({ openid: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('KjzlMedium', schema, 'kjzlMedium');
+};

+ 22 - 0
app/model/kjzl/kjzlMiniVideo.js

@@ -0,0 +1,22 @@
+'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 kjzl_mini_video = {
+  title: { type: String }, // 标题
+  origin: { type: String }, // 来源
+  video_file: { type: Array }, // 视频文件
+  remark: { type: String },
+};
+const schema = new Schema(kjzl_mini_video, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ title: 1 });
+schema.index({ video_file: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('KjzlMiniVideo', schema, 'kjzlMiniVideo');
+};

+ 40 - 0
app/model/kjzl/kjzlOrder.js

@@ -0,0 +1,40 @@
+'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 kjzl_order = {
+  medium_id: { type: ObjectId }, // 机构id
+  openid: { type: String }, // 微信openid
+  project: { type: Object }, // 服务项目
+  contact: { type: String }, // 联系人
+  phone: { type: String }, // 联系电话
+  email: { type: String }, // 邮件
+  server_time: { type: String }, // 服务时间
+  remark: { type: String }, // 预约备注
+  type: { type: String }, // 服务类型
+  invoice: { type: String }, // 开具发票
+  company: { type: String }, // 公司名称
+  number: { type: String }, // 纳税人识别号
+  status: { type: String, default: '0' }, // 状态:0-预约;1-完成
+};
+const schema = new Schema(kjzl_order, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ medium_id: 1 });
+schema.index({ openid: 1 });
+schema.index({ project: 1 });
+schema.index({ contact: 1 });
+schema.index({ phone: 1 });
+schema.index({ server_time: 1 });
+schema.index({ type: 1 });
+schema.index({ invoice: 1 });
+schema.index({ company: 1 });
+schema.index({ number: 1 });
+schema.index({ status: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('KjzlOrder', schema, 'kjzlOrder');
+};

+ 25 - 0
app/model/kjzl/kjzlRefute.js

@@ -0,0 +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;
+// 科学辟谣表
+const kjzl_refute = {
+  title: { type: String }, // 标题
+  origin: { type: String }, // 来源
+  web: { type: String }, // 网址
+  cover: { type: Array }, // 封面
+  video_file: { type: Array }, // 视频文件
+  content: { type: String }, // 内容
+  remark: { type: String },
+};
+const schema = new Schema(kjzl_refute, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ origin: 1 });
+schema.index({ web: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('KjzlRefute', schema, 'kjzlRefute');
+};

+ 20 - 0
app/model/news/column.js

@@ -0,0 +1,20 @@
+'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 column = {
+  name: { type: String, required: true, maxLength: 500 }, // 栏目名称
+  site: { type: String, required: false, maxLength: 500 }, // 栏目位置
+  remark: { type: String, maxLength: 200 },
+  create_time: { type: String },
+};
+const schema = new Schema(column, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Column', schema, 'column');
+};

+ 28 - 0
app/model/news/interview.js

@@ -0,0 +1,28 @@
+'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 interview = {
+  dock_id: { type: ObjectId },
+  title: { type: String, required: false, maxLength: 500 }, // 标题
+  publish_time: { type: String, required: false, maxLength: 500 }, // 时间
+  origin: { type: String, required: false, maxLength: 500, default: '网站管理员' }, // 来源
+  brief: { type: String, maxLength: 100 }, // 简介
+  picture: { type: String, required: false }, // 图片
+  filepath: { type: String, required: false }, // 视频
+  content: { type: String, required: false }, // 正文内容
+  remark: { type: String, maxLength: 200 },
+  create_time: { type: String },
+};
+const schema = new Schema(interview, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ title: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Interview', schema, 'interview');
+};

+ 37 - 0
app/model/news/news.js

@@ -0,0 +1,37 @@
+'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 filelinks = new Schema({
+  title: { type: String, required: false, maxLength: 500 }, // 名称,
+  url: { type: String, required: false, maxLength: 500 }, // 链接地址,
+});
+// 信息表
+const news = {
+  user_id: { type: ObjectId },
+  column_id: { type: String, required: false, maxLength: 500 }, // 栏目id
+  column_name: { type: String, required: false, maxLength: 500 }, // 栏目名称
+  title: { type: String, required: false, maxLength: 500 }, // 标题
+  publish_time: { type: String, required: false, maxLength: 500 }, // 时间
+  origin: { type: String, required: false, maxLength: 500, default: '网站管理员' }, // 来源
+  brief: { type: String, maxLength: 300 }, // 简介
+  picture: { type: Object, required: false }, // 图片
+  filepath: { type: Object, required: false }, // 附件
+  video: { type: Object }, // 视频
+  content: { type: String, required: false }, // 正文内容
+  type: { type: String, required: false, maxLength: 200 }, // 类型,国家,科学院
+  remark: { type: String, maxLength: 200 },
+  create_time: { type: String },
+};
+const schema = new Schema(news, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ title: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('News', schema, 'news');
+};

+ 28 - 0
app/model/news/notice.js

@@ -0,0 +1,28 @@
+'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 notice = {
+  title: { type: String, required: true, maxLength: 500 }, // 标题
+  source: { type: String, required: false, maxLength: 500 }, // 来源
+  content: { type: String, required: false, maxLength: 500 }, // 内容
+  isenable: { type: String, required: false, maxLength: 500, default: '0' }, // 是否启用(0:未启用 1:启用 2:禁用)
+  user_id: { type: ObjectId, required: false, maxLength: 500 }, // 发布人id
+  code: { type: String, required: false, maxLength: 500 }, // 所属机构代码
+  remark: { type: String, maxLength: 200 },
+  create_time: { type: String }, // 发布时间
+};
+const schema = new Schema(notice, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ title: 1 });
+schema.index({ user_id: 1 });
+schema.index({ code: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Notice', schema, 'notice');
+};

+ 70 - 0
app/model/news/product.js

@@ -0,0 +1,70 @@
+'use strict';
+const Schema = require('mongoose').Schema;
+const moment = require('moment');
+const metaPlugin = require('naf-framework-mongoose-free/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 },
+};
+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');
+};

+ 47 - 0
app/model/news/projectSolic.js

@@ -0,0 +1,47 @@
+'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 projectsolic = {
+  name: { type: String, required: false, maxLength: 500 }, // 项目名称
+  pro_user: { type: String, required: true, maxLength: 500 }, // 项目负责人
+  pro_phone: { type: String, required: true, maxLength: 500 }, // 项目负责人电话
+  field: { type: String, required: false, maxLength: 500 }, // 领域分类
+  scale: { type: String, required: false, maxLength: 500 }, // 市场预估
+  techol_stage: { type: String, required: false, maxLength: 500 }, // 技术阶段
+  techol_level: { type: String, required: false, maxLength: 500 }, // 技术水平
+  proposal_company: { type: String, required: false, maxLength: 500 }, // 建议单位名称
+  proposal_user: { type: String, required: false, maxLength: 500 }, // 建议单位联系人
+  proposal_phone: { type: String, required: false, maxLength: 500 }, // 建议单位联系电话
+  coopera_company: { type: String, required: false, maxLength: 500 }, // 合作单位名称
+  coopera_user: { type: String, required: false, maxLength: 500 }, // 合作单位联系人
+  coopera_phone: { type: String, required: false, maxLength: 500 }, // 合作单位联系电话
+  project_back: { type: String, required: false, maxLength: 500 }, // 项目背景
+  sign: { type: String, required: false, maxLength: 500 }, // 立项意义
+  work_basics: { type: String, required: false, maxLength: 500 }, // 前期基础
+  content: { type: String, required: false, maxLength: 500 }, // 研究内容
+  route: { type: String, required: false, maxLength: 500 }, // 技术路线
+  quota: { type: String, required: false, maxLength: 500 }, // 核心指标
+  influence: { type: String, required: false, maxLength: 500 }, // 经济效益
+
+  question_id: { type: ObjectId, required: true, maxLength: 500 }, // 调研调查表id
+  user_id: { type: ObjectId, required: true, maxLength: 500 }, // 用户id
+  remark: { type: String, maxLength: 200 },
+  status: { type: String, default: '0' }, // 0-可修改;1-不可修改
+  create_time: {
+    type: String,
+  },
+};
+const schema = new Schema(projectsolic, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ question_id: 1 });
+schema.index({ user_id: 1 });
+schema.index({ pro_user: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('ProjectSolic', schema, 'projectSolic');
+};

+ 26 - 0
app/model/news/question.js

@@ -0,0 +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 question = {
+  title: { type: String, maxLength: 500 }, // 标题
+  origin: { type: String, maxLength: 500 }, // 来源
+  img_path: { type: String, maxLength: 500 }, // 图片
+  file_path: { type: String, maxLength: 500 }, // 文件
+  content: { type: String, maxLength: 500 }, // 内容
+  create_id: { type: String }, // 创建人id
+  create_code: { type: String }, // 创建人角色
+  remark: { type: String, maxLength: 200 },
+  create_date: { type: String },
+};
+const schema = new Schema(question, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ create_id: 1 });
+schema.index({ create_code: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('question', schema, 'question');
+};

+ 32 - 0
app/model/news/roadShow.js

@@ -0,0 +1,32 @@
+'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 road_show = {
+  user_id: { type: ObjectId },
+  dock_id: { type: ObjectId }, // 展会id
+  title: { type: String, required: false, maxLength: 500 }, // 标题
+  brief: { type: String, maxLength: 100 }, // 简介
+  origin: { type: String, required: false, maxLength: 500, default: '网站管理员' }, // 来源
+  publish_time: { type: String, required: false, maxLength: 500 }, // 发布时间
+  content: { type: String, required: false }, // 正文
+  picture: { type: String, required: false }, // 图片路径
+  filepath: { type: String, required: false }, // 文件路径
+  remark: { type: String, maxLength: 200 },
+  create_time: { type: String },
+};
+const schema = new Schema(road_show, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ dock_id: 1 });
+schema.index({ title: 1 });
+schema.index({ origin: 1 });
+schema.index({ publish_time: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('RoadShow', schema, 'roadShow');
+};

+ 25 - 0
app/model/news/science.js

@@ -0,0 +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 { Secret } = require('naf-framework-mongoose-free/lib/model/schema');
+const { ObjectId } = require('mongoose').Types;
+// 科技新闻表
+const science = {
+  title: { type: String, required: false, maxLength: 500 }, // 名称
+  publish_time: { type: String, required: false, maxLength: 500 }, // 时间
+  origin: { type: String, required: false, maxLength: 500 }, // 来源
+  picture: { type: String, required: false }, // 图片
+  filepath: { type: String, required: false }, // 附件
+  content: { type: String, required: false }, // 正文
+  remark: { type: String, maxLength: 200 },
+  create_time: { type: String },
+};
+const schema = new Schema(science, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Science', schema, 'science');
+};

+ 31 - 0
app/model/news/survey.js

@@ -0,0 +1,31 @@
+'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 survey = {
+  user_id: { type: ObjectId, required: false, maxLength: 500 }, // 用户id
+  // 网上调查
+  resource: { type: String, required: false, maxLength: 500 }, // 是否愿意
+  // 建议
+  nickname: { type: String, required: false, maxLength: 500 }, // 昵称
+  name: { type: String, required: false, maxLength: 500 }, // 姓名
+  phone: { type: String, required: false, maxLength: 500 }, // 手机号
+  work: { type: String, required: false, maxLength: 500 }, // 职业
+  address: { type: String, required: false, maxLength: 500 }, // 详细地址
+  title: { type: String, required: false, maxLength: 500 }, // 标题
+  proposal: { type: String, required: false, maxLength: 500 }, // 建议内容
+  remark: { type: String, maxLength: 200 },
+  create_time: { type: String },
+};
+const schema = new Schema(survey, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ user_id: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Survey', schema, 'survey');
+};

+ 30 - 0
app/model/news/universal.js

@@ -0,0 +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 { ObjectId } = require('mongoose').Types;
+// 科技普及表
+const universal = {
+  type: { type: String }, // 类型
+  title: { type: String }, // 标题
+  origin: { type: String }, // 来源
+  create_time: { type: String }, // 创建时间
+  img_url: { type: Array }, // //图片路径
+  file_url: { type: Array }, // 文件路径
+  content: { type: String }, // 内容
+  user_id: { type: ObjectId }, // 创建用户
+  remark: { type: String },
+};
+const schema = new Schema(universal, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ type: 1 });
+schema.index({ title: 1 });
+schema.index({ create_time: 1 });
+schema.index({ user_id: 1 });
+schema.index({ origin: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Universal', schema, 'universal');
+};

+ 33 - 0
app/model/news/viewPoint.js

@@ -0,0 +1,33 @@
+'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 view_point = {
+  user_id: { type: ObjectId }, //
+  title: { type: String }, // 标题
+  publish_time: { type: String }, // 时间
+  origin: { type: String, default: '网站管理员' }, // 来源
+  brief: { type: String }, // 简介
+  is_money: { type: Boolean, default: false }, // 是否收费
+  money_url: { type: String }, // 收款图片
+  picture: { type: Object }, // 图片
+  filepath: { type: Object }, // 附件
+  video: { type: Object }, // 视频
+  content: { type: String }, // 正文内容
+  remark: { type: String },
+  create_time: { type: String }, // 创建时间
+};
+const schema = new Schema(view_point, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ title: 1 });
+schema.index({ publish_time: 1 });
+schema.index({ origin: 1 });
+schema.index({ is_money: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('ViewPoint', schema, 'viewPoint');
+};

+ 30 - 0
app/model/patent/agentMech.js

@@ -0,0 +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 { ObjectId } = require('mongoose').Types;
+const { Secret } = require('naf-framework-mongoose-free/lib/model/schema');
+// 代理机构表
+const agent_mech = {
+  pid: { type: ObjectId }, // 管理员id
+  pid_name: { type: String }, // 管理员名称
+  mech_name: { type: String }, // 机构名称
+  name: { type: String }, // 姓名
+  phone: { type: String }, // 手机号
+  password: { type: Secret, select: false }, // 密码
+  role: { type: String, default: '4' }, // 角色
+  remark: { type: String },
+};
+const schema = new Schema(agent_mech, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ pid: 1 });
+schema.index({ pid_name: 1 });
+schema.index({ mech_name: 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('AgentMech', schema, 'agentMech');
+};

+ 41 - 0
app/model/patent/answerTea.js

@@ -0,0 +1,41 @@
+'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 answer_tea = {
+  name: { type: String }, // 姓名
+  phone: { type: String }, // 手机号
+  password: { type: Secret, select: false }, // 密码
+  card: { type: String }, // 身份证号
+  email: { type: String }, // 电子邮箱
+  address: { type: String }, // 地址
+  zwzc: { type: String }, // 职务职称
+  school: { type: String }, // 院校
+  major: { type: String }, // 专业
+  word_tel: { type: String }, // 办公电话
+  type: { type: String }, // 用户类型:1-咨询师;2-代理师;3-分析师
+  role: { type: String, default: '5' }, // 角色
+  remark: { type: String },
+};
+const schema = new Schema(answer_tea, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ name: 1 });
+schema.index({ phone: 1 });
+schema.index({ card: 1 });
+schema.index({ email: 1 });
+schema.index({ address: 1 });
+schema.index({ zwzc: 1 });
+schema.index({ school: 1 });
+schema.index({ major: 1 });
+schema.index({ word_tel: 1 });
+schema.index({ type: 1 });
+schema.index({ role: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('AnswerTea', schema, 'answerTea');
+};

+ 29 - 0
app/model/patent/dimension.js

@@ -0,0 +1,29 @@
+'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 dimension = {
+  user_id: { type: ObjectId }, //
+  title: { type: String }, // 标题
+  publish_time: { type: String }, // 时间
+  origin: { type: String, default: '网站管理员' }, // 来源
+  brief: { type: String }, // 简介
+  is_show: { type: Boolean, default: false }, // 是否展示
+  filepath: { type: Object }, // 附件
+  content: { type: String }, // 正文内容
+  remark: { type: String },
+  create_time: { type: String }, // 创建时间
+};
+const schema = new Schema(dimension, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ title: 1 });
+schema.index({ publish_time: 1 });
+schema.index({ origin: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Dimension', schema, 'dimension');
+};

+ 41 - 0
app/model/patent/disclosure.js

@@ -0,0 +1,41 @@
+'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 disclosure = {
+  user_id: { type: ObjectId }, // 用户id
+  admin_id: { type: ObjectId }, // 管理员id
+  name: { type: String }, // 发明名称
+  apply_name: { type: String }, // 申请人
+  type: { type: String }, // 申请类型
+  inventer: { type: String }, // 发明人
+  contact: { type: String }, // 技术联系人
+  phone: { type: String }, // 联系人电话
+  email: { type: String }, // 联系人邮箱
+  desc: { type: String }, // 特殊情况说明
+  questions: { type: Object }, // 问题
+  is_mech: { type: String }, // 是否需要机构
+  mechanism_id: { type: ObjectId }, // 机构id
+  mechanism_name: { type: String }, // 机构名称
+  status: { type: String, default: '0' }, // 状态:0-已申请;1-机构审核;-1-机构审核未通过;2-管理员评估;-2-管理员评估未通过;3-管理员评估通过,等待上传至国家库;4-上传完成
+  record: { type: Array }, // 记录
+  remark: { type: String },
+};
+const schema = new Schema(disclosure, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ admin_id: 1 });
+schema.index({ user_id: 1 });
+schema.index({ apply_name: 1 });
+schema.index({ name: 1 });
+schema.index({ status: 1 });
+schema.index({ is_mech: 1 });
+schema.index({ mechanism_id: 1 });
+schema.index({ mechanism_name: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Disclosure', schema, 'disclosure');
+};

+ 18 - 0
app/model/patent/importTemp.js

@@ -0,0 +1,18 @@
+'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 import_temp = {
+  data: { type: Array }, // 数据
+  remark: { type: String },
+};
+const schema = new Schema(import_temp, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('ImportTemp', schema, 'importTemp');
+};

+ 22 - 0
app/model/patent/notice.js

@@ -0,0 +1,22 @@
+'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 notice = {
+  to: { type: ObjectId }, // 接收人
+  content: { type: String }, // 内容
+  is_read: { type: Boolean, default: false }, // 是否已读
+  remark: { type: String },
+};
+const schema = new Schema(notice, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ to: 1 });
+schema.index({ is_read: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('DisclosureNotice', schema, 'disclosure_notice');
+};

+ 36 - 0
app/model/patent/patentanalysis.js

@@ -0,0 +1,36 @@
+'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 patentanalysis = {
+  user_id: { type: ObjectId }, // 用户id
+  user_name: { type: String }, // 用户姓名
+  admin_id: { type: ObjectId }, // 管理员id
+  admin_name: { type: String }, // 管理员姓名
+  name: { type: String }, // 发明名称
+  apply_name: { type: String }, // 申请人
+  type: { type: String }, // 专利类型
+  inventor: { type: String }, // 发明人
+  contact: { type: String }, // 联系人
+  phone: { type: String }, // 联系人电话
+  email: { type: String }, // 联系人邮箱
+  questions: { type: Object, default: {} }, // 问题
+  file: { type: Array }, // 报告文件
+  status: { type: String, default: "0" }, // 状态
+  record: { type: Array }, // 记录
+  remark: { type: String },
+};
+const schema = new Schema(patentanalysis, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ user_id: 1 });
+schema.index({ admin_id: 1 });
+schema.index({ name: 1 });
+schema.index({ status: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Patentanalysis', schema, 'patent_analysis');
+};

+ 47 - 0
app/model/patent/patentapply.js

@@ -0,0 +1,47 @@
+'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 patentapply = {
+  user_id: { type: ObjectId }, // 用户id
+  user_name: { type: String }, // 用户姓名
+  mech_id: { type: ObjectId }, // 机构id
+  mech_name: { type: String }, // 机构名称
+  admin_id: { type: ObjectId }, // 管理员id
+  admin_name: { type: String }, // 管理员姓名
+  agentmech_id: { type: ObjectId }, // 代理机构id
+  agentmech_name: { type: String }, // 代理机构姓名
+  create_number: { type: String }, // 申请号
+  name: { type: String }, // 发明名称
+  apply_name: { type: String }, // 申请人
+  type: { type: String }, // 申请类型
+  inventor: { type: String }, // 发明人
+  contact: { type: String }, // 技术联系人
+  phone: { type: String }, // 联系电话
+  email: { type: String }, // 电子邮箱
+  questions: { type: Object, default: {} }, // 问题
+  check_url: { type: Array }, // 审查文件
+  agent_url: { type: Array }, // 申请文件
+  record: { type: Array }, // 记录
+  status: { type: String, default: '0' }, // 状态0:待审查,1:审查通过,-1:审查未通过,2:科企&&代理机构,3:代理机构选择科企,-3:自己走,4:科企上传并下发
+  remark: { type: String },
+};
+const schema = new Schema(patentapply, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ user_id: 1 });
+schema.index({ mech_id: 1 });
+schema.index({ admin_id: 1 });
+schema.index({ agentmech_id: 1 });
+schema.index({ create_number: 1 });
+schema.index({ name: 1 });
+schema.index({ apply_name: 1 });
+schema.index({ type: 1 });
+schema.index({ status: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Patentapply', schema, 'patent_apply');
+};

+ 47 - 0
app/model/patent/patentassess.js

@@ -0,0 +1,47 @@
+'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 patentassess = {
+  user_id: { type: ObjectId, required: false }, // 用户id
+  user_name: { type: String, required: false }, // 用户姓名
+  admin_id: { type: ObjectId, required: false }, // 管理员id
+  admin_name: { type: String, required: false }, // 管理员姓名
+  patent_id: { type: ObjectId }, // 专利id
+  create_number: { type: String, required: false }, // 申请号
+  patent_name: { type: String, required: false }, // 专利名称
+  inventor: { type: String, required: false }, // 发明人
+  type: { type: String, required: false }, // 专利类型
+  contact: { type: String, required: false }, // 联系人
+  phone: { type: String, required: false }, // 联系人电话
+  email: { type: String, required: false }, // 联系人邮箱
+  abstract: { type: String, required: false }, // 摘要
+  field: { type: String, required: false }, // 应用领域
+  explain: { type: String, required: false }, // 技术说明
+  shared_value: { type: String, required: false }, // 合享价值度
+  techol_stable: { type: String, required: false }, // 技术稳定性
+  techol_advanced: { type: String, required: false }, // 技术先进性
+  is_money: { type: Boolean, default: false }, // 是否缴费
+  status: { type: String, default: '0' }, // 状态
+  report: { type: Array }, // 评估报告
+  record: { type: Array }, // 记录
+  remark: { type: String },
+};
+const schema = new Schema(patentassess, { toJSON: { virtuals: true } });
+schema.index({ id: 1 });
+schema.index({ user_id: 1 });
+schema.index({ admin_id: 1 });
+schema.index({ patent_id: 1 });
+schema.index({ create_number: 1 });
+schema.index({ patent_name: 1 });
+schema.index({ type: 1 });
+schema.index({ is_money: 1 });
+schema.index({ status: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Patentassess', schema, 'patent_assess');
+};

+ 0 - 0
app/model/patent/patentchat.js


Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác