123456789101112131415161718192021222324252627282930313233343536373839404142 |
- 'use strict';
- // 路由配置
- const rkey = 'statistics/index';
- const ckey = 'statistics.index';
- const keyZh = '统计';
- const routes = [
- { method: 'get', path: `${rkey}/dockProduct`, controller: `${ckey}.dockProduct`, name: `${ckey}dockProduct`, zh: `${keyZh}-展会产品统计` },
- { method: 'get', path: `${rkey}/dockIndex`, controller: `${ckey}.dockIndex`, name: `${ckey}dockIndex`, zh: `${keyZh}-不知道` },
- { method: 'get', path: `${rkey}/index`, controller: `${ckey}.index`, name: `${ckey}Index`, zh: `${keyZh}-展会首页统计` },
- { method: 'get', path: `${rkey}/patent`, controller: `${ckey}.patent`, name: `${ckey}patent`, zh: `${keyZh}-首页专利统计` },
- { method: 'get', path: `${rkey}/product`, controller: `${ckey}.product`, name: `${ckey}product`, zh: `${keyZh}-首页成果统计` },
- { method: 'get', path: `${rkey}/expert`, controller: `${ckey}.expert`, name: `${ckey}expert`, zh: `${keyZh}-首页专家统计` },
- { method: 'get', path: `${rkey}/circle`, controller: `${ckey}.circle`, name: `${ckey}circle`, zh: `${keyZh}-首页数据统计` },
- { method: 'get', path: `${rkey}/orgCount`, controller: `${ckey}.orgCount`, name: `${ckey}orgCount`, zh: `${keyZh}-企业数量统计` },
- { method: 'get', path: `${rkey}/pac`, controller: `${ckey}.policyApplyCount`, name: `${ckey}policyApplyCount`, zh: `${keyZh}-创新券申请统计` },
- { method: 'get', path: `${rkey}/declare`, controller: `${ckey}.declare`, name: `${ckey}declare`, zh: `${keyZh}-高企申报个步骤统计` },
- { method: 'get', path: `${rkey}/patentUserIndex`, controller: `${ckey}.patentUserIndex`, name: `${ckey}patentUserIndex`, zh: `${keyZh}-专利运营用户首页统计` },
- {
- method: 'get',
- path: `${rkey}/patentInfoByApplyPerson`,
- controller: `${ckey}.patentInfoByApplyPerson`,
- name: `${ckey}patentInfoByApplyPerson`,
- zh: `${keyZh}-根据申请人统计,申请人所在的专利信息数量`,
- },
- ];
- module.exports = app => {
- const { router, config } = app;
- const mwares = app.middleware;
- console.log(`${keyZh}: ${rkey}`);
- for (const route of routes) {
- const { method, path, controller: ctl, zh } = route;
- let { middleware = [] } = route;
- if (!method || !path || !ctl) continue;
- // 拼全路径
- const allPath = `${config.routePrefix}/${path}`;
- // 处理中间件
- if (middleware.length > 0) middleware = middleware.map(i => mwares[i]({ enable: true }));
- // 注册路由
- router[method](zh, allPath, ...middleware, ctl);
- }
- };
|