Files
hfb_sys/backend/migrations/000006_order_handoff_started_at.sql
T
yml2213andClaude Opus 4.8 8192344027 优化号主交接超时卡死问题
- 号主交接超时(owner_timeout)后允许补提交交接说明,避免临时延误导致订单卡死
- 后台新增"重置交接"动作,可将超时订单恢复为待号主交接并刷新计时
- 交接超时改以进入待交接时刻为基准计算,新增 handoff_started_at 字段

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 04:16:31 +08:00

16 lines
654 B
SQL

-- +goose Up
-- 新增进入“待号主交接”的时间,用于精确计算号主交接超时(以支付完成时刻为基准,而非订单创建时刻)。
ALTER TABLE rental_orders
ADD COLUMN handoff_started_at DATETIME NULL COMMENT '进入待号主交接的时间,用于计算交接超时' AFTER rented_at;
-- 历史数据兜底:已进入交接及之后阶段的订单,用 created_at 回填,避免基准缺失。
UPDATE rental_orders
SET handoff_started_at = created_at
WHERE handoff_started_at IS NULL
AND status NOT IN ('pending_payment', 'cancelled');
-- +goose Down
ALTER TABLE rental_orders DROP COLUMN handoff_started_at;