feat(order): 统一网站自交接订单24小时自动完成倒计时
This commit is contained in:
@@ -231,6 +231,12 @@ func (r *Repository) AdminResetHandoff(ctx context.Context, adminID uint64, orde
|
||||
order.HandoffStatus = target.HandoffStatus
|
||||
if target.RefreshStageTime {
|
||||
order.HandoffStartedAt = &now
|
||||
if !isPlatformHandoffOrder(order) && !isPlatformSettlementOrder(order) && order.HandoffDeadlineAt != nil {
|
||||
if timeoutMinutes := autoCompleteHandoffTimeoutMinutesForOrder(tx, order); timeoutMinutes > 0 {
|
||||
deadline := now.Add(time.Duration(timeoutMinutes) * time.Minute)
|
||||
order.HandoffDeadlineAt = &deadline
|
||||
}
|
||||
}
|
||||
}
|
||||
if target.RecalculateEnd {
|
||||
durationHours := estimateOrderDurationHours(order.AccountSnapshot)
|
||||
@@ -503,6 +509,13 @@ func (r *Repository) AdminRejectRefund(ctx context.Context, orderID uint64, acti
|
||||
if order.HandoffStatus == handoffStatusCancelled || order.HandoffStatus == handoffStatusRenterConfirmTimeout {
|
||||
order.HandoffStatus = handoffStatusPendingOwner
|
||||
}
|
||||
if !isPlatformHandoffOrder(*order) && !isPlatformSettlementOrder(*order) && order.HandoffDeadlineAt != nil {
|
||||
if timeoutMinutes := autoCompleteHandoffTimeoutMinutesForOrder(tx, *order); timeoutMinutes > 0 {
|
||||
now := time.Now()
|
||||
deadline := now.Add(time.Duration(timeoutMinutes) * time.Minute)
|
||||
order.HandoffDeadlineAt = &deadline
|
||||
}
|
||||
}
|
||||
order.SettlementStatus = settlementStatusUnsettled
|
||||
order.SettledAt = nil
|
||||
reserveListingForOrder(listing)
|
||||
|
||||
Reference in New Issue
Block a user