From 60e6eb9d18ce281d7e9a2c519b7686e6d7dc93bc Mon Sep 17 00:00:00 2001 From: yml2213 Date: Mon, 29 Jun 2026 01:42:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A9=B3=E5=9B=9E=E9=80=80?= =?UTF-8?q?=E6=AC=BE=E6=81=A2=E5=A4=8D=E8=AE=A2=E5=8D=95=E6=97=B6=E4=BA=A4?= =?UTF-8?q?=E6=8E=A5=E8=BF=9B=E5=BA=A6=E8=A2=AB=E9=87=8D=E7=BD=AE=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 取消订单时从待交接状态取消不再覆盖 handoff_status,保留原有交接进度 - 驳回恢复时仅在 cancelled 或 renter_confirm_timeout 时重置为 pending_owner --- backend/internal/modules/order/admin_actions.go | 4 +++- backend/internal/modules/order/lifecycle.go | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/internal/modules/order/admin_actions.go b/backend/internal/modules/order/admin_actions.go index b38661b..1931ff9 100644 --- a/backend/internal/modules/order/admin_actions.go +++ b/backend/internal/modules/order/admin_actions.go @@ -410,7 +410,9 @@ func (r *Repository) AdminRejectRefund(ctx context.Context, orderID uint64, acti return errors.New("仅已取消的订单可以恢复") } order.Status = orderStatusPendingHandoff - order.HandoffStatus = handoffStatusPendingOwner + if order.HandoffStatus == handoffStatusCancelled || order.HandoffStatus == handoffStatusRenterConfirmTimeout { + order.HandoffStatus = handoffStatusPendingOwner + } order.SettlementStatus = settlementStatusUnsettled order.SettledAt = nil reserveListingForOrder(listing) diff --git a/backend/internal/modules/order/lifecycle.go b/backend/internal/modules/order/lifecycle.go index ff0816e..fd2bde5 100644 --- a/backend/internal/modules/order/lifecycle.go +++ b/backend/internal/modules/order/lifecycle.go @@ -245,7 +245,6 @@ func (r *Repository) Cancel(ctx context.Context, userID uint64, orderID uint64) beforeStatus := order.Status now := time.Now() order.Status = orderStatusCancelled - order.HandoffStatus = handoffStatusCancelled order.SettledAt = &now orderID := order.ID if beforeStatus == orderStatusPendingHandoff { @@ -253,6 +252,8 @@ func (r *Repository) Cancel(ctx context.Context, userID uint64, orderID uint64) order.RefundStatus = refundStatusPendingReview order.RefundAmountCent = totalCent order.RefundedAt = nil + } else { + order.HandoffStatus = handoffStatusCancelled } if err := notification.Append(tx, notification.Entry{