fix(history): 创建时间 UTC→北京时间(+8); 标的列加宽(100→130)治折行 [nas]
CI/CD / test (push) Successful in 11s
CI/CD / nas-deploy (push) Successful in 25s
CI/CD / nas-verify (push) Successful in 6s

This commit is contained in:
2026-08-13 14:17:23 +08:00
parent 5248062102
commit 976c99de07
2 changed files with 14 additions and 2 deletions
+1 -1
View File
@@ -158,7 +158,7 @@ function statusLabel(s: string): string {
<template #default="{ row }"><span class="chip" :class="`chip-${row.type}`">{{ typeLabel(row.type) }}</span></template>
</el-table-column>
<el-table-column prop="strategy" label="策略 / 因子" min-width="130" show-overflow-tooltip />
<el-table-column prop="symbol" label="标的" width="100" />
<el-table-column prop="symbol" label="标的" width="130" />
<el-table-column label="状态" width="88">
<template #default="{ row }"><span class="chip" :class="`st-${row.status}`">{{ statusLabel(row.status) }}</span></template>
</el-table-column>
+13 -1
View File
@@ -322,6 +322,18 @@ def factor_report(task_id: str, factor: str, token: str = Query(...)):
# ===== History + Optimization endpoints (S3) =====
def _to_bj(ts: str | None) -> str:
"""SQLite CURRENT_TIMESTAMP 存的是 UTC → 转北京时间(+8)显示。"""
if not ts:
return ""
try:
from datetime import datetime, timedelta
dt = datetime.strptime(ts, "%Y-%m-%d %H:%M:%S")
return (dt + timedelta(hours=8)).strftime("%Y-%m-%d %H:%M:%S")
except (ValueError, TypeError):
return ts
@router.get("/task", dependencies=[Depends(verify_token)])
def list_tasks(type: str | None = None, status: str | None = None):
"""List tasks: 内存中 running/pending + DB done/failed(历史)。
@@ -377,7 +389,7 @@ def list_tasks(type: str | None = None, status: str | None = None):
"symbol": r.symbol,
"start": r.start,
"end": r.end,
"created_at": r.created_at,
"created_at": _to_bj(r.created_at),
})
active.reverse() # 最新提交的 running 在最上