refactor: 完成项目整体架构升级与依赖优化

此提交包含多项核心优化:
1.  依赖库升级:更新FastAPI、替换fastapi-limiter为slowapi,更换MySQL驱动为aiomysql,重构缓存系统使用fastapi-cache2-fork
2.  代码重构:移除自定义缓存工具,统一使用fastapi-cache2;重构请求限流逻辑,修复操作日志记录开关逻辑
3.  接口规范:统一将Depends分页/查询参数改为Query注解,补全File上传依赖注解
4.  前端优化:调整登录滑块进度条颜色、移除冗余demo页面样式类
5.  日志优化:重构日志配置,使用time.perf_counter替代time.time统计耗时
6.  测试优化:移除冗余的限流mock配置,改用官方限流方案
7.  模板优化:更新vue代码生成模板,移除冗余导入并优化组件使用
8.  导入功能优化:移除pandas依赖,使用Excel工具类重构文件导入逻辑
This commit is contained in:
zhangtao
2026-07-01 00:35:28 +08:00
parent a39bedabb9
commit a86233d6c2
51 changed files with 1126 additions and 42754 deletions
+15 -6
View File
@@ -1,6 +1,6 @@
from typing import Annotated
from fastapi import APIRouter, Depends
from fastapi import APIRouter, Depends, Path
from fastapi.responses import JSONResponse
from redis.asyncio.client import Redis
@@ -44,7 +44,10 @@ async def get_monitor_cache_name_controller() -> JSONResponse:
summary="获取缓存键名列表",
response_model=ResponseSchema[list[CacheInfoSchema]],
)
async def get_monitor_cache_key_controller(cache_name: str, redis: Annotated[Redis, Depends(redis_getter)]) -> JSONResponse:
async def get_monitor_cache_key_controller(
cache_name: Annotated[str, Path(description="缓存名称")],
redis: Annotated[Redis, Depends(redis_getter)]
) -> JSONResponse:
result = await CacheService.get_monitor_cache_keys(redis=redis, cache_name=cache_name)
return SuccessResponse(data=result, msg=f"获取缓存{cache_name}的键名列表成功")
@@ -56,8 +59,8 @@ async def get_monitor_cache_key_controller(cache_name: str, redis: Annotated[Red
response_model=ResponseSchema[CacheInfoSchema],
)
async def get_monitor_cache_value_controller(
cache_name: str,
cache_key: str,
cache_name: Annotated[str, Path(description="缓存名称")],
cache_key: Annotated[str, Path(description="缓存键名")],
redis: Annotated[Redis, Depends(redis_getter)],
) -> JSONResponse:
result = await CacheService.get_monitor_cache_value(redis=redis, cache_name=cache_name, cache_key=cache_key)
@@ -70,7 +73,10 @@ async def get_monitor_cache_value_controller(
summary="清除指定缓存名称的所有缓存",
response_model=ResponseSchema[None],
)
async def clear_monitor_cache_name_controller(cache_name: str, redis: Annotated[Redis, Depends(redis_getter)]) -> JSONResponse:
async def clear_monitor_cache_name_controller(
cache_name: Annotated[str, Path(description="缓存名称")],
redis: Annotated[Redis, Depends(redis_getter)]
) -> JSONResponse:
result = await CacheService.clear_monitor_cache_by_name(redis=redis, cache_name=cache_name)
return SuccessResponse(msg=f"{cache_name}对应键值清除成功", data=result)
@@ -81,7 +87,10 @@ async def clear_monitor_cache_name_controller(cache_name: str, redis: Annotated[
summary="清除指定缓存键",
response_model=ResponseSchema[None],
)
async def clear_monitor_cache_key_controller(cache_key: str, redis: Annotated[Redis, Depends(redis_getter)]) -> JSONResponse:
async def clear_monitor_cache_key_controller(
cache_key: Annotated[str, Path(description="缓存键名")],
redis: Annotated[Redis, Depends(redis_getter)]
) -> JSONResponse:
result = await CacheService.clear_monitor_cache_by_key(redis=redis, cache_key=cache_key)
return SuccessResponse(msg=f"{cache_key}清除成功", data=result)