qq 登录修复

This commit is contained in:
yml2213
2026-08-12 19:45:15 +08:00
parent 5074faf9f6
commit 4c978b923b
7 changed files with 88 additions and 19 deletions
+13 -4
View File
@@ -22,6 +22,15 @@ def _from_ts(value) -> datetime | None:
return None
def _as_utc(value: datetime | None) -> datetime | None:
"""DB 时间列为 naive UTC;输出时补 UTC 时区标记,前端才能按本地时区正确显示。"""
if value is None:
return None
if value.tzinfo is None:
return value.replace(tzinfo=timezone.utc)
return value.astimezone(timezone.utc)
def cleanup_orphan_yyb_tasks(db: Session, message: str) -> int:
rows = db.query(YybRechargeTask).filter(
YybRechargeTask.status.in_(["created", "waiting_login", "ready", "running", "ordering", "waiting_payment"])
@@ -85,10 +94,10 @@ def public_task(task: YybRechargeTask, include_qr: bool = True,
"role_id": task.role_id, "role_name": task.role_name, "status": task.status,
"phase": task.phase, "message": task.message, "result": task.result,
"created_by": task.created_by, "created_by_username": creator_username,
"created_at": task.created_at, "finished_at": task.finished_at,
"payment_started_at": task.payment_started_at,
"payment_qr_created_at": task.payment_qr_created_at,
"payment_last_checked_at": task.payment_last_checked_at,
"created_at": _as_utc(task.created_at), "finished_at": _as_utc(task.finished_at),
"payment_started_at": _as_utc(task.payment_started_at),
"payment_qr_created_at": _as_utc(task.payment_qr_created_at),
"payment_last_checked_at": _as_utc(task.payment_last_checked_at),
}
if task.result:
result["login_qr_mime_type"] = task.result.get("login_qr_mime_type", "image/jpeg")
+11 -1
View File
@@ -309,7 +309,17 @@ export default function YybRechargePage() {
)}
{status === 'ordering' && (
<Space direction="vertical" size={10} style={{ width: '100%' }}>
<Spin tip={task.message || '正在生成付款码'}><div style={{ height: 40 }} /></Spin>
<Alert type="info" showIcon
message="正在生成微信付款码"
description="下单与付款码生成约需 30~60 秒,请勿关闭页面;生成后二维码会自动显示。" />
<div style={{
width: 280, height: 280, border: '2px dashed #d9d9d9', borderRadius: 12,
display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center',
gap: 12, background: '#fafafa',
}}>
<Spin size="large" />
<Text type="secondary">...</Text>
</div>
{showLogs && (
<Collapse
activeKey={logsOpen ? ['logs'] : undefined}