From 5e38a3d49a9257aedf0bf6d0361c9ac47134ba49 Mon Sep 17 00:00:00 2001 From: XingQue Date: Mon, 27 Jul 2026 08:24:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=87=AA=E5=8A=A8=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=88=B0=E6=9C=9F=E6=97=B6=E9=97=B4=E6=88=B3?= =?UTF-8?q?=E4=BE=9B=E5=89=8D=E7=AB=AF=E7=A7=92=E7=BA=A7=E5=80=92=E8=AE=A1?= =?UTF-8?q?=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 详情/列表用 auto_expire_at_ts 做 HH:MM:SS 时钟;展示不依赖 Celery,真正自动结单才需要 beat。 Co-authored-by: Cursor --- jituan/services/order_deal.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jituan/services/order_deal.py b/jituan/services/order_deal.py index c4495c4..e0a38b0 100644 --- a/jituan/services/order_deal.py +++ b/jituan/services/order_deal.py @@ -55,9 +55,15 @@ def order_auto_settle_payload(order) -> dict: elif timezone.is_naive(expire_at) and timezone.is_aware(now): expire_at = timezone.make_aware(expire_at, timezone.get_current_timezone()) remain = int((expire_at - now).total_seconds()) + try: + expire_ts = int(expire_at.timestamp()) + except Exception: + expire_ts = 0 return { 'auto_settle_eligible': True, 'auto_expire_at': fmt_datetime(expire_at), + # 前端用时间戳做秒级时钟倒计时,避免解析本地时区偏差 + 'auto_expire_at_ts': expire_ts, 'auto_settle_remain_seconds': max(0, remain), }