mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-22 05:02:57 +00:00
style: 统一代码格式和字符串引号使用
refactor: 优化代码结构和可读性 feat: 添加http_limit模块实现请求限制功能 fix: 修复异步任务中使用time.sleep的问题 chore: 更新依赖项并添加pytest测试框架 docs: 更新项目描述信息 perf: 优化Redis序列化方式使用JSON替代pickle test: 添加测试相关配置和依赖
This commit is contained in:
@@ -18,15 +18,15 @@ OnlineRouter = APIRouter(route_class=OperationLogRoute, prefix="/online", tags=[
|
||||
|
||||
|
||||
@OnlineRouter.get(
|
||||
'/list',
|
||||
dependencies=[Depends(AuthPermission(['module_monitor:online:query']))],
|
||||
"/list",
|
||||
dependencies=[Depends(AuthPermission(["module_monitor:online:query"]))],
|
||||
summary="获取在线用户列表",
|
||||
description="获取在线用户列表"
|
||||
description="获取在线用户列表",
|
||||
)
|
||||
async def get_online_list_controller(
|
||||
redis: Annotated[Redis, Depends(redis_getter)],
|
||||
paging_query: Annotated[PaginationQueryParam, Depends()],
|
||||
search: Annotated[OnlineQueryParam, Depends()]
|
||||
search: Annotated[OnlineQueryParam, Depends()],
|
||||
) -> JSONResponse:
|
||||
"""
|
||||
获取在线用户列表
|
||||
@@ -40,17 +40,21 @@ async def get_online_list_controller(
|
||||
- JSONResponse: 包含在线用户列表的JSON响应。
|
||||
"""
|
||||
result_dict_list = await OnlineService.get_online_list_service(redis=redis, search=search)
|
||||
result_dict = await PaginationService.paginate(data_list=result_dict_list, page_no=paging_query.page_no, page_size=paging_query.page_size)
|
||||
log.info('获取成功')
|
||||
result_dict = await PaginationService.paginate(
|
||||
data_list=result_dict_list,
|
||||
page_no=paging_query.page_no,
|
||||
page_size=paging_query.page_size,
|
||||
)
|
||||
log.info("获取成功")
|
||||
|
||||
return SuccessResponse(data=result_dict, msg='获取成功')
|
||||
return SuccessResponse(data=result_dict, msg="获取成功")
|
||||
|
||||
|
||||
@OnlineRouter.delete(
|
||||
'/delete',
|
||||
dependencies=[Depends(AuthPermission(['module_monitor:online:delete']))],
|
||||
"/delete",
|
||||
dependencies=[Depends(AuthPermission(["module_monitor:online:delete"]))],
|
||||
summary="强制下线",
|
||||
description="强制下线"
|
||||
description="强制下线",
|
||||
)
|
||||
async def delete_online_controller(
|
||||
session_id: Annotated[str, Body(description="会话编号")],
|
||||
@@ -75,10 +79,10 @@ async def delete_online_controller(
|
||||
|
||||
|
||||
@OnlineRouter.delete(
|
||||
'/clear',
|
||||
dependencies=[Depends(AuthPermission(['module_monitor:online:delete']))],
|
||||
"/clear",
|
||||
dependencies=[Depends(AuthPermission(["module_monitor:online:delete"]))],
|
||||
summary="清除所有在线用户",
|
||||
description="清除所有在线用户"
|
||||
description="清除所有在线用户",
|
||||
)
|
||||
async def clear_online_controller(
|
||||
redis: Annotated[Redis, Depends(redis_getter)],
|
||||
|
||||
Reference in New Issue
Block a user