refactor: 清理未使用IPC命令、修正point_service注释与扣费逻辑、修复camelToSnake正则、优化vidu import

- 删除8个未使用IPC命令,保留validate_media_path
- file.rs返回类型优化为ApiResponse<()>
- point_service.consume()注释与签名一致
- VideoGeneration改为拼接成功后扣费
- 添加漏扣费风险注释
- 删除过时测试文件
- 修复camelToSnake连续大写字母问题
- vidu.py import移至模块顶层

Refs: P1-1~P1-6 技术债务清理
This commit is contained in:
小鱼开发
2026-05-14 17:45:28 +08:00
parent 7f2d61742e
commit 7550559aa0
40 changed files with 275 additions and 1731 deletions
+3 -55
View File
@@ -1,54 +1,20 @@
"""
系统模块 API
============
提供版本信息查询。
"""
import logging
from fastapi import APIRouter, status
from fastapi.responses import JSONResponse
from fastapi import APIRouter
from app.core.health_checker import check_database, check_redis
from app.schemas.common import ApiResponse, success_response
logger = logging.getLogger(__name__)
router = APIRouter()
@router.get("/health", response_model=ApiResponse[dict])
async def system_health():
"""系统健康检查(详细版)"""
db_ok, db_msg = await check_database()
redis_ok, redis_msg = await check_redis()
services = {
"api": "up",
"database": "connected" if db_ok else db_msg,
"redis": "connected" if redis_ok else redis_msg,
}
if not db_ok:
return JSONResponse(
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
content={
"code": status.HTTP_503_SERVICE_UNAVAILABLE,
"message": "数据库连接异常",
"data": {"status": "unhealthy", "services": services},
},
)
if not redis_ok:
return success_response(
message="Redis 连接异常,服务降级",
data={"status": "degraded", "services": services},
)
return success_response(
message="系统运行正常",
data={"status": "healthy", "services": services},
)
@router.get("/version", response_model=ApiResponse[dict])
async def system_version():
"""获取系统版本信息"""
@@ -66,22 +32,4 @@ async def system_version():
)
@router.post("/admin/runtime-config/reload", response_model=ApiResponse[dict])
async def reload_runtime_config_api():
"""
❌ 已禁用 — 所有环境均不支持热重载配置。
测试/生产环境统一走 Docker 滚动重启:
docker compose -f docker-compose.prod.yml up -d --build
Python 模块导入机制导致运行时热替换配置是反模式,
不区分环境,一律禁止。
"""
return JSONResponse(
status_code=status.HTTP_403_FORBIDDEN,
content={
"code": status.HTTP_403_FORBIDDEN,
"message": "热重载已禁用,请使用滚动重启更新配置",
"data": None,
},
)