lrf402788946 4 年之前
父節點
當前提交
be58de6637
共有 58 個文件被更改,包括 1163 次插入351 次删除
  1. 35 31
      app/controller/cysci/.cashing.js
  2. 3 2
      app/controller/cysci/.coupons.js
  3. 9 3
      app/controller/cysci/.coupons_apply.js
  4. 21 7
      app/controller/cysci/.declare.js
  5. 5 2
      app/controller/cysci/.reward.js
  6. 0 80
      app/controller/cysci/.reward_order.js
  7. 0 13
      app/controller/cysci/declare_order.js
  8. 0 13
      app/controller/cysci/reward_order.js
  9. 2 24
      app/controller/cysci/.declare_order.js
  10. 39 0
      app/controller/kjzl/.kjzl_expert_view.js
  11. 84 0
      app/controller/kjzl/.kjzl_medium.js
  12. 39 0
      app/controller/kjzl/.kjzl_mini_video.js
  13. 63 0
      app/controller/kjzl/.kjzl_order.js
  14. 39 0
      app/controller/kjzl/.kjzl_refute.js
  15. 13 0
      app/controller/kjzl/kjzl_chat.js
  16. 13 0
      app/controller/kjzl/kjzl_expert_view.js
  17. 13 0
      app/controller/kjzl/kjzl_medium.js
  18. 13 0
      app/controller/kjzl/kjzl_mini_video.js
  19. 13 0
      app/controller/kjzl/kjzl_order.js
  20. 13 0
      app/controller/kjzl/kjzl_refute.js
  21. 29 0
      app/controller/weixin.js
  22. 37 0
      app/middleware/create_time.js
  23. 12 13
      app/middleware/declare_order.js
  24. 14 19
      app/model/cashing.js
  25. 3 2
      app/model/coupons.js
  26. 6 3
      app/model/coupons_apply.js
  27. 11 3
      app/model/declare.js
  28. 0 29
      app/model/declare_order.js
  29. 24 0
      app/model/kjzl/kjzl_chat.js
  30. 22 0
      app/model/kjzl/kjzl_expert_view.js
  31. 37 0
      app/model/kjzl/kjzl_medium.js
  32. 22 0
      app/model/kjzl/kjzl_mini_video.js
  33. 32 0
      app/model/kjzl/kjzl_order.js
  34. 25 0
      app/model/kjzl/kjzl_refute.js
  35. 4 2
      app/model/reward.js
  36. 0 41
      app/model/reward_order.js
  37. 7 2
      app/router.js
  38. 1 0
      app/router/cysci/cashing.js
  39. 2 1
      app/router/cysci/declare.js
  40. 4 3
      app/router/cysci/reward_order.js
  41. 13 0
      app/router/kjzl/kjzl_expert_view.js
  42. 16 0
      app/router/kjzl/kjzl_medium.js
  43. 13 0
      app/router/kjzl/kjzl_mini_video.js
  44. 14 0
      app/router/kjzl/kjzl_order.js
  45. 4 4
      app/router/cysci/declare_order.js
  46. 16 4
      app/service/cysci/cashing.js
  47. 9 0
      app/service/cysci/coupons_apply.js
  48. 12 21
      app/service/cysci/declare.js
  49. 0 23
      app/service/cysci/reward_order.js
  50. 15 0
      app/service/kjzl/kjzl_chat.js
  51. 15 0
      app/service/kjzl/kjzl_expert_view.js
  52. 51 0
      app/service/kjzl/kjzl_medium.js
  53. 15 0
      app/service/kjzl/kjzl_mini_video.js
  54. 15 0
      app/service/kjzl/kjzl_order.js
  55. 5 5
      app/service/cysci/declare_order.js
  56. 226 0
      app/service/weixin.js
  57. 12 0
      config/config.default.js
  58. 3 1
      package.json

+ 35 - 31
app/controller/cysci/.cashing.js

@@ -1,27 +1,28 @@
 module.exports = {
   create: {
     requestBody: [
-      "cashing_no",
+      "no",
       "coupons_id",
-      "coupons_type",
-      "coupons_name",
-      "company_id",
-      "company_name",
-      "create_time",
-      "end_time",
-      "mechanism_id",
-      "mechanism_name",
+      "company",
+      "apply_person",
+      "phone",
       "money",
       "allowance",
       "total",
-      "status",
-      "remark",
+      "create_time",
+      "end_time",
       "contract",
       "accept",
       "cost",
       "result",
       "result_else",
+      "status",
       "record",
+      "user_id",
+      "remark",
+      "declare_id",
+      "reward_id",
+      "from_id",
     ],
   },
   destroy: {
@@ -31,27 +32,26 @@ module.exports = {
   update: {
     params: ["!id"],
     requestBody: [
-      "cashing_no",
+      "no",
       "coupons_id",
-      "coupons_type",
-      "coupons_name",
-      "company_id",
-      "company_name",
-      "create_time",
-      "end_time",
-      "mechanism_id",
-      "mechanism_name",
+      "company",
+      "apply_person",
+      "phone",
       "money",
       "allowance",
       "total",
-      "status",
-      "remark",
+      "create_time",
+      "end_time",
       "contract",
       "accept",
       "cost",
       "result",
       "result_else",
+      "status",
       "record",
+      "user_id",
+      "remark",
+      "from_id",
     ],
   },
   show: {
@@ -63,19 +63,19 @@ module.exports = {
   index: {
     parameters: {
       query: {
-        cashing_no: "cashing_no",
+        no: "no",
         coupons_id: "coupons_id",
-        coupons_type: "coupons_type",
-        coupons_name: "coupons_name",
-        company_id: "company_id",
-        company_name: "company_name",
-        create_time: "create_time",
-        end_time: "end_time",
-        mechanism_id: "mechanism_id",
-        mechanism_name: "mechanism_name",
+        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 // 默认条件
@@ -89,4 +89,8 @@ module.exports = {
       count: true,
     },
   },
+  from: {
+    params: ["!from_id"],
+    service: "getFromId",
+  },
 };

+ 3 - 2
app/controller/cysci/.coupons.js

@@ -4,13 +4,13 @@ module.exports = {
       "user_id",
       "name",
       "discount_type",
+      "coupons_type",
       "use_type",
       "classify",
       "limit_time",
       "scale",
       "allowance",
       "total_allowance",
-      "unit_allowance",
       "desc",
       "status",
       "remark",
@@ -26,13 +26,13 @@ module.exports = {
       "user_id",
       "name",
       "discount_type",
+      "coupons_type",
       "use_type",
       "classify",
       "limit_time",
       "scale",
       "allowance",
       "total_allowance",
-      "unit_allowance",
       "desc",
       "status",
       "remark",
@@ -49,6 +49,7 @@ module.exports = {
       query: {
         user_id: "user_id",
         name: "name",
+        coupons_type: "coupons_type",
         discount_type: "discount_type",
         use_type: "use_type",
         classify: "classify",

+ 9 - 3
app/controller/cysci/.coupons_apply.js

@@ -4,12 +4,15 @@ module.exports = {
       "user_id",
       "coupons_id",
       "company",
-      "apply_personal",
+      "apply_person",
       "phone",
       "qyfr",
       "yyzz",
       "qylr",
       "record",
+      "apply_money",
+      "actual_money",
+      "section_time",
       "status",
       "is_use",
       "remark",
@@ -25,12 +28,15 @@ module.exports = {
       "user_id",
       "coupons_id",
       "company",
-      "apply_personal",
+      "apply_person",
       "phone",
       "qyfr",
       "yyzz",
       "qylr",
       "record",
+      "apply_money",
+      "actual_money",
+      "section_time",
       "status",
       "is_use",
       "remark",
@@ -48,7 +54,7 @@ module.exports = {
         user_id: "user_id",
         coupons_id: "coupons_id",
         company: "company",
-        apply_personal: "apply_personal",
+        apply_person: "apply_person",
         phone: "phone",
         status: "status",
         is_use: "is_use",

+ 21 - 7
app/controller/cysci/.declare.js

@@ -1,11 +1,18 @@
 module.exports = {
   create: {
     requestBody: [
-      "user_id",
+      "company",
+      "apply_person",
+      "phone",
       "material",
+      "medium_id",
       "medium_material",
       "contract",
-      "mechanism_id",
+      "is_cashing",
+      "status",
+      "record",
+      "remark",
+      "user_id",
     ],
   },
   destroy: {
@@ -15,14 +22,18 @@ module.exports = {
   update: {
     params: ["!id"],
     requestBody: [
-      "user_id",
-      "mechanism_id",
+      "company",
+      "apply_person",
+      "phone",
       "material",
+      "medium_id",
       "medium_material",
       "contract",
-      'record',
+      "is_cashing",
       "status",
-      "name",
+      "record",
+      "remark",
+      "user_id",
     ],
   },
   show: {
@@ -36,8 +47,11 @@ module.exports = {
       query: {
         name: "name",
         user_id: "user_id",
-        mechanism_id: "mechanism_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",
       },

+ 5 - 2
app/controller/cysci/.reward.js

@@ -3,7 +3,7 @@ module.exports = {
     requestBody: [
       "type",
       "company",
-      "apply_personal",
+      "apply_person",
       "phone",
       "qyfr",
       "yyzz",
@@ -12,6 +12,7 @@ module.exports = {
       "status",
       "remark",
       "record",
+      "is_cashing",
     ],
   },
   destroy: {
@@ -23,7 +24,7 @@ module.exports = {
     requestBody: [
       "type",
       "company",
-      "apply_personal",
+      "apply_person",
       "phone",
       "qyfr",
       "yyzz",
@@ -32,6 +33,7 @@ module.exports = {
       "status",
       "remark",
       "record",
+      "is_cashing",
     ],
   },
   show: {
@@ -47,6 +49,7 @@ module.exports = {
         company: "company",
         user_id: "user_id",
         status: "status",
+        is_cashing: "is_cashing",
         "create_time@start": "create_time@start",
         "create_time@end": "create_time@end",
       },

+ 0 - 80
app/controller/cysci/.reward_order.js

@@ -1,80 +0,0 @@
-module.exports = {
-  create: {
-    requestBody: [
-      "no",
-      "company_id",
-      "company_name",
-      "create_time",
-      "end_time",
-      "money",
-      "allowance",
-      "total",
-      "status",
-      "remark",
-      "contract",
-      "accept",
-      "cost",
-      "result",
-      "result_else",
-      "record",
-      "type",
-    ],
-  },
-  destroy: {
-    params: ["!id"],
-    service: "delete",
-  },
-  update: {
-    params: ["!id"],
-    requestBody: [
-      "no",
-      "company_id",
-      "company_name",
-      "create_time",
-      "end_time",
-      "money",
-      "allowance",
-      "total",
-      "status",
-      "remark",
-      "contract",
-      "accept",
-      "cost",
-      "result",
-      "result_else",
-      "record",
-      "type",
-    ],
-  },
-  show: {
-    parameters: {
-      params: ["!id"],
-    },
-    service: "fetch",
-  },
-  index: {
-    parameters: {
-      query: {
-        no: "no",
-        company_id: "company_id",
-        company_name: "company_name",
-        create_time: "create_time",
-        end_time: "end_time",
-        status: "status",
-        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,
-    },
-  },
-};

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

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

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

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

+ 2 - 24
app/controller/cysci/.declare_order.js

@@ -1,14 +1,6 @@
 module.exports = {
   create: {
-    requestBody: [
-      "user_id",
-      "name",
-      "mechanism_id",
-      "no",
-      "is_pay",
-      "time",
-      "remark",
-    ],
+    requestBody: [],
   },
   destroy: {
     params: ["!id"],
@@ -16,15 +8,7 @@ module.exports = {
   },
   update: {
     params: ["!id"],
-    requestBody: [
-      "user_id",
-      "name",
-      "mechanism_id",
-      "no",
-      "is_pay",
-      "time",
-      "remark",
-    ],
+    requestBody: [],
   },
   show: {
     parameters: {
@@ -35,12 +19,6 @@ module.exports = {
   index: {
     parameters: {
       query: {
-        user_id: "user_id",
-        name: "name",
-        mechanism_id: "mechanism_id",
-        no: "no",
-        is_pay: "is_pay",
-        time: "time",
         "create_time@start": "create_time@start",
         "create_time@end": "create_time@end",
       },

+ 39 - 0
app/controller/kjzl/.kjzl_expert_view.js

@@ -0,0 +1,39 @@
+module.exports = {
+  create: {
+    requestBody: ["title", "origin", "content"],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: ["title", "origin", "content"],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        title: "title",
+        origin: "origin",
+        "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,
+    },
+  },
+};

+ 84 - 0
app/controller/kjzl/.kjzl_medium.js

@@ -0,0 +1,84 @@
+module.exports = {
+  create: {
+    requestBody: [
+      "name",
+      "contact",
+      "phone",
+      "addr",
+      "belong",
+      "password",
+      "openid",
+      "natural",
+      "achieve",
+      "team",
+      "img_file",
+      "project",
+      "equipment",
+      "remark",
+    ],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: [
+      "name",
+      "contact",
+      "phone",
+      "addr",
+      "belong",
+      "password",
+      "openid",
+      "natural",
+      "achieve",
+      "team",
+      "img_file",
+      "project",
+      "equipment",
+      "remark",
+    ],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        name: "name",
+        contact: "contact",
+        phone: "phone",
+        addr: "addr",
+        belong: "belong",
+        openid: "openid",
+        "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: ["password"],
+    service: "password",
+  },
+  // 登陆
+  login: {
+    requestBody: ["phone", "password"],
+    service: "login",
+  },
+};

+ 39 - 0
app/controller/kjzl/.kjzl_mini_video.js

@@ -0,0 +1,39 @@
+module.exports = {
+  create: {
+    requestBody: ["title", "origin", "video_file"],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: ["title", "origin", "video_file"],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        title:"title",
+        origin:"origin",
+        "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,
+    },
+  },
+};

+ 63 - 0
app/controller/kjzl/.kjzl_order.js

@@ -0,0 +1,63 @@
+module.exports = {
+  create: {
+    requestBody: [
+      "medium_id",
+      "openid",
+      "project",
+      "contact",
+      "phone",
+      "email",
+      "server_time",
+      "remark",
+      "status",
+    ],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: [
+      "medium_id",
+      "openid",
+      "project",
+      "contact",
+      "phone",
+      "email",
+      "server_time",
+      "remark",
+      "status",
+    ],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        medium_id: "medium_id",
+        openid: "openid",
+        project: "project",
+        contact: "contact",
+        phone: "phone",
+        status: "status",
+        "server_time@start": "server_time@start",
+        "server_time@end": "server_time@end",
+      },
+      // options: {
+      //   "meta.state": 0 // 默认条件
+      // },
+    },
+    service: "query",
+    options: {
+      query: ["skip", "limit"],
+      sort: ["meta.createdAt"],
+      desc: true,
+      count: true,
+    },
+  },
+};

+ 39 - 0
app/controller/kjzl/.kjzl_refute.js

@@ -0,0 +1,39 @@
+module.exports = {
+  create: {
+    requestBody: ["title", "origin", "web", "cover", "video_file", "content"],
+  },
+  destroy: {
+    params: ["!id"],
+    service: "delete",
+  },
+  update: {
+    params: ["!id"],
+    requestBody: ["title", "origin", "web", "cover", "video_file", "content"],
+  },
+  show: {
+    parameters: {
+      params: ["!id"],
+    },
+    service: "fetch",
+  },
+  index: {
+    parameters: {
+      query: {
+        title: "title",
+        origin: "origin",
+        "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,
+    },
+  },
+};

+ 13 - 0
app/controller/kjzl/kjzl_chat.js

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./.kjzl_chat.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose/lib/controller');
+
+// 科教之旅-评价表
+class Kjzl_chatController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.kjzl.kjzlChat;
+  }
+}
+module.exports = CrudController(Kjzl_chatController, meta);

+ 13 - 0
app/controller/kjzl/kjzl_expert_view.js

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./.kjzl_expert_view.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose/lib/controller');
+
+// 科教之旅-专家视点
+class Kjzl_expert_viewController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.kjzl.kjzlExpertView;
+  }
+}
+module.exports = CrudController(Kjzl_expert_viewController, meta);

+ 13 - 0
app/controller/kjzl/kjzl_medium.js

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./.kjzl_medium.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose/lib/controller');
+
+// 科教之旅机构表
+class Kjzl_mediumController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.kjzl.kjzlMedium;
+  }
+}
+module.exports = CrudController(Kjzl_mediumController, meta);

+ 13 - 0
app/controller/kjzl/kjzl_mini_video.js

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./.kjzl_mini_video.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose/lib/controller');
+
+// 科教微视频
+class Kjzl_mini_videoController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.kjzl.kjzlMiniVideo;
+  }
+}
+module.exports = CrudController(Kjzl_mini_videoController, meta);

+ 13 - 0
app/controller/kjzl/kjzl_order.js

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./.kjzl_order.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose/lib/controller');
+
+// 科教之旅订单
+class Kjzl_orderController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.kjzl.kjzlOrder;
+  }
+}
+module.exports = CrudController(Kjzl_orderController, meta);

+ 13 - 0
app/controller/kjzl/kjzl_refute.js

@@ -0,0 +1,13 @@
+'use strict';
+const meta = require('./.kjzl_refute.js');
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose/lib/controller');
+
+// 科学辟谣
+class Kjzl_refuteController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.kjzl.kjzlRefute;
+  }
+}
+module.exports = CrudController(Kjzl_refuteController, meta);

+ 29 - 0
app/controller/weixin.js

@@ -0,0 +1,29 @@
+'use strict';
+const Controller = require('egg').Controller;
+const { CrudController } = require('naf-framework-mongoose/lib/controller');
+
+class WeixinController extends Controller {
+  constructor(ctx) {
+    super(ctx);
+    this.service = this.ctx.service.weixin;
+  }
+  async index() {
+    console.log(this.ctx.params, this.ctx.query);
+    this.ctx.ok();
+  }
+  async auth() {
+    await this.service.auth(this.ctx.query);
+  }
+  async authBack() {
+    await this.service.authBack(this.ctx.query);
+  }
+  async wxUser() {
+    const data = await this.service.wxUser(this.ctx.query);
+    this.ctx.ok({ data });
+  }
+  async jsapiAuth() {
+    const res = await this.service.jsapiAuth(this.ctx.request.body);
+    this.ctx.ok({ data: res });
+  }
+}
+module.exports = CrudController(WeixinController, {});

+ 37 - 0
app/middleware/create_time.js

@@ -0,0 +1,37 @@
+'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) {
+    console.log('function in create_time middleware');
+    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;
+    }
+  };
+};

+ 12 - 13
app/middleware/declare_order.js

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

+ 14 - 19
app/model/cashing.js

@@ -5,41 +5,36 @@ const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
 const { ObjectId } = require('mongoose').Types;
 // 兑付申请表
 const cashing = {
-  cashing_no: { type: String }, // 兑付申请号(自动生成)
+  no: { type: String }, // 兑付申请号(自动生成)
   coupons_id: { type: ObjectId }, // 券的id
-  coupons_type: { type: String }, // 券的类别
-  coupons_name: { type: String }, // 券的名称
-  company_id: { type: ObjectId }, // 使用单位id
-  company_name: { type: String }, // 使用单位
-  create_time: { type: String }, // 提交时间,服务端生成
-  end_time: { type: String }, // 最后审核时间
-  mechanism_id: { type: ObjectId }, // 服务提供商_id
-  mechanism_name: { type: String }, // 服务提供商
+  company: { type: String }, // 申请单位
+  apply_person: { type: String }, // 申请人
+  phone: { type: String }, // 联系电话
   money: { type: Number }, // 订单金额
   allowance: { type: Number }, // 抵扣金额
   total: { type: Number }, // 应收金额
-  status: { type: String, default: '0' }, // 0-待审核;1-通过;-1-拒绝
-  remark: { type: String },
-  // 需要上传的资料
+  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({ cashing_no: 1 });
+schema.index({ no: 1 });
 schema.index({ coupons_id: 1 });
-schema.index({ coupons_type: 1 });
-schema.index({ coupons_name: 1 });
-schema.index({ company_id: 1 });
-schema.index({ company_name: 1 });
+schema.index({ company: 1 });
+schema.index({ apply_person: 1 });
 schema.index({ create_time: 1 });
 schema.index({ end_time: 1 });
-schema.index({ mechanism_id: 1 });
-schema.index({ mechanism_name: 1 });
+schema.index({ from_id: 1 });
 schema.index({ status: 1 });
 schema.index({ 'meta.createdAt': 1 });
 schema.plugin(metaPlugin);

+ 3 - 2
app/model/coupons.js

@@ -6,15 +6,15 @@ 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: String }, // 期限
+  limit_time: { type: Number }, // 期限
   scale: { type: String }, // 抵扣比例-为折扣券
   allowance: { type: String }, // 面额
   total_allowance: { type: String }, // 券总额度
-  unit_allowance: { type: String }, // 单个企业/团队最大额度
   desc: { type: String }, // 描述
   status: { type: String, default: '0' }, // 0:待上架;1:上架;-1:下架
   remark: { type: String },
@@ -24,6 +24,7 @@ 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 });

+ 6 - 3
app/model/coupons_apply.js

@@ -8,22 +8,25 @@ const coupons_apply = {
   user_id: { type: ObjectId }, // 申请人id
   coupons_id: { type: ObjectId }, // 创新券id
   company: { type: String }, // 申请企业
-  apply_personal: { 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: Boolean, default: true },
+  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_personal: 1 });
+schema.index({ apply_person: 1 });
 schema.index({ phone: 1 });
 schema.index({ is_use: 1 });
 schema.index({ 'meta.createdAt': 1 });

+ 11 - 3
app/model/declare.js

@@ -5,20 +5,28 @@ const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
 const { ObjectId } = require('mongoose').Types;
 // 高企申报表
 const declare = {
-  user_id: { type: ObjectId }, // 用户id
-  mechanism_id: { type: ObjectId }, // 中介机构id
+  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 }, // 合同
-  status: { type: String, default: '0' },
+  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 });

+ 0 - 29
app/model/declare_order.js

@@ -1,29 +0,0 @@
-'use strict';
-const Schema = require('mongoose').Schema;
-const moment = require('moment');
-const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
-const { ObjectId } = require('mongoose').Types;
-// 高企申报订单表
-const declare_order = {
-  user_id: { type: ObjectId }, // 企业id
-  name: { type: String }, // 企业名称
-  mechanism_id: { type: ObjectId }, // 中介机构id, 需要换信息
-  no: { type: String, unique: true }, // 订单号,时间戳
-  is_pay: { type: String, default: '0' }, // 兑付状态 0;1;2
-  time: { type: String }, // 创建时间
-  remark: { type: String },
-};
-const schema = new Schema(declare_order, { toJSON: { virtuals: true } });
-schema.index({ id: 1 });
-schema.index({ user_id: 1 });
-schema.index({ name: 1 });
-schema.index({ mechanism_id: 1 });
-schema.index({ no: 1 });
-schema.index({ is_pay: 1 });
-schema.index({ time: 1 });
-schema.index({ 'meta.createdAt': 1 });
-schema.plugin(metaPlugin);
-module.exports = app => {
-  const { mongoose } = app;
-  return mongoose.model('Declare_order', schema, 'declare_order');
-};

+ 24 - 0
app/model/kjzl/kjzl_chat.js

@@ -0,0 +1,24 @@
+'use strict';
+const Schema = require('mongoose').Schema;
+const moment = require('moment');
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
+const { ObjectId } = require('mongoose').Types;
+// 科教之旅-评价表
+const kjzl_chat = {
+  medium_id: { type: ObjectId }, // 机构id
+  user_id: { type: ObjectId }, // 用户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({ 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('Kjzl_chat', schema, 'kjzl_chat');
+};

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

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

+ 37 - 0
app/model/kjzl/kjzl_medium.js

@@ -0,0 +1,37 @@
+'use strict';
+const Schema = require('mongoose').Schema;
+const moment = require('moment');
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
+const { ObjectId } = require('mongoose').Types;
+const { Secret } = require('naf-framework-mongoose/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: Array }, // 资质
+  achieve: { type: Array }, // 成果
+  team: { type: Array }, // 团队
+  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('Kjzl_medium', schema, 'kjzl_medium');
+};

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

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

+ 32 - 0
app/model/kjzl/kjzl_order.js

@@ -0,0 +1,32 @@
+'use strict';
+const Schema = require('mongoose').Schema;
+const moment = require('moment');
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
+const { ObjectId } = require('mongoose').Types;
+// 科教之旅-订单表
+const kjzl_order = {
+  medium_id: { type: ObjectId }, // 机构id
+  openid: { type: ObjectId }, // 微信openid
+  project: { type: String }, // 服务项目
+  contact: { type: String }, // 联系人
+  phone: { type: String }, // 联系电话
+  email: { type: String }, // 邮件
+  server_time: { type: String }, // 服务时间
+  remark: { 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({ status: 1 });
+schema.index({ 'meta.createdAt': 1 });
+schema.plugin(metaPlugin);
+module.exports = app => {
+  const { mongoose } = app;
+  return mongoose.model('Kjzl_order', schema, 'kjzl_order');
+};

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

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

+ 4 - 2
app/model/reward.js

@@ -7,14 +7,15 @@ const { ObjectId } = require('mongoose').Types;
 const reward = {
   type: { type: String }, // 研发补贴/奖励兑换
   company: { type: String }, // 申领企业
-  apply_personal: { type: String }, // 申领人
+  apply_person: { type: String }, // 申领人
   phone: { type: String }, // 联系电话
   qyfr: { type: Array }, // 企业法人
   yyzz: { type: Array }, // 营业执照
   qylr: { type: Array }, // 企业利润
-  user_id: { type: Object }, // 申领人id
+  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 } });
@@ -23,6 +24,7 @@ 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 => {

+ 0 - 41
app/model/reward_order.js

@@ -1,41 +0,0 @@
-'use strict';
-const Schema = require('mongoose').Schema;
-const moment = require('moment');
-const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
-const { ObjectId } = require('mongoose').Types;
-// 研发补贴,奖励兑现订单表
-const reward_order = {
-  no: { type: String }, // 兑付申请号(自动生成)
-  type: { type: String }, // 类型
-  company_id: { type: ObjectId }, // 使用单位id
-  company_name: { type: String }, // 使用单位
-  create_time: { type: String }, // 提交时间,服务端生成
-  end_time: { type: String }, // 最后审核时间
-  money: { type: Number }, // 订单金额
-  allowance: { type: Number }, // 抵扣金额
-  total: { type: Number }, // 应收金额
-  status: { type: String, default: '0' }, // 0-待审核;1-通过;-1-拒绝
-  remark: { type: String },
-  // 需要上传的资料
-  contract: { type: Array }, // 上传合同
-  accept: { type: Array }, // 官方受理通知书
-  cost: { type: Array }, // 官方缴费证明
-  result: { type: Array }, // 服务结果证明
-  result_else: { type: Array }, // 其他能够证明服务真是发生的材料
-  record: { type: Array }, // 记录
-};
-const schema = new Schema(reward_order, { toJSON: { virtuals: true } });
-schema.index({ id: 1 });
-schema.index({ no: 1 });
-schema.index({ type: 1 });
-schema.index({ company_id: 1 });
-schema.index({ company_name: 1 });
-schema.index({ create_time: 1 });
-schema.index({ end_time: 1 });
-schema.index({ status: 1 });
-schema.index({ 'meta.createdAt': 1 });
-schema.plugin(metaPlugin);
-module.exports = app => {
-  const { mongoose } = app;
-  return mongoose.model('Reward_order', schema, 'reward_order');
-};

+ 7 - 2
app/router.js

@@ -8,6 +8,7 @@ module.exports = app => {
   router.get('/', controller.home.index);
   const profix = '/api/live/';
   const vision = 'v0';
+  router.get(`${profix}${vision}/wxlogin/:site`, controller.weixin.index);
   router.post(`${profix}${vision}/util`, controller.home.utilMethod);
   router.post(`${profix}${vision}/spm`, controller.home.spm);
   router.get(`${profix}${vision}/index`, controller.home.indexQuery);
@@ -45,8 +46,12 @@ module.exports = app => {
   require('./router/cysci/coupons')(app); // 创新券
   require('./router/cysci/coupons_apply')(app); // 创新券申请
   require('./router/cysci/declare')(app); // 高企申报
-  require('./router/cysci/declare_order')(app); // 高企申报订单
   require('./router/cysci/cashing')(app); // 高企申报兑付
   require('./router/cysci/reward')(app); // 研发补贴/奖励兑换申领
-  require('./router/cysci/reward_order')(app); // 研发补贴/奖励兑换订单
+  require('./router/kjzl/kjzl_mini_video')(app); // 科教之旅-微视频
+  require('./router/kjzl/kjzl_refute')(app); // 科教之旅-科学辟谣
+  require('./router/kjzl/kjzl_medium')(app); // 科教之旅-机构
+  require('./router/kjzl/kjzl_chat')(app); // 科教之旅-评价
+  require('./router/kjzl/kjzl_order')(app); // 科教之旅-订单表
+  require('./router/kjzl/kjzl_expert_view')(app); // 科教之旅-专家视点
 };

+ 1 - 0
app/router/cysci/cashing.js

@@ -7,6 +7,7 @@ module.exports = app => {
   const vision = 'v0';
   const index = 'cysci';
   const target = 'cashing';
+  router.get(target, `${profix}${vision}/${index}/${target}/from/:from_id`, controller[index][target].from);
   router.resources(target, `${profix}${vision}/${index}/${target}`, controller[index][target]); // index、create、show、destroy
   router.post(target, `${profix}${vision}/${index}/${target}/update/:id`, controller[index][target].update);
 };

+ 2 - 1
app/router/cysci/declare.js

@@ -7,6 +7,7 @@ module.exports = app => {
   const vision = 'v0';
   const index = 'cysci';
   const target = 'declare';
-  router.resources(target, `${profix}${vision}/${index}/${target}`, controller[index][target]); // index、create、show、destroy
+  const m = app.middleware.medium();
+  router.resources(target, `${profix}${vision}/${index}/${target}`, m, controller[index][target]); // index、create、show、destroy
   router.post(target, `${profix}${vision}/${index}/${target}/update/:id`, controller[index][target].update);
 };

+ 4 - 3
app/router/cysci/reward_order.js

@@ -5,8 +5,9 @@ module.exports = app => {
   const { router, controller } = app;
   const profix = '/api/live/';
   const vision = 'v0';
-  const index = 'cysci';
-  const target = 'rewardOrder';
-  router.resources(target, `${profix}${vision}/${index}/${target}`, controller[index][target]); // index、create、show、destroy
+  const index = 'kjzl';
+  const target = 'kjzlChat';
+  const ct = app.middleware.createTime();
+  router.resources(target, `${profix}${vision}/${index}/${target}`, ct, controller[index][target]); // index、create、show、destroy
   router.post(target, `${profix}${vision}/${index}/${target}/update/:id`, controller[index][target].update);
 };

+ 13 - 0
app/router/kjzl/kjzl_expert_view.js

@@ -0,0 +1,13 @@
+'use strict';
+
+
+module.exports = app => {
+  const { router, controller } = app;
+  const profix = '/api/live/';
+  const vision = 'v0';
+  const index = 'kjzl';
+  const target = 'kjzlExpertView';
+  const ct = app.middleware.createTime();
+  router.resources(target, `${profix}${vision}/${index}/${target}`, ct, controller[index][target]); // index、create、show、destroy
+  router.post(target, `${profix}${vision}/${index}/${target}/update/:id`, controller[index][target].update);
+};

+ 16 - 0
app/router/kjzl/kjzl_medium.js

@@ -0,0 +1,16 @@
+'use strict';
+
+
+module.exports = app => {
+  const { router, controller } = app;
+  const profix = '/api/live/';
+  const vision = 'v0';
+  const index = 'kjzl';
+  const target = 'kjzlMedium';
+  const ct = app.middleware.createTime();
+
+  router.post(target, `${profix}${vision}/${index}/${target}/login`, controller[index][target].login);
+  router.post(target, `${profix}${vision}/${index}/${target}/password/:id`, controller[index][target].password);
+  router.resources(target, `${profix}${vision}/${index}/${target}`, ct, controller[index][target]); // index、create、show、destroy
+  router.post(target, `${profix}${vision}/${index}/${target}/update/:id`, controller[index][target].update);
+};

+ 13 - 0
app/router/kjzl/kjzl_mini_video.js

@@ -0,0 +1,13 @@
+'use strict';
+
+
+module.exports = app => {
+  const { router, controller } = app;
+  const profix = '/api/live/';
+  const vision = 'v0';
+  const index = 'kjzl';
+  const target = 'kjzlMiniVideo';
+  const ct = app.middleware.createTime();
+  router.resources(target, `${profix}${vision}/${index}/${target}`, ct, controller[index][target]); // index、create、show、destroy
+  router.post(target, `${profix}${vision}/${index}/${target}/update/:id`, controller[index][target].update);
+};

+ 14 - 0
app/router/kjzl/kjzl_order.js

@@ -0,0 +1,14 @@
+'use strict';
+
+
+module.exports = app => {
+  const { router, controller } = app;
+  const profix = '/api/live/';
+  const vision = 'v0';
+  const index = 'kjzl';
+  const target = 'kjzlOrder';
+  const ct = app.middleware.createTime();
+
+  router.resources(target, `${profix}${vision}/${index}/${target}`, ct, controller[index][target]); // index、create、show、destroy
+  router.post(target, `${profix}${vision}/${index}/${target}/update/:id`, controller[index][target].update);
+};

+ 4 - 4
app/router/cysci/declare_order.js

@@ -5,9 +5,9 @@ module.exports = app => {
   const { router, controller } = app;
   const profix = '/api/live/';
   const vision = 'v0';
-  const index = 'cysci';
-  const target = 'declareOrder';
-  const doware = app.middleware.declareOrder();
-  router.resources(target, `${profix}${vision}/${index}/${target}`, doware, controller[index][target]); // index、create、show、destroy
+  const index = 'kjzl';
+  const target = 'kjzlRefute';
+  const ct = app.middleware.createTime();
+  router.resources(target, `${profix}${vision}/${index}/${target}`, ct, controller[index][target]); // index、create、show、destroy
   router.post(target, `${profix}${vision}/${index}/${target}/update/:id`, controller[index][target].update);
 };

+ 16 - 4
app/service/cysci/cashing.js

@@ -11,12 +11,24 @@ class CashingService extends CrudService {
     super(ctx, 'cashing');
     this.model = this.ctx.model.Cashing;
   }
-  async create(body) {
-    const cashing_no = `${moment().format('YYYYMMDD')}${moment().format('x')}DF`;
-    const create_time = moment().format('YYYY-MM-DD HH:mm:ss');
-    body = { ...body, cashing_no, create_time };
+  async create({ declare_id, reward_id, ...body }) {
+    // 将高企/ 研发/奖励 的 is_cashing改成1
+    if (declare_id) await this.ctx.model.Declare.updateOne({ _id: declare_id }, { is_cashing: '1' });
+    if (reward_id) await this.ctx.model.Reward.updateOne({ _id: reward_id }, { is_cashing: '1' });
+    // 之后将使用的券改为使用 is_use = 1
+    const { user_id, coupons_id } = body;
+    await this.ctx.model.CouponsApply.updateOne({ user_id, coupons_id }, { is_use: '1' });
+    // const no = `${moment().format('YYYYMMDD')}${moment().format('x')}DF`;
+    // body = { ...body, no };
+    if (declare_id)body.from_id = declare_id;
+    else if (reward_id)body.from_id = reward_id;
     return await this.model.create(body);
   }
+
+  async getFromId({ from_id }) {
+    const data = await this.model.findOne({ from_id });
+    return data;
+  }
 }
 
 module.exports = CashingService;

+ 9 - 0
app/service/cysci/coupons_apply.js

@@ -3,6 +3,7 @@ const { CrudService } = require('naf-framework-mongoose/lib/service');
 const { BusinessError, ErrorCode } = require('naf-core').Error;
 const _ = require('lodash');
 const assert = require('assert');
+const { ObjectId } = require('mongoose').Types;
 
 // 创新券申领表
 class Coupons_applyService extends CrudService {
@@ -10,6 +11,14 @@ class Coupons_applyService extends CrudService {
     super(ctx, 'coupons_apply');
     this.model = this.ctx.model.CouponsApply;
   }
+  async create(body) {
+    const { user_id, coupons_id } = body;
+    console.log(user_id, coupons_id);
+    const count = await this.model.count({ user_id: ObjectId(user_id), coupons_id: ObjectId(coupons_id) });
+    console.log(count);
+    if (count) throw new BusinessError(ErrorCode.DATA_EXISTED, '已领取该券');
+    return await this.model.create(body);
+  }
 }
 
 module.exports = Coupons_applyService;

+ 12 - 21
app/service/cysci/declare.js

@@ -16,7 +16,7 @@ class DeclareService extends CrudService {
   async query({ skip = 0, limit = 0, ...query } = {}) {
     const nquery = _.omit(query, [ 'name' ]);
     if (nquery.user_id) nquery.user_id = ObjectId(nquery.user_id);
-    if (nquery.mechanism_id) nquery.mechanism_id = ObjectId(nquery.mechanism_id);
+    if (nquery.medium_id) nquery.medium_id = ObjectId(nquery.medium_id);
     const arr = [
       { $match: nquery },
       {
@@ -24,12 +24,12 @@ class DeclareService extends CrudService {
           from: 'organization',
           localField: 'user_id',
           foreignField: '_id',
-          as: 'company',
+          as: 'companyInfo',
         },
       },
-      { $unwind: '$company' },
-      { $addFields: { name: '$company.name' } },
-      { $project: { _id: 1, name: 1, meta: 1, status: 1 } },
+      { $unwind: '$companyInfo' },
+      { $addFields: { company: '$companyInfo.name' } },
+      { $project: { companyInfo: 0 } },
     ];
     if (_.get(query, 'name')) {
       arr.push({ $match: { name: new RegExp(_.get(query, 'name')) } });
@@ -54,22 +54,13 @@ class DeclareService extends CrudService {
     return res;
   }
 
-  async update({ id }, body) {
-    const data = await this.model.findById(id);
-    if (!data) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到数据');
-    const keys = [ 'user_id', 'name', 'mechanism_id' ];
-    const toUpdate = _.omit(body, keys);
-    await this.model.updateOne({ _id: id }, toUpdate);
-    const { status } = body;
-    if (status === '2') {
-      const order = _.pick(body, keys);
-      const stemp = `${moment().format('YYYYMMDD')}${moment().format('x')}`;
-      order.no = stemp;
-      const time = moment().format('YYYY-MM-DD HH:mm:ss');
-      order.time = time;
-      await this.ctx.model.DeclareOrder.create(order);
-    }
-  }
+  // async update({ id }, body) {
+  //   const data = await this.model.findById(id);
+  //   if (!data) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到数据');
+  //   const keys = [ 'user_id', 'name', 'medium_id' ];
+  //   const toUpdate = _.omit(body, keys);
+  //   await this.model.updateOne({ _id: id }, toUpdate);
+  // }
 }
 
 module.exports = DeclareService;

+ 0 - 23
app/service/cysci/reward_order.js

@@ -1,23 +0,0 @@
-'use strict';
-const { CrudService } = require('naf-framework-mongoose/lib/service');
-const { BusinessError, ErrorCode } = require('naf-core').Error;
-const _ = require('lodash');
-const assert = require('assert');
-const moment = require('moment');
-
-// 研发补贴,奖励兑换订单
-class Reward_orderService extends CrudService {
-  constructor(ctx) {
-    super(ctx, 'reward_order');
-    this.model = this.ctx.model.RewardOrder;
-  }
-
-  async create(body) {
-    const no = `${moment().format('YYYYMMDD')}${moment().format('x')}DF`;
-    const create_time = moment().format('YYYY-MM-DD HH:mm:ss');
-    body = { ...body, no, create_time };
-    return await this.model.create(body);
-  }
-}
-
-module.exports = Reward_orderService;

+ 15 - 0
app/service/kjzl/kjzl_chat.js

@@ -0,0 +1,15 @@
+'use strict';
+const { CrudService } = require('naf-framework-mongoose/lib/service');
+const { BusinessError, ErrorCode } = require('naf-core').Error;
+const _ = require('lodash');
+const assert = require('assert');
+
+// 科教之旅-评价表
+class Kjzl_chatService extends CrudService {
+  constructor(ctx) {
+    super(ctx, 'kjzl_chat');
+    this.model = this.ctx.model.Kjzl.KjzlChat;
+  }
+}
+
+module.exports = Kjzl_chatService;

+ 15 - 0
app/service/kjzl/kjzl_expert_view.js

@@ -0,0 +1,15 @@
+'use strict';
+const { CrudService } = require('naf-framework-mongoose/lib/service');
+const { BusinessError, ErrorCode } = require('naf-core').Error;
+const _ = require('lodash');
+const assert = require('assert');
+
+// 科教之旅-专家视点
+class Kjzl_expert_viewService extends CrudService {
+  constructor(ctx) {
+    super(ctx, 'kjzl_expert_view');
+    this.model = this.ctx.model.Kjzl.KjzlExpertView;
+  }
+}
+
+module.exports = Kjzl_expert_viewService;

+ 51 - 0
app/service/kjzl/kjzl_medium.js

@@ -0,0 +1,51 @@
+'use strict';
+const { CrudService } = require('naf-framework-mongoose/lib/service');
+const { BusinessError, ErrorCode } = require('naf-core').Error;
+const _ = require('lodash');
+const assert = require('assert');
+const jwt = require('jsonwebtoken');
+
+// 科教之旅机构表
+class Kjzl_mediumService extends CrudService {
+  constructor(ctx) {
+    super(ctx, 'kjzl_medium');
+    this.model = this.ctx.model.Kjzl.KjzlMedium;
+  }
+  /**
+   * 创建用户
+   * @param {Object} params 用户信息
+   */
+  async create({ password, ...data }) {
+    data.password = { secret: password };
+    return await this.model.create(data);
+  }
+  /**
+   * 修改密码
+   * @param {Object} {id,password} 用户id和密码
+   */
+  async password({ id, password }) {
+    const object = await this.model.findById(id);
+    if (!object) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到用户的信息');
+    object.password = { secret: password };
+    await object.save();
+  }
+  /**
+   * 登陆
+   * @param {Object} params 登陆信息
+   * @property phone 手机号
+   * @property password 密码
+   */
+  async login({ phone, password }) {
+    const object = await this.model.findOne({ phone }, '+password');
+    if (!object) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到用户的信息');
+    const { password: op } = object;
+    const { secret } = op;
+    if (secret !== password) throw new BusinessError(ErrorCode.BAD_PASSWORD, '密码错误');
+    const data = _.omit(JSON.parse(JSON.stringify(object)), [ 'meta', 'password', '__v' ]);
+    const { secret: secrets } = this.config.jwt;
+    const token = jwt.sign(data, secrets);
+    return token;
+  }
+}
+
+module.exports = Kjzl_mediumService;

+ 15 - 0
app/service/kjzl/kjzl_mini_video.js

@@ -0,0 +1,15 @@
+'use strict';
+const { CrudService } = require('naf-framework-mongoose/lib/service');
+const { BusinessError, ErrorCode } = require('naf-core').Error;
+const _ = require('lodash');
+const assert = require('assert');
+
+// 科教微视频
+class Kjzl_mini_videoService extends CrudService {
+  constructor(ctx) {
+    super(ctx, 'kjzl_mini_video');
+    this.model = this.ctx.model.Kjzl.KjzlMiniVideo;
+  }
+}
+
+module.exports = Kjzl_mini_videoService;

+ 15 - 0
app/service/kjzl/kjzl_order.js

@@ -0,0 +1,15 @@
+'use strict';
+const { CrudService } = require('naf-framework-mongoose/lib/service');
+const { BusinessError, ErrorCode } = require('naf-core').Error;
+const _ = require('lodash');
+const assert = require('assert');
+
+// 科教之旅订单
+class Kjzl_orderService extends CrudService {
+  constructor(ctx) {
+    super(ctx, 'kjzl_order');
+    this.model = this.ctx.model.Kjzl.Kjzl_order;
+  }
+}
+
+module.exports = Kjzl_orderService;

+ 5 - 5
app/service/cysci/declare_order.js

@@ -4,12 +4,12 @@ const { BusinessError, ErrorCode } = require('naf-core').Error;
 const _ = require('lodash');
 const assert = require('assert');
 
-// 高企申报订单
-class Declare_orderService extends CrudService {
+// 科学辟谣
+class Kjzl_refuteService extends CrudService {
   constructor(ctx) {
-    super(ctx, 'declare_order');
-    this.model = this.ctx.model.DeclareOrder;
+    super(ctx, 'kjzl_refute');
+    this.model = this.ctx.model.Kjzl.KjzlRefute;
   }
 }
 
-module.exports = Declare_orderService;
+module.exports = Kjzl_refuteService;

+ 226 - 0
app/service/weixin.js

@@ -0,0 +1,226 @@
+'use strict';
+
+const assert = require('assert');
+const uuid = require('uuid');
+const random = require('string-random');
+const crypto = require('crypto');
+const urljoin = require('url-join');
+const _ = require('lodash');
+const moment = require('moment');
+const { BusinessError, ErrorCode } = require('naf-core').Error;
+const jwt = require('jsonwebtoken');
+const { AxiosService } = require('naf-framework-mongoose/lib/service');
+
+class WeixinAuthService extends AxiosService {
+  constructor(ctx, options) {
+    super(ctx, {}, _.get(ctx.app.config, 'wxapi', {}));
+    this.prefix = 'auth:';
+    this.jsapiKey = 'jsapi_ticket';
+    this.access_tokenKey = 'access_token';
+    this.wxInfo = ctx.app.config.wxapi;
+    this.authBackUrl = `${ctx.app.config.baseUrl}/api/article/authBack`;
+  }
+  /**
+   * 网页授权
+   * @param {String} site 公众号标识,对config中设置
+   * @param {Object} query 参数
+   */
+  async auth({ site }, query) {
+    const { redirect_uri, ...others } = query;
+    const { baseUrl } = this.wxInfo;
+    const { appid } = this.wxInfo[site];
+    if (!appid) {
+      throw new BusinessError(ErrorCode.SERVICE_FAULT, '缺少公众号设置');
+    }
+    // 用于redis
+    const state = uuid.v4();
+    const key = `${this.prefix}${state}`;
+    const val = JSON.stringify({ ...others, redirect_uri, site });
+    await this.app.redis.set(key, val, 'EX', 600);
+    // const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${this.authBackUrl}&response_type=code&scope=snsapi_userinfo&state=${state}#wechat_redirect`;
+    let backUrl;
+    if (this.authBackUrl.startsWith('http')) {
+      backUrl = encodeURI(`${this.authBackUrl}?state=${state}`);
+    } else {
+      backUrl = encodeURI(`${this.ctx.protocol}://${this.ctx.host}${this.authBackUrl}?state=${state}`);
+    }
+    const to_uri = `${baseUrl}/api/auth?appid=${appid}&response_type=code&redirect_uri=${backUrl}#wechat`;
+    this.ctx.redirect(to_uri);
+  }
+
+  /**
+   * 网页授权回调,获取openid
+   * @param {Object} query 参数
+   */
+  async authBack(query) {
+    const { code, state } = query;
+    if (!code) throw new BusinessError(ErrorCode.SERVICE_FAULT, '授权未成功');
+    const req = await this.httpGet('/api/fetch', { code });
+    if (req.errcode && req.errcode !== 0) throw new BusinessError(ErrorCode.SERVICE_FAULT, 'openid获取失败');
+    const openid = _.get(req, 'openid');
+    if (!openid) {
+      this.ctx.logger.error(JSON.stringify(req.data));
+      throw new BusinessError(ErrorCode.SERVICE_FAULT, '未获取到openid');
+    }
+    // 验证获取openid结束,接下来应该返回前端
+    const key = `${this.prefix}${state}`;
+    let fqueries = await this.app.redis.get(key);
+    if (fqueries)fqueries = JSON.parse(fqueries);
+    let { redirect_uri } = fqueries;
+    const queryStr = `?openid=${openid}`;
+    redirect_uri = urljoin(redirect_uri, queryStr);
+    this.ctx.redirect(redirect_uri);
+  }
+  /**
+   * 换微信用户信息
+   * @param {String} site 公众号标识,对config中设置
+   * @param {Object} {openid}
+   */
+  async wxUser({ site }, { openid }) {
+    const { appid } = this.wxInfo[site];
+    const res = await this.httpGet('/api.weixin.qq.com/cgi-bin/user/info?lang=zh_CN', { appid, openid });
+    const object = _.pick(res, [ 'nickname', 'headimgurl', 'openid' ]); // 昵称,头像,openid
+    return { name: object.nickname, icon: object.headimgurl, openid };
+  }
+  /**
+   * JsApi验证
+   * @param {String} site 公众号标识,对config中设置
+   * @param {Object} query 参数
+   */
+  async jsapiAuth({ site }, query) {
+    let { url } = query;
+    url = decodeURIComponent(url);
+    let jsapi_ticket = await this.app.redis.get(this.jsapiKey);
+    const { appid, appSecret } = this.wxInfo[site];
+    if (!jsapi_ticket) {
+      // 1,获取access_token
+      const atUrl = `https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=${appid}&secret=${appSecret}`;
+      const req = await this.ctx.curl(atUrl, { method: 'GET', dataType: 'json' });
+      if (req.status !== 200) throw new BusinessError(ErrorCode.SERVICE_FAULT, 'access_token获取失败');
+      const access_token = _.get(req, 'data.access_token');
+      // 2,获取jsapi_token
+      const jtUrl = `https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=${access_token}&type=jsapi`;
+      const jtReq = await this.ctx.curl(jtUrl, { method: 'GET', dataType: 'json' });
+      if (jtReq.status !== 200) throw new BusinessError(ErrorCode.SERVICE_FAULT, 'jsapi_ticket获取失败');
+      jsapi_ticket = _.get(jtReq, 'data.ticket');
+      // 实际过期时间是7200s(2h),系统默认设置6000s
+      const expiresIn = _.get(jtReq, 'data.expires_in', 6000);
+      // 缓存jsapi_ticket,重复使用
+      await this.app.redis.set(this.jsapiKey, jsapi_ticket, 'EX', expiresIn);
+    }
+    const noncestr = random(16).toLowerCase();
+    const timestamp = moment().unix();
+    const signStr = `jsapi_ticket=${jsapi_ticket}&noncestr=${noncestr}&timestamp=${timestamp}&url=${url}`;
+    const sign = crypto.createHash('sha1').update(signStr).digest('hex');
+    return { jsapi_ticket, noncestr, timestamp, sign, appid, url };
+  }
+
+
+  async createJwt({ openid, nickname, subscribe }) {
+    const { secret, expiresIn = '1d', issuer = 'weixin' } = this.config.jwt;
+    const subject = openid;
+    const userinfo = { nickname, subscribe };
+    const token = await jwt.sign(userinfo, secret, { expiresIn, issuer, subject });
+    return token;
+  }
+  /**
+   * 创建二维码
+   * 随机生成二维码,并保存在Redis中,状态初始为pending
+   * 状态描述:
+   * pending - 等待扫码
+   * consumed - 使用二维码登录完成
+   * scand:token - Jwt登录凭证
+   */
+  async createQrcode() {
+    const qrcode = uuid();
+    const key = `visit:qrcode:group:${qrcode}`;
+    await this.app.redis.set(key, 'pending', 'EX', 600);
+    return qrcode;
+  }
+
+  /**
+   * 创建二维码
+   * 生成群二维码
+   * 状态描述:
+   * pending - 等待扫码
+   * consumed - 使用二维码登录完成
+   * scand:token - Jwt登录凭证
+   */
+  async createQrcodeGroup({ groupid }) {
+    const { authUrl = this.ctx.path } = this.app.config;
+    let backUrl;
+    if (authUrl.startsWith('http')) {
+      backUrl = encodeURI(`${authUrl}?state=${groupid}`);
+    } else {
+      backUrl = encodeURI(`${this.ctx.protocol}://${this.ctx.host}${authUrl}?state=${groupid}`);
+    }
+    console.log(backUrl);
+    return backUrl;
+  }
+
+  /**
+   * 扫码登录确认
+   */
+  async scanQrcode({ qrcode, token }) {
+    assert(qrcode, 'qrcode不能为空');
+    assert(token, 'token不能为空');
+    const key = `smart:qrcode:login:${qrcode}`;
+    const status = await this.app.redis.get(key);
+    if (!status) {
+      throw new BusinessError(ErrorCode.SERVICE_FAULT, '二维码已过期');
+    }
+    if (status !== 'pending') {
+      throw new BusinessError(ErrorCode.SERVICE_FAULT, '二维码状态无效');
+    }
+
+    // 验证Token
+    const { secret } = this.config.jwt;
+    const decoded = jwt.verify(token, secret, { issuer: 'weixin' });
+    this.ctx.logger.debug(`[weixin] qrcode login - ${decoded}`);
+
+    // TODO: 修改二维码状态,登录凭证保存到redis
+    await this.app.redis.set(key, `scaned:${token}`, 'EX', 600);
+
+    // TODO: 发布扫码成功消息
+    const { mq } = this.ctx;
+    const ex = 'qrcode.login';
+    if (mq) {
+      await mq.topic(ex, qrcode, 'scaned', { durable: true });
+    } else {
+      this.ctx.logger.error('!!!!!!没有配置MQ插件!!!!!!');
+    }
+  }
+
+  // 使用二维码换取登录凭证
+  async qrcodeLogin(qrcode) {
+    assert(qrcode, 'qrcode不能为空');
+    const key = `smart:qrcode:login:${qrcode}`;
+    const val = await this.app.redis.get(key);
+    if (!val) {
+      throw new BusinessError(ErrorCode.SERVICE_FAULT, '二维码已过期');
+    }
+    const [ status, token ] = val.split(':', 2);
+    if (status !== 'scaned' || !token) {
+      throw new BusinessError(ErrorCode.SERVICE_FAULT, '二维码状态无效');
+    }
+
+    // TODO: 修改二维码状态
+    await this.app.redis.set(key, 'consumed', 'EX', 600);
+
+    return { token };
+  }
+
+  // 检查二维码状态
+  async checkQrcode(qrcode) {
+    assert(qrcode, 'qrcode不能为空');
+    const key = `smart:qrcode:login:${qrcode}`;
+    const val = await this.app.redis.get(key);
+    if (!val) {
+      throw new BusinessError(ErrorCode.SERVICE_FAULT, '二维码已过期');
+    }
+    const [ status ] = val.split(':', 2);
+    return { status };
+  }
+}
+
+module.exports = WeixinAuthService;

+ 12 - 0
config/config.default.js

@@ -79,6 +79,18 @@ module.exports = appInfo => {
     mission: 'http://127.0.0.1:4001',
     hnhmain: 'http://127.0.0.1:9201',
   };
+
+  // 服务器发布路径
+  config.baseUrl = 'http://broadcast.waityou24.cn';
+  config.wxapi = {
+    appid: 'wxdf3ed83c095be97a', // 微信公众号APPID
+    appSecret: 'd85dbe075c090cb12ce416bbda8e698c',
+    baseUrl: 'http://wx.cc-lotus.info', // 微信网关地址
+    kjzl: {
+      appid: '',
+      appSecret: '',
+    },
+  };
   return {
     ...config,
     ...userConfig,

+ 3 - 1
package.json

@@ -14,7 +14,9 @@
     "exceljs": "^4.2.0",
     "lodash": "^4.17.15",
     "moment": "^2.24.0",
-    "naf-framework-mongoose": "^0.6.11"
+    "naf-framework-mongoose": "^0.6.11",
+    "string-random": "^0.1.3",
+    "url-join": "^4.0.1"
   },
   "devDependencies": {
     "autod": "^3.0.1",