fix(order): 修复超时与异常过渡态下的状态机流转及权限断层

This commit is contained in:
yml2213
2026-09-09 16:15:21 +08:00
parent 17d4f7be9e
commit 8b7a0c8059
9 changed files with 267 additions and 43 deletions
+9 -3
View File
@@ -374,7 +374,13 @@ func applyCheckoutActionFlags(dto *CheckoutDTO, checkout model.OrderCheckout, or
if dto == nil {
return
}
negotiating := order.Status == orderStatusPendingCheckoutConfirm || order.Status == orderStatusPendingCheckoutAccept
isOwnerPending := order.Status == orderStatusPendingCheckoutConfirm ||
(order.Status == orderStatusAbnormal &&
(order.HandoffStatus == handoffStatusOwnerCheckoutConfirmTimeout ||
order.HandoffStatus == handoffStatusOwnerReturnConfirmTimeout ||
order.HandoffStatus == handoffStatusPendingOwnerCheckout))
isRenterPending := order.Status == orderStatusPendingCheckoutAccept
negotiating := isOwnerPending || isRenterPending
if !negotiating || (checkout.Status != checkoutStatusSubmitted && checkout.Status != checkoutStatusCountered) {
return
}
@@ -382,11 +388,11 @@ func applyCheckoutActionFlags(dto *CheckoutDTO, checkout model.OrderCheckout, or
round := dto.RoundCount
isOwner := userID == order.OwnerID
isRenter := userID == order.RenterID
if isOwner && turn == checkoutTurnOwner && order.Status == orderStatusPendingCheckoutConfirm {
if isOwner && turn == checkoutTurnOwner && isOwnerPending {
dto.CanAccept = dto.ShortfallCent <= 0
dto.CanCounter = round < checkoutMaxRounds
}
if isRenter && turn == checkoutTurnRenter && order.Status == orderStatusPendingCheckoutAccept {
if isRenter && turn == checkoutTurnRenter && isRenterPending {
dto.CanAccept = dto.ShortfallCent <= 0
dto.CanCounter = round < checkoutMaxRounds
}