refactor(backend): 重构动物相关 API 接口

- 更新了动物数据结构和相关类型定义
- 优化了动物列表、详情、创建、更新和删除接口
- 新增了更新动物状态接口
- 移除了与认领记录相关的接口
-调整了 API 响应结构
This commit is contained in:
ylweng
2025-08-31 23:26:25 +08:00
parent 5b5d65e072
commit cbee609e78
25 changed files with 3232 additions and 375 deletions

View File

@@ -0,0 +1,90 @@
// 系统统计控制器
const systemStatsService = require('../../services/admin/systemStats');
/**
* 获取系统统计数据
* @param {import('express').Request} req
* @param {import('express').Response} res
* @param {import('express').NextFunction} next
*/
exports.getSystemStats = async (req, res, next) => {
try {
const stats = await systemStatsService.getSystemStats();
res.json({
success: true,
code: 200,
message: '获取系统统计数据成功',
data: stats,
timestamp: new Date().toISOString()
});
} catch (error) {
next(error);
}
};
/**
* 获取用户统计数据
* @param {import('express').Request} req
* @param {import('express').Response} res
* @param {import('express').NextFunction} next
*/
exports.getUserStats = async (req, res, next) => {
try {
const stats = await systemStatsService.getUserStats();
res.json({
success: true,
code: 200,
message: '获取用户统计数据成功',
data: stats,
timestamp: new Date().toISOString()
});
} catch (error) {
next(error);
}
};
/**
* 获取订单统计数据
* @param {import('express').Request} req
* @param {import('express').Response} res
* @param {import('express').NextFunction} next
*/
exports.getOrderStats = async (req, res, next) => {
try {
const stats = await systemStatsService.getOrderStats();
res.json({
success: true,
code: 200,
message: '获取订单统计数据成功',
data: stats,
timestamp: new Date().toISOString()
});
} catch (error) {
next(error);
}
};
/**
* 获取系统信息
* @param {import('express').Request} req
* @param {import('express').Response} res
* @param {import('express').NextFunction} next
*/
exports.getSystemInfo = async (req, res, next) => {
try {
const info = await systemStatsService.getSystemInfo();
res.json({
success: true,
code: 200,
message: '获取系统信息成功',
data: info,
timestamp: new Date().toISOString()
});
} catch (error) {
next(error);
}
};