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{