fix(workload): get_people_workload 内嵌 _to_bj 改用 to_beijing,修复 BEIJING_TZ 未定义
- 移除 import 后内嵌 _to_bj 仍引用 BEIJING_TZ 导致 NameError
This commit is contained in:
@ -710,14 +710,7 @@ async def get_people_workload(db: AsyncSession) -> list[PersonWorkload]:
|
|||||||
rows = result.all()
|
rows = result.all()
|
||||||
|
|
||||||
def _to_bj(dt):
|
def _to_bj(dt):
|
||||||
if not dt:
|
return to_beijing(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
|
|
||||||
|
|
||||||
now = get_beijing_time()
|
now = get_beijing_time()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user