From a1c161b300f52d02f4064033718c05bc25743389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Tue, 17 Mar 2026 11:05:31 +0800 Subject: [PATCH] refactor(platform-orders): compute tool guards once on index --- resources/views/admin/platform_orders/index.blade.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/views/admin/platform_orders/index.blade.php b/resources/views/admin/platform_orders/index.blade.php index 82acf7c..293264c 100644 --- a/resources/views/admin/platform_orders/index.blade.php +++ b/resources/views/admin/platform_orders/index.blade.php @@ -835,6 +835,11 @@ @endif + @php + // 工具治理口径:统一只计算一次,避免多处重复调用 forIndex() 导致口径漂移/维护成本上升。 + $toolGuards = $toolGuards ?? \App\Support\PlatformOrderToolsGuard::forIndex((array) ($filters ?? [])); + @endphp +
导出
@@ -856,7 +861,6 @@
批量同步订阅
@php - $toolGuards = $toolGuards ?? \App\Support\PlatformOrderToolsGuard::forIndex((array) ($filters ?? [])); $batchActivateBlocked = (bool) ($toolGuards['batch_activate_subscriptions']['blocked'] ?? false); $batchActivateBlockedReason = (string) ($toolGuards['batch_activate_subscriptions']['reason'] ?? ''); @endphp @@ -913,7 +917,6 @@
批量标记支付并生效(BMPA)
@php - $toolGuards = $toolGuards ?? \App\Support\PlatformOrderToolsGuard::forIndex((array) ($filters ?? [])); $batchBmpaBlocked = (bool) ($toolGuards['batch_bmpa']['blocked'] ?? false); $batchBmpaBlockedReason = (string) ($toolGuards['batch_bmpa']['reason'] ?? ''); @endphp @@ -970,7 +973,6 @@
批量仅标记为已生效
@php - $toolGuards = $toolGuards ?? \App\Support\PlatformOrderToolsGuard::forIndex((array) ($filters ?? [])); $batchMarkActivatedBlocked = (bool) ($toolGuards['batch_mark_activated']['blocked'] ?? false); $batchMarkActivatedBlockedReason = (string) ($toolGuards['batch_mark_activated']['reason'] ?? ''); @endphp @@ -1029,7 +1031,6 @@
清理失败标记:同步订阅
@php - $toolGuards = $toolGuards ?? \App\Support\PlatformOrderToolsGuard::forIndex((array) ($filters ?? [])); $clearSyncBlocked = (bool) ($toolGuards['clear_sync_errors']['blocked'] ?? false); $clearSyncBlockedReason = (string) ($toolGuards['clear_sync_errors']['reason'] ?? ''); @endphp @@ -1076,7 +1077,6 @@
清理失败标记:批量 BMPA
@php - $toolGuards = $toolGuards ?? \App\Support\PlatformOrderToolsGuard::forIndex((array) ($filters ?? [])); $clearBmpaBlocked = (bool) ($toolGuards['clear_bmpa_errors']['blocked'] ?? false); $clearBmpaBlockedReason = (string) ($toolGuards['clear_bmpa_errors']['reason'] ?? ''); @endphp