WMS_MAIN/app/router.js

78 lines
2.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @param {Egg.Application} app - egg application
*/
module.exports = app => {
const { router, controller } = app;
router.get('/', controller.home.index);
router.get('/auth/platformOauthCallback', controller.home.platformOauthCallback);
router.get('/auth/platformOauthBind', controller.home.platformOauthBind);
router.get('/query/pddCode/:code', controller.home.queryPddCode);
// 微信开放平台第三方平台授权事件接收(GET=URL验证,POST=事件推送)
router.get('/Authorization', controller.wechatOpen.authorization);
router.post('/Authorization', controller.wechatOpen.authorization);
// 内部网关接口
router.post('/internal/v1/gateway', controller.gateway.internal);
// 奇门接口
router.post('/qimen', controller.home.qimen);
// 系统接口 PDA/WEB 统一入口
router.post('/system', controller.home.system);
// 仅开发环境可访问的内部api文档
if (app.config.env === 'local') {
// api文档相关
router.get('/api/docs', controller.docs.list);
router.get('/api/docs/:docName/raw', controller.docs.raw);
router.get('/api/docs/:docName/changes', controller.docs.changes);
router.get('/api/docs/:docName', controller.docs.detail);
// 独立 docs 目录挂载 — 首页
router.get('/docs', controller.docs.docsIndex);
}
// OpenAPI 文档 — 所有环境均可访问,必须在通配路由之前注册
router.get('/docs/api/openapi', controller.docs.openapi);
// Warehouse 开放 API 文档 — 所有环境均可访问
router.get('/docs/api/warehouse', controller.docs.warehouse);
// OpenAPI 回调测试 — 所有环境均可访问的独立调试页面
router.get('/docs/api/openapi/callback-test', controller.openapiCallback.testPage);
// OpenAPI 出站回调文档 — 所有环境均可访问
router.get('/docs/api/openapi_callback', controller.docs.openapiCallbackEvents);
// 仅开发环境可访问的 docs 通配路由(静态文件),必须在 /docs/api/openapi 之后注册
if (app.config.env === 'local') {
router.get('/docs/:relPath(.*)', controller.docs.docsFile);
}
// OpenAPI 入口
router.post('/openapi', controller.openapi.index);
// 仓库 OpenAPI 入口
router.post('/warehouse', controller.warehouse.index);
// 打印模板
router.get('/template/xml/:id', controller.template.xml);
// 打印自定义区模板(抖音面单等)
router.get('/mb/douyin1.xml', controller.template.douyinCustomArea);
// 打印台设置
router.get('/auth/printSetting/:code', controller.auth.printerSetting);
router.post('/auth/printSetting/', controller.auth.printerSetting);
// 临时 fileWriter 消费入口
router.get('/__temp/file-writer/consume', controller.tempFileWriter.consume);
// 测试接口
router.get('/testSendData', controller.home.testSendData);
// IM交互入口
router.post('/im', controller.im.index);
};