优化申诉仲裁流程和证据展示

This commit is contained in:
yml2213
2026-06-13 21:26:38 +08:00
parent 529ad1e433
commit 3ef7705776
22 changed files with 1455 additions and 138 deletions
+18
View File
@@ -75,6 +75,7 @@ func (r *Repository) FindAdmin(ctx context.Context, orderID uint64) (*OrderDTO,
}
dto := row.toAdminDTO()
applyPaymentDeadline(&dto, row.RentalOrder, pendingPaymentTimeoutMinutes(db))
dto.ActiveDispute = r.activeDisputeDTO(ctx, orderID)
dto.Checkout = r.latestCheckoutAdminDTO(ctx, orderID)
return &dto, nil
}
@@ -89,6 +90,7 @@ func (r *Repository) FindForUser(ctx context.Context, userID uint64, orderID uin
}
dto := row.toDTOForUser(userID)
applyPaymentDeadline(&dto, row.RentalOrder, pendingPaymentTimeoutMinutes(db))
dto.ActiveDispute = r.activeDisputeDTO(ctx, orderID)
dto.Checkout = r.latestCheckoutDTOForUser(ctx, orderID, userID, row.RentalOrder)
return &dto, nil
}
@@ -123,6 +125,22 @@ func (r *Repository) latestCheckoutAdminDTO(ctx context.Context, orderID uint64)
return &dto
}
func (r *Repository) activeDisputeDTO(ctx context.Context, orderID uint64) *ActiveDisputeDTO {
var row model.Dispute
if err := r.db.WithContext(ctx).
Where("order_id = ? AND status IN ?", orderID, []string{"open", "processing"}).
Order("id DESC").
First(&row).Error; err != nil {
return nil
}
return &ActiveDisputeDTO{
ID: row.ID,
InitiatorID: row.InitiatorID,
Type: row.Type,
Status: row.Status,
}
}
func shouldAttachCheckout(status string) bool {
switch status {
case orderStatusPendingCheckoutConfirm, orderStatusPendingCheckoutAccept, orderStatusCheckoutDisputing, orderStatusCompleted: