1234567891011121314151617181920212223242526272829303132333435363738 |
- 'use strict';
- /**
- * @param {Egg.Application} app - egg application
- */
- const os = require('os');
- function getIPAdress() {
- const interfaces = os.networkInterfaces();
- for (const devName in interfaces) {
- const iface = interfaces[devName];
- for (let i = 0; i < iface.length; i++) {
- const alias = iface[i];
- if (alias.family === 'IPv4' && alias.address !== '127.0.0.1' && !alias.internal) {
- return alias.address;
- }
- }
- }
- }
- module.exports = app => {
- const { router, controller } = app;
- const { routePrefix, cluster } = app.config;
- const ipAddress = getIPAdress();
- console.log(`前缀:http://${ipAddress}:${cluster.listen.port}${routePrefix}`);
- router.get('/', controller.home.index);
- router.post('/courtAdmin/api/admin/login', controller.home.login);
- router.get('/courtAdmin/api/useradmin', controller.admin.index);
- require('./z_router/menu')(app); // 菜单
- require('./z_router/user')(app); // 用户
- require('./z_router/team')(app); // 团队
- require('./z_router/joinapply')(app); // 加入团队
- require('./z_router/dismissapply')(app); // 解散团队
- require('./z_router/match')(app); // 比赛管理
- require('./z_router/matchteam')(app); // 参赛团队
- require('./z_router/schedule')(app); // 赛程信息
- require('./z_router/notice')(app); // 通知通告
- require('./z_router/statistics')(app); // 统计
- };
|