Skip to content

Commit

Permalink
fix:翻页非整数
Browse files Browse the repository at this point in the history
  • Loading branch information
vastsa committed Aug 29, 2023
1 parent 8c4f9d3 commit d1f6032
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/admin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# @Author : Lan
# @File : views.py
# @Software: PyCharm
import math

from fastapi import APIRouter, Depends

from apps.admin.depends import admin_required
Expand Down Expand Up @@ -31,8 +33,8 @@ async def file_delete(data: IDData):


@admin_api.get('/file/list', dependencies=[Depends(admin_required)])
async def file_list(page: int = 1, size: int = 10):
data = await FileCodes.all().limit(size).offset((page - 1) * size)
async def file_list(page: float = 1, size: int = 10):
data = await FileCodes.all().limit(size).offset((math.ceil(page) - 1) * size)
return APIResponse(detail={
'page': page,
'size': size,
Expand Down

0 comments on commit d1f6032

Please sign in to comment.