修复驳回退款恢复订单时交接进度被重置的问题

- 取消订单时从待交接状态取消不再覆盖 handoff_status,保留原有交接进度
- 驳回恢复时仅在 cancelled 或 renter_confirm_timeout 时重置为 pending_owner
This commit is contained in:
yml2213
2026-06-29 01:42:00 +08:00
parent 3215e1c8c5
commit 60e6eb9d18
2 changed files with 5 additions and 2 deletions
@@ -410,7 +410,9 @@ func (r *Repository) AdminRejectRefund(ctx context.Context, orderID uint64, acti
return errors.New("仅已取消的订单可以恢复") return errors.New("仅已取消的订单可以恢复")
} }
order.Status = orderStatusPendingHandoff order.Status = orderStatusPendingHandoff
order.HandoffStatus = handoffStatusPendingOwner if order.HandoffStatus == handoffStatusCancelled || order.HandoffStatus == handoffStatusRenterConfirmTimeout {
order.HandoffStatus = handoffStatusPendingOwner
}
order.SettlementStatus = settlementStatusUnsettled order.SettlementStatus = settlementStatusUnsettled
order.SettledAt = nil order.SettledAt = nil
reserveListingForOrder(listing) reserveListingForOrder(listing)
+2 -1
View File
@@ -245,7 +245,6 @@ func (r *Repository) Cancel(ctx context.Context, userID uint64, orderID uint64)
beforeStatus := order.Status beforeStatus := order.Status
now := time.Now() now := time.Now()
order.Status = orderStatusCancelled order.Status = orderStatusCancelled
order.HandoffStatus = handoffStatusCancelled
order.SettledAt = &now order.SettledAt = &now
orderID := order.ID orderID := order.ID
if beforeStatus == orderStatusPendingHandoff { if beforeStatus == orderStatusPendingHandoff {
@@ -253,6 +252,8 @@ func (r *Repository) Cancel(ctx context.Context, userID uint64, orderID uint64)
order.RefundStatus = refundStatusPendingReview order.RefundStatus = refundStatusPendingReview
order.RefundAmountCent = totalCent order.RefundAmountCent = totalCent
order.RefundedAt = nil order.RefundedAt = nil
} else {
order.HandoffStatus = handoffStatusCancelled
} }
if err := notification.Append(tx, if err := notification.Append(tx,
notification.Entry{ notification.Entry{