fix: 修复管理员修改用户角色不生效的问题

This commit is contained in:
菜鸟生产 2026-03-18 14:55:02 +08:00
parent f2372f78db
commit 42ef2eb75d
2 changed files with 7 additions and 7 deletions

View File

@ -1,6 +1,6 @@
# 用户管理路由
from typing import Optional
from fastapi import APIRouter, Depends, HTTPException, status, Query
from fastapi import APIRouter, Depends, HTTPException, status, Query, Body
from sqlalchemy.orm import Session
from app.core.database import get_db
from app.core.auth import get_current_user
@ -161,10 +161,10 @@ def get_user_collection_count(
@admin_router.put("/{user_id}")
def update_user(
user_id: str,
username: Optional[str] = None,
email: Optional[str] = None,
role: Optional[str] = None,
password: Optional[str] = None,
username: Optional[str] = Body(None),
email: Optional[str] = Body(None),
role: Optional[str] = Body(None),
password: Optional[str] = Body(None),
current_user: User = Depends(get_current_user),
db: Session = Depends(get_db)
):
@ -181,7 +181,7 @@ def update_user(
user.f01_01_name = username
if email:
user.email = email
if role:
if role is not None:
user.role = role
# 更新密码

View File

@ -2,7 +2,7 @@
# Version Configuration for Zodiac Collection Management System
# 当前版本号 (语义化版本:主版本。次版本.修订版)
VERSION=1.2.1
VERSION=1.1.11
# 版本代号 (可选)
VERSION_CODENAME="新生"