fix: Token timezone display + Skill install/uninstall bugs

This commit is contained in:
qyyfw committed 2026-07-03 16:13:14 +08:00
1 parent 5a7c717b25
commit 251bbc4123
3 files changed
+18 -16

No files matched your search

+12 -8
View File
@@ -85,12 +85,14 @@ async def get_recent_logs(
def _format_cst(dt_value):
"""Format UTC naive datetime to CST ISO string"""
"""Format datetime to CST ISO string.
DB values are written by cst_now() as CST time (stored naive by MySQL).
No UTC conversion needed - treat naive values as CST directly.
"""
if dt_value is None:
return None
utc_dt = dt_value.replace(tzinfo=timezone.utc)
cst_dt = utc_dt.astimezone(CST_TZ)
return cst_dt.isoformat()
# DB naive values are already CST (written by cst_now()), just attach tz
return dt_value.replace(tzinfo=CST_TZ).isoformat()
@router.get("/recent-audit")
async def get_recent_audit(
@@ -117,9 +119,11 @@ async def get_recent_audit(
def _format_cst(dt_value):
"""Format UTC naive datetime to CST ISO string"""
"""Format datetime to CST ISO string.
DB values are written by cst_now() as CST time (stored naive by MySQL).
No UTC conversion needed - treat naive values as CST directly.
"""
if dt_value is None:
return None
utc_dt = dt_value.replace(tzinfo=timezone.utc)
cst_dt = utc_dt.astimezone(CST_TZ)
return cst_dt.isoformat()
# DB naive values are already CST (written by cst_now()), just attach tz
return dt_value.replace(tzinfo=CST_TZ).isoformat()
-3
View File
@@ -387,9 +387,6 @@ def uninstall_app(
app.install_count = app.install_count - 1
# 将应用状态标记为未安装(对于skill类型)
if app.type == "skill" and app.is_active:
app.is_active = False
app.updated_at = datetime.now()
db.commit()
+6 -5
View File
@@ -252,10 +252,11 @@ def recharge(
def _format_cst_time(dt_value):
"""Format datetime to CST ISO string. Input is UTC naive datetime from DB."""
"""Format datetime to CST ISO string.
DB values are written by cst_now() as CST time (stored naive by MySQL).
No UTC conversion needed - treat naive values as CST directly.
"""
if dt_value is None:
return None
# DB stores UTC naive datetime, convert to CST
utc_dt = dt_value.replace(tzinfo=timezone.utc)
cst_dt = utc_dt.astimezone(CST_TZ)
return cst_dt.isoformat()
# DB naive values are already CST (written by cst_now()), just attach tz
return dt_value.replace(tzinfo=CST_TZ).isoformat()