diff --git a/backend/controller/user.py b/backend/controller/user.py index 4d51ed4..058ac64 100644 --- a/backend/controller/user.py +++ b/backend/controller/user.py @@ -48,10 +48,10 @@ async def user_arr( async def user_list(query: UserQuery) -> Response[ListAll[list[UserRead]]]: """post查询用户列表""" - limit = query.size - skip = (query.offset - 1) * limit - del query.offset, query.size - users, count = await get_users(skip, limit, query.dict()) + size = query.limit + skip = (query.offset - 1) * size + del query.offset, query.limit + users, count = await get_users(skip, size, query.dict()) return Response(data=ListAll(total=count, items=users)) diff --git a/backend/dbhelper/user.py b/backend/dbhelper/user.py index 364861e..c0fc401 100644 --- a/backend/dbhelper/user.py +++ b/backend/dbhelper/user.py @@ -63,9 +63,8 @@ async def get_users(skip: int, limit: int, kwargs: dict = None): kwargs = {f"{k}__contains": v for k, v in kwargs.items()} else: kwargs = {} - result = ( - UserModel.filter(status__not_in=[9, 5], **kwargs).all().order_by("-created") - ) + result = UserModel.filter(**kwargs).all().order_by("-created") + print(await result.offset(skip).limit(limit)) return await result.offset(skip).limit(limit), await result.count() @@ -98,9 +97,11 @@ async def put_user(uid: int, data: UserPut): for role in roles: if await get_role({"id": role.rid, "status__not": 9}) is None: return role.rid - # 更新用户 - data.password = get_password_hash(data.password) + if data.password != "加密之后的密码": + data.password = get_password_hash(data.password) + else: + del data.password await UserModel.filter(id=uid).update(**data.dict()) # todo 1. 先前有的角色,这次更新成没有 2. 先前没有的角色 这次更新成有, 3. 只更新了状态 diff --git a/backend/mini.db b/backend/mini.db index e2a2455..60e7509 100644 Binary files a/backend/mini.db and b/backend/mini.db differ diff --git a/backend/mini.db-shm b/backend/mini.db-shm deleted file mode 100644 index 763739d..0000000 Binary files a/backend/mini.db-shm and /dev/null differ diff --git a/backend/mini.db-wal b/backend/mini.db-wal deleted file mode 100644 index 0c69346..0000000 Binary files a/backend/mini.db-wal and /dev/null differ diff --git a/backend/schemas/common.py b/backend/schemas/common.py index e116b9d..57cd61e 100644 --- a/backend/schemas/common.py +++ b/backend/schemas/common.py @@ -42,7 +42,7 @@ class QueryData(BaseModel): """分页查询基础数据""" offset: int = 1 - size: int = 10 + limit: int = 10 class ListAll(GenericModel, Generic[T]): diff --git a/frontend/src/components/layout/header-crumb.vue b/frontend/src/components/layout/header-crumb.vue index 8399216..7ac4d28 100644 --- a/frontend/src/components/layout/header-crumb.vue +++ b/frontend/src/components/layout/header-crumb.vue @@ -6,7 +6,6 @@ const route = useRoute() const cruPath = computed(() => { return route.path.substring(1, route.path.length).split('/') }) -console.log(route.path, route.fullPath)