Unify all timestamps to Beijing time (UTC+8)

- Add BEIJING_TZ constant in config.py
- Replace all timezone.utc references across 11 files
- Device-reported times, DB defaults, protocol sync all use Beijing time

via [HAPI](https://hapi.run)

Co-Authored-By: HAPI <noreply@hapi.run>
This commit is contained in:
2026-03-24 05:25:31 +00:00
parent 11281e5be2
commit ced836179c
11 changed files with 70 additions and 47 deletions

View File

@@ -3,7 +3,9 @@ Beacon Service - 蓝牙信标管理服务
Provides CRUD operations for Bluetooth beacon configuration.
"""
from datetime import datetime, timezone
from datetime import datetime
from app.config import BEIJING_TZ
from sqlalchemy import func, select, or_
from sqlalchemy.ext.asyncio import AsyncSession
@@ -78,7 +80,7 @@ async def update_beacon(
update_data = data.model_dump(exclude_unset=True)
for key, value in update_data.items():
setattr(beacon, key, value)
beacon.updated_at = datetime.now(timezone.utc)
beacon.updated_at = datetime.now(BEIJING_TZ)
await db.flush()
await db.refresh(beacon)