fix(order): 修复超时与异常过渡态下的状态机流转及权限断层
This commit is contained in:
@@ -45,7 +45,7 @@ func canAdminPlatformHandoff(order model.RentalOrder) bool {
|
||||
if !isPlatformHandoffOrder(order) {
|
||||
return false
|
||||
}
|
||||
if order.Status != orderStatusPendingHandoff {
|
||||
if order.Status != orderStatusPendingHandoff && order.Status != orderStatusAbnormal {
|
||||
return false
|
||||
}
|
||||
return order.HandoffStatus == handoffStatusPendingOwner ||
|
||||
@@ -61,7 +61,9 @@ func canAdminPlatformCheckoutConfirm(order model.RentalOrder) bool {
|
||||
return true
|
||||
}
|
||||
return order.Status == orderStatusAbnormal &&
|
||||
order.HandoffStatus == handoffStatusOwnerCheckoutConfirmTimeout
|
||||
(order.HandoffStatus == handoffStatusOwnerCheckoutConfirmTimeout ||
|
||||
order.HandoffStatus == handoffStatusOwnerReturnConfirmTimeout ||
|
||||
order.HandoffStatus == handoffStatusPendingOwnerCheckout)
|
||||
}
|
||||
|
||||
func canAdminMarkOfflineSettlement(order model.RentalOrder) bool {
|
||||
@@ -98,6 +100,7 @@ func (r *Repository) AdminPlatformHandoff(ctx context.Context, adminID uint64, o
|
||||
return err
|
||||
}
|
||||
now := time.Now()
|
||||
order.Status = orderStatusPendingHandoff
|
||||
order.HandoffStatus = handoffStatusPendingRenterConfirm
|
||||
order.HandoffStartedAt = &now
|
||||
if err := appendOrderEvent(tx, order, "handoff", "platform_handoff_submitted", processlog.ActorAdmin, adminID, processlog.ActorUser, &order.RenterID, req.Content, req.Reason, nil, before, nil); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user