router.js 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. 'use strict';
  2. /**
  3. * @param {Egg.Application} app - egg application
  4. */
  5. const os = require('os');
  6. function getIPAdress() {
  7. const interfaces = os.networkInterfaces();
  8. for (const devName in interfaces) {
  9. const iface = interfaces[devName];
  10. for (let i = 0; i < iface.length; i++) {
  11. const alias = iface[i];
  12. if (alias.family === 'IPv4' && alias.address !== '127.0.0.1' && !alias.internal) {
  13. return alias.address;
  14. }
  15. }
  16. }
  17. }
  18. module.exports = app => {
  19. const { router, controller } = app;
  20. const { routePrefix, cluster } = app.config;
  21. const ipAddress = getIPAdress();
  22. console.log(`前缀:http://${ipAddress}:${cluster.listen.port}${routePrefix}`);
  23. router.get(`${routePrefix}`, controller.home.index);
  24. router.get(`${routePrefix}/util/getConfig`, controller.util.getConfig);
  25. // user
  26. console.log('user');
  27. require('./z_router/user/admin')(app); // 管理员
  28. require('./z_router/user/expert')(app); // 专家
  29. require('./z_router/user/inviteCode')(app); // 邀请码
  30. require('./z_router/user/mechanism')(app); // 机构
  31. require('./z_router/user/organization')(app); // 机构(o)
  32. require('./z_router/user/personal')(app); // 个人账号
  33. require('./z_router/user/personChat')(app); // 聊天消息
  34. require('./z_router/user/personRoom')(app); // 聊天室
  35. // channel
  36. console.log('channel');
  37. require('./z_router/channel/channel')(app); // 科技频道
  38. require('./z_router/channel/channelVideo')(app); // 科技频道视频
  39. // consultation
  40. console.log('consultation');
  41. require('./z_router/consultation/trainLive')(app); // 培训问诊
  42. require('./z_router/consultation/trainChat')(app); // 培训问诊聊天
  43. require('./z_router/consultation/trainVideo')(app); // 培训问诊视频表
  44. require('./z_router/consultation/trainUser')(app); // 培训问诊用户
  45. // cysci
  46. console.log('cysci');
  47. require('./z_router/cysci/cashing')(app); // 高企申报兑换
  48. require('./z_router/cysci/coupons')(app); // 创新券
  49. require('./z_router/cysci/couponsApply')(app); // 创新券申领
  50. require('./z_router/cysci/declare')(app); // 高企申报
  51. require('./z_router/cysci/reward')(app); // 研发补贴,奖励兑换申领
  52. // dock
  53. console.log('dock');
  54. require('./z_router/dock/dock')(app); // 展会
  55. require('./z_router/dock/dockChat')(app); // 展会公共聊天
  56. require('./z_router/dock/dockImgtxt')(app); // 展会图文
  57. require('./z_router/dock/dockTranscation')(app); // 展会合同备份
  58. require('./z_router/dock/dockUser')(app); // 展会用户
  59. require('./z_router/dock/dockVideo')(app); // 展会视频
  60. // kjzl
  61. console.log('kjzl');
  62. require('./z_router/kjzl/kjzlMedium')(app); // 科教之旅-机构
  63. require('./z_router/kjzl/kjzlOrder')(app); // 科教之旅-订单
  64. // news
  65. console.log('news');
  66. require('./z_router/news/column')(app); // 栏目
  67. require('./z_router/news/interview')(app); // 嘉宾访谈
  68. require('./z_router/news/news')(app); // 信息
  69. require('./z_router/news/notice')(app); // 通知管理
  70. require('./z_router/news/product')(app); // 产品
  71. require('./z_router/news/projectSolic')(app); // 项目征集
  72. require('./z_router/news/question')(app); // 调研考察
  73. require('./z_router/news/roadShow')(app); // 项目路演
  74. require('./z_router/news/science')(app); // 科技新闻
  75. require('./z_router/news/survey')(app); // 建言献策,网上调查
  76. require('./z_router/news/universal')(app); // 科学普及
  77. require('./z_router/news/viewPoint')(app); // 智库视点
  78. // system
  79. console.log('system');
  80. require('./z_router/system/category')(app); // 字典分类
  81. require('./z_router/system/code')(app); // 字典
  82. require('./z_router/system/menu')(app); // 菜单
  83. require('./z_router/system/role')(app); // 角色
  84. // statistics
  85. console.log('statistics');
  86. require('./z_router/statistics/index')(app); // 统计
  87. // patent
  88. };