fix: Token timezone display + Skill install/uninstall bugs
This commit is contained in:
1 parent
5a7c717b25
commit
251bbc4123
3 files changed
+18
-16
No files matched your search
@@ -85,12 +85,14 @@ async def get_recent_logs(
|
|||||||
|
|
||||||
|
|
||||||
def _format_cst(dt_value):
|
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:
|
if dt_value is None:
|
||||||
return None
|
return None
|
||||||
utc_dt = dt_value.replace(tzinfo=timezone.utc)
|
# DB naive values are already CST (written by cst_now()), just attach tz
|
||||||
cst_dt = utc_dt.astimezone(CST_TZ)
|
return dt_value.replace(tzinfo=CST_TZ).isoformat()
|
||||||
return cst_dt.isoformat()
|
|
||||||
|
|
||||||
@router.get("/recent-audit")
|
@router.get("/recent-audit")
|
||||||
async def get_recent_audit(
|
async def get_recent_audit(
|
||||||
@@ -117,9 +119,11 @@ async def get_recent_audit(
|
|||||||
|
|
||||||
|
|
||||||
def _format_cst(dt_value):
|
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:
|
if dt_value is None:
|
||||||
return None
|
return None
|
||||||
utc_dt = dt_value.replace(tzinfo=timezone.utc)
|
# DB naive values are already CST (written by cst_now()), just attach tz
|
||||||
cst_dt = utc_dt.astimezone(CST_TZ)
|
return dt_value.replace(tzinfo=CST_TZ).isoformat()
|
||||||
return cst_dt.isoformat()
|
|
||||||
@@ -387,9 +387,6 @@ def uninstall_app(
|
|||||||
app.install_count = app.install_count - 1
|
app.install_count = app.install_count - 1
|
||||||
|
|
||||||
# 将应用状态标记为未安装(对于skill类型)
|
# 将应用状态标记为未安装(对于skill类型)
|
||||||
if app.type == "skill" and app.is_active:
|
|
||||||
app.is_active = False
|
|
||||||
|
|
||||||
app.updated_at = datetime.now()
|
app.updated_at = datetime.now()
|
||||||
|
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|||||||
@@ -252,10 +252,11 @@ def recharge(
|
|||||||
|
|
||||||
|
|
||||||
def _format_cst_time(dt_value):
|
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:
|
if dt_value is None:
|
||||||
return None
|
return None
|
||||||
# DB stores UTC naive datetime, convert to CST
|
# DB naive values are already CST (written by cst_now()), just attach tz
|
||||||
utc_dt = dt_value.replace(tzinfo=timezone.utc)
|
return dt_value.replace(tzinfo=CST_TZ).isoformat()
|
||||||
cst_dt = utc_dt.astimezone(CST_TZ)
|
|
||||||
return cst_dt.isoformat()
|
|
||||||
Reference in new issue
Block a user