fix(order): 修复超时与异常过渡态下的状态机流转及权限断层
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user