'use strict'; const vehicle = require('../../controllers/data/vehicle'); const road = require('../../controllers/data/road'); const bridge = require('../../controllers/data/bridge'); const project = require('../../controllers/data/project'); const overspeed = require('../../controllers/data/overspeed'); const bus = require('../../controllers/data/bus'); const publicity = require('../../controllers/data/publicity'); const dataIndex = require('../../controllers/data/index'); module.exports = function (app, router, opts) { // 数据导出 app.fs.api.logAttr['GET/data/export'] = { content: '导出数据', visible: true }; router.get('/data/export', dataIndex.dataExport); // god 交通 app.fs.api.logAttr['GET/data/god_trans'] = { content: '获取高德交通数据', visible: true }; router.get('/data/god_trans', dataIndex.godTrans); // 运政 //货运 async function setFreightType (ctx, next) { ctx.request.body = { ...(ctx.request.body || {}), type: 'freight' } await next() } app.fs.api.logAttr['GET/vehicle/freight'] = { content: '获取运政列表', visible: true }; router.get('/vehicle/freight', setFreightType, vehicle.get); app.fs.api.logAttr['PUT/vehicle/freight'] = { content: '编辑运政数据', visible: true }; router.put('/vehicle/freight', setFreightType, vehicle.edit); app.fs.api.logAttr['DEL/vehicle/freight/:id'] = { content: '删除运政数据', visible: false }; router.del('/vehicle/freight/:id', setFreightType, vehicle.del); //客运车 async function setVehicleType (ctx, next) { ctx.request.body = { ...(ctx.request.body || {}), type: 'vehicle' } await next() } app.fs.api.logAttr['GET/vehicle'] = { content: '获取运政列表', visible: true }; router.get('/vehicle', setVehicleType, vehicle.get); app.fs.api.logAttr['PUT/vehicle'] = { content: '编辑运政数据', visible: true }; router.put('/vehicle', setVehicleType, vehicle.edit); app.fs.api.logAttr['DEL/vehicle/:id'] = { content: '删除运政数据', visible: false }; router.del('/vehicle/:id', setVehicleType, vehicle.del); // 路政 async function setRoadManageType (ctx, next) { ctx.request.body = { ...(ctx.request.body || {}), type: 'road_manage' } await next() } app.fs.api.logAttr['GET/road_manage'] = { content: '获取路政列表', visible: true }; router.get('/road_manage', setRoadManageType, vehicle.get); app.fs.api.logAttr['PUT/road_manage'] = { content: '编辑路政数据', visible: true }; router.put('/road_manage', setRoadManageType, vehicle.edit); app.fs.api.logAttr['DEL/road_manage/:id'] = { content: '删除路政数据', visible: false }; router.del('/road_manage/:id', setRoadManageType, vehicle.del); // 出租/危货 app.fs.api.logAttr['GET/vehicle/specific'] = { content: '获取具体车辆列表', visible: true }; router.get('/vehicle/specific', vehicle.specificGet); app.fs.api.logAttr['PUT/vehicle/specific'] = { content: '编辑具体车辆数据', visible: true }; router.put('/vehicle/specific', vehicle.specificEdit); app.fs.api.logAttr['DEL/vehicle/:vehicleId/specific'] = { content: '删除具体车辆数据', visible: false }; router.del('/vehicle/:vehicleId/specific', vehicle.specificDel); // 业户 app.fs.api.logAttr['GET/vehicle/business'] = { content: '获取业户列表', visible: true }; router.get('/vehicle/business', vehicle.businessGet); app.fs.api.logAttr['PUT/vehicle/business'] = { content: '编辑业户数据', visible: true }; router.put('/vehicle/business', vehicle.businessEdit); app.fs.api.logAttr['DEL/vehicle/business/:businessId'] = { content: '删除业户数据', visible: false }; router.del('/vehicle/business/:businessId', vehicle.businessDel); // 运政 END // 道路 app.fs.api.logAttr['POST/road/import'] = { content: '导入道路数据', visible: true }; router.post('/road/import', road.importIn); app.fs.api.logAttr['GET/road'] = { content: '获取道路数据', visible: true }; router.get('/road', road.get); app.fs.api.logAttr['GET/road/section'] = { content: '获取道路路段数据', visible: true }; router.get('/road/section', road.getRoadSection); app.fs.api.logAttr['put/road'] = { content: '编辑道路数据', visible: true }; router.put('/road', road.edit); app.fs.api.logAttr['DEL/road/:roadId'] = { content: '删除道路数据', visible: false }; router.del('/road/:roadId', road.del); // 道路 END // 桥梁 app.fs.api.logAttr['GET/bridge'] = { content: '获取桥梁数据', visible: true }; router.get('/bridge', bridge.bridgeGet); app.fs.api.logAttr['PUT/bridge'] = { content: '编辑桥梁数据', visible: true }; router.put('/bridge', bridge.bridgeEdit); app.fs.api.logAttr['DEL/bridge/:bridgeId'] = { content: '删除桥梁数据', visible: false }; router.del('/bridge/:bridgeId', bridge.bridgeDel); // 桥梁 END // project app.fs.api.logAttr['GET/project'] = { content: '获取工程数据', visible: true }; router.get('/project', project.projectGet); app.fs.api.logAttr['PUT/project'] = { content: '编辑工程数据', visible: true }; router.put('/project', project.projectEdit); app.fs.api.logAttr['DEL/project/:projectId'] = { content: '删除工程数据', visible: false }; router.del('/project/:projectId', project.projectDel); // project END //overspeed app.fs.api.logAttr['GET/overspeed'] = { content: '获取治超数据', visible: true }; router.get('/overspeed', overspeed.overspeedGet); app.fs.api.logAttr['PUT/overspeed'] = { content: '编辑治超数据', visible: true }; router.put('/overspeed', overspeed.overspeedEdit); app.fs.api.logAttr['DEL/overspeed/:overspeedId'] = { content: '删除治超数据', visible: false }; router.del('/overspeed/:overspeedId', overspeed.overspeedDel); //overspeed END //bus app.fs.api.logAttr['GET/bus/line'] = { content: '获取公交路线数据', visible: true }; router.get('/bus/line', bus.lineGet); app.fs.api.logAttr['PUT/bus/line'] = { content: '编辑公交路线数据', visible: true }; router.put('/bus/line', bus.lineEdit); app.fs.api.logAttr['DEL/bus/line/:lineId'] = { content: '删除公交路线数据', visible: false }; router.del('/bus/line/:lineId', bus.lineDel); app.fs.api.logAttr['GET/bus/car'] = { content: '获取公交车辆数据', visible: true }; router.get('/bus/car', bus.carGet); app.fs.api.logAttr['PUT/bus/car'] = { content: '编辑公交车辆数据', visible: true }; router.put('/bus/car', bus.carEdit); app.fs.api.logAttr['DEL/bus/car/:carId'] = { content: '删除公交车辆数据', visible: false }; router.del('/bus/car/:carId', bus.carDel); //bus END //publicity app.fs.api.logAttr['GET/publicity'] = { content: '获取宣传数据', visible: true }; router.get('/publicity', publicity.publicityGet); app.fs.api.logAttr['PUT/publicity'] = { content: '编辑宣传数据', visible: true }; router.put('/publicity', publicity.publicityEdit); app.fs.api.logAttr['DEL/publicity/:publicityId'] = { content: '删除宣传数据', visible: false }; router.del('/publicity/:publicityId', publicity.publicityDel); //publicity END };