'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('/', controller.home.util); require('./z_router/user')(app); // 比赛模块用户 require('./z_router/match')(app); // 比赛信息 require('./z_router/matchGroup')(app); // 比赛组别 require('./z_router/matchProject')(app); // 组别项目 require('./z_router/teamApply')(app); // 组队申请 require('./z_router/matchSign')(app); // 赛事报名 require('./z_router/bill')(app); // 账单 require('./z_router/payOrder')(app); // 支付订单 require('./z_router/matchTeamGroup')(app); // 小组赛设置 require('./z_router/matchAddress')(app); // 场地设置 require('./z_router/matchSmallGroupSchedule')(app); // 小组赛赛程 require('./z_router/eliminate')(app); // 淘汰赛赛程 };