修改小程序,前端,官网跳转路径
This commit is contained in:
44
government-backend/routes/harmless.js
Normal file
44
government-backend/routes/harmless.js
Normal file
@@ -0,0 +1,44 @@
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const { body } = require('express-validator');
|
||||
const harmlessRegistrationController = require('../controllers/HarmlessRegistrationController');
|
||||
const authMiddleware = require('../middleware/auth');
|
||||
|
||||
// 应用身份验证中间件
|
||||
router.use(authMiddleware);
|
||||
|
||||
// 获取无害化登记列表
|
||||
router.get('/list', harmlessRegistrationController.getList);
|
||||
|
||||
// 获取无害化登记详情
|
||||
router.get('/detail/:id', harmlessRegistrationController.getDetail);
|
||||
|
||||
// 创建无害化登记
|
||||
router.post('/create', [
|
||||
body('registrationNumber').notEmpty().withMessage('登记编号不能为空'),
|
||||
body('animalType').notEmpty().withMessage('动物类型不能为空'),
|
||||
body('quantity').isInt({ min: 1 }).withMessage('数量必须大于0'),
|
||||
body('reason').notEmpty().withMessage('原因不能为空'),
|
||||
body('processingMethod').notEmpty().withMessage('处理方式不能为空'),
|
||||
body('processingPlace').notEmpty().withMessage('处理场所不能为空'),
|
||||
body('processingDate').notEmpty().withMessage('处理日期不能为空'),
|
||||
body('registrant').notEmpty().withMessage('登记人不能为空')
|
||||
], harmlessRegistrationController.create);
|
||||
|
||||
// 更新无害化登记
|
||||
router.put('/update/:id', [
|
||||
body('registrationNumber').optional().notEmpty().withMessage('登记编号不能为空'),
|
||||
body('animalType').optional().notEmpty().withMessage('动物类型不能为空'),
|
||||
body('quantity').optional().isInt({ min: 1 }).withMessage('数量必须大于0'),
|
||||
body('reason').optional().notEmpty().withMessage('原因不能为空'),
|
||||
body('processingMethod').optional().notEmpty().withMessage('处理方式不能为空'),
|
||||
body('processingPlace').optional().notEmpty().withMessage('处理场所不能为空'),
|
||||
body('processingDate').optional().notEmpty().withMessage('处理日期不能为空'),
|
||||
body('registrant').optional().notEmpty().withMessage('登记人不能为空'),
|
||||
body('status').optional().isIn(['待处理', '处理中', '已完成', '已取消']).withMessage('状态必须是待处理、处理中、已完成或已取消')
|
||||
], harmlessRegistrationController.update);
|
||||
|
||||
// 删除无害化登记
|
||||
router.delete('/delete/:id', harmlessRegistrationController.delete);
|
||||
|
||||
module.exports = router;
|
||||
38
government-backend/routes/harmlessPlace.js
Normal file
38
government-backend/routes/harmlessPlace.js
Normal file
@@ -0,0 +1,38 @@
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const { body } = require('express-validator');
|
||||
const harmlessPlaceController = require('../controllers/HarmlessPlaceController');
|
||||
const authMiddleware = require('../middleware/auth');
|
||||
|
||||
// 应用身份验证中间件
|
||||
router.use(authMiddleware);
|
||||
|
||||
// 获取无害化场所列表
|
||||
router.get('/list', harmlessPlaceController.getList);
|
||||
|
||||
// 获取无害化场所详情
|
||||
router.get('/detail/:id', harmlessPlaceController.getDetail);
|
||||
|
||||
// 创建无害化场所
|
||||
router.post('/create', [
|
||||
body('name').notEmpty().withMessage('场所名称不能为空'),
|
||||
body('address').notEmpty().withMessage('地址不能为空'),
|
||||
body('contactPerson').notEmpty().withMessage('联系人不能为空'),
|
||||
body('contactPhone').notEmpty().withMessage('联系电话不能为空'),
|
||||
body('licenseNumber').notEmpty().withMessage('许可证号不能为空')
|
||||
], harmlessPlaceController.create);
|
||||
|
||||
// 更新无害化场所
|
||||
router.put('/update/:id', [
|
||||
body('name').optional().notEmpty().withMessage('场所名称不能为空'),
|
||||
body('address').optional().notEmpty().withMessage('地址不能为空'),
|
||||
body('contactPerson').optional().notEmpty().withMessage('联系人不能为空'),
|
||||
body('contactPhone').optional().notEmpty().withMessage('联系电话不能为空'),
|
||||
body('licenseNumber').optional().notEmpty().withMessage('许可证号不能为空'),
|
||||
body('status').optional().isIn(['正常', '维护中', '停用']).withMessage('状态必须是正常、维护中或停用')
|
||||
], harmlessPlaceController.update);
|
||||
|
||||
// 删除无害化场所
|
||||
router.delete('/delete/:id', harmlessPlaceController.delete);
|
||||
|
||||
module.exports = router;
|
||||
17
government-backend/routes/slaughter.js
Normal file
17
government-backend/routes/slaughter.js
Normal file
@@ -0,0 +1,17 @@
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const slaughterhouseController = require('../controllers/SlaughterhouseController');
|
||||
const authMiddleware = require('../middleware/auth');
|
||||
|
||||
// 应用认证中间件
|
||||
router.use(authMiddleware);
|
||||
|
||||
// 屠宰场管理路由
|
||||
router.get('/slaughterhouses', slaughterhouseController.getSlaughterhouses);
|
||||
router.get('/slaughterhouses/:id', slaughterhouseController.getSlaughterhouseById);
|
||||
router.post('/slaughterhouses', slaughterhouseController.createSlaughterhouse);
|
||||
router.put('/slaughterhouses/:id', slaughterhouseController.updateSlaughterhouse);
|
||||
router.delete('/slaughterhouses/:id', slaughterhouseController.deleteSlaughterhouse);
|
||||
router.patch('/slaughterhouses/:id/status', slaughterhouseController.toggleSlaughterhouseStatus);
|
||||
|
||||
module.exports = router;
|
||||
13
government-backend/routes/test-route.js
Normal file
13
government-backend/routes/test-route.js
Normal file
@@ -0,0 +1,13 @@
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
|
||||
// 简单的测试路由
|
||||
router.get('/test', (req, res) => {
|
||||
res.json({
|
||||
code: 200,
|
||||
message: '测试路由工作正常',
|
||||
timestamp: new Date()
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
Reference in New Issue
Block a user