From 1e6e15a4ec2f462c2fc4f3059468268c47b2c2e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Sat, 14 Mar 2026 22:59:17 +0000 Subject: [PATCH] Site subscriptions show: build self filter links via BackUrl::currentPathWithQuery --- .../admin/site_subscriptions/show.blade.php | 29 +++++-------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/resources/views/admin/site_subscriptions/show.blade.php b/resources/views/admin/site_subscriptions/show.blade.php index aced7e0..7fa377f 100644 --- a/resources/views/admin/site_subscriptions/show.blade.php +++ b/resources/views/admin/site_subscriptions/show.blade.php @@ -406,29 +406,14 @@ // 同时:href 中会包含多个 query 参数,必须使用 `{!! !!}` 原样输出,避免 `&` 被转义为 `&`。 // $safeBackForLinks 已在页头统一按 BackUrl::sanitizeForLinks 计算。 - $baseQuery = request()->query(); - unset($baseQuery['order_sync_status']); + // 构造“订阅详情页自身”的筛选链接:统一走 BackUrl::currentPathWithQuery,减少手写拼接与口径漂移。 + // 目标:保留 back(安全过滤后)+ 保留其它 query 上下文 + 覆盖/移除 order_sync_status。 + $makeSelfFilterUrl = function (?string $orderSyncStatus) use ($safeBackForLinks) { + $v = ($orderSyncStatus !== null && $orderSyncStatus !== '') ? $orderSyncStatus : null; - if ($safeBackForLinks !== '') { - $baseQuery['back'] = $safeBackForLinks; - } else { - unset($baseQuery['back']); - } - - $makeSelfFilterUrl = function (?string $orderSyncStatus) use ($subscription, $baseQuery) { - $q = $baseQuery; - if ($orderSyncStatus !== null && $orderSyncStatus !== '') { - $q['order_sync_status'] = $orderSyncStatus; - } else { - unset($q['order_sync_status']); - } - - $url = '/admin/site-subscriptions/' . $subscription->id; - if (count($q) > 0) { - $url .= '?' . \Illuminate\Support\Arr::query($q); - } - - return $url; + return \App\Support\BackUrl::currentPathWithQuery([ + 'order_sync_status' => $v, + ], $safeBackForLinks); }; @endphp