From 451e24c34c424720349389f0bd08ac6459c9a92f Mon Sep 17 00:00:00 2001 From: duxingchen Date: Fri, 28 Aug 2026 15:13:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(workload):=20get=5Fpeople=5Fworkload=20?= =?UTF-8?q?=E5=86=85=E5=B5=8C=20=5Fto=5Fbj=20=E6=94=B9=E7=94=A8=20to=5Fbei?= =?UTF-8?q?jing=EF=BC=8C=E4=BF=AE=E5=A4=8D=20BEIJING=5FTZ=20=E6=9C=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 import 后内嵌 _to_bj 仍引用 BEIJING_TZ 导致 NameError --- backend/app/services/dashboard_service.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/backend/app/services/dashboard_service.py b/backend/app/services/dashboard_service.py index 8b79631..d1ddee9 100644 --- a/backend/app/services/dashboard_service.py +++ b/backend/app/services/dashboard_service.py @@ -710,14 +710,7 @@ async def get_people_workload(db: AsyncSession) -> list[PersonWorkload]: rows = result.all() def _to_bj(dt): - if not dt: - return None - if dt.tzinfo is None: - from datetime import timezone as dt_timezone - dt = dt.replace(tzinfo=dt_timezone.utc).astimezone(BEIJING_TZ) - else: - dt = dt.astimezone(BEIJING_TZ) - return dt + return to_beijing(dt) now = get_beijing_time()