refactor(back): add withBackAndFragment helper and use on platform_orders index
This commit is contained in:
@@ -92,6 +92,28 @@ class BackUrl
|
||||
return $path . $sep . \Illuminate\Support\Arr::query(['back' => $safeBackForLinks]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 给指定站内相对路径附加安全 back,并可选追加锚点(fragment)。
|
||||
*
|
||||
* 说明:fragment 仅允许 [A-Za-z0-9_-],不符合则直接丢弃 fragment。
|
||||
* 典型用途:列表页行级「去补回执 / 去补退款」等链接,需要跳转到详情页某个区块。
|
||||
*/
|
||||
public static function withBackAndFragment(string $path, string $safeBackForLinks = '', string $fragment = ''): string
|
||||
{
|
||||
$url = self::withBack($path, $safeBackForLinks);
|
||||
|
||||
$fragment = ltrim((string) $fragment, '#');
|
||||
if ($fragment === '') {
|
||||
return $url;
|
||||
}
|
||||
|
||||
if (!preg_match('/^[A-Za-z0-9_-]+$/', $fragment)) {
|
||||
return $url;
|
||||
}
|
||||
|
||||
return $url . '#' . $fragment;
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前路径下的“快捷筛选”链接构造器:
|
||||
* - 仅保留指定上下文键(例如 merchant_id/plan_id/keyword/lead_id 等)
|
||||
|
||||
@@ -1011,7 +1011,7 @@
|
||||
@php
|
||||
$hasReceiptEvidenceRow = (data_get($order->meta, 'payment_summary.total_amount') !== null)
|
||||
|| (data_get($order->meta, 'payment_receipts.0.amount') !== null);
|
||||
$noReceiptFixUrlRow = '/admin/platform-orders/' . $order->id . '?' . \Illuminate\Support\Arr::query(['back' => $selfWithoutBack]) . '#add-payment-receipt';
|
||||
$noReceiptFixUrlRow = \App\Support\BackUrl::withBackAndFragment('/admin/platform-orders/' . $order->id, $selfWithoutBack, 'add-payment-receipt');
|
||||
@endphp
|
||||
@if($order->payment_status === 'paid' && ! $hasReceiptEvidenceRow)
|
||||
<div class="muted text-danger muted-xs row-warn">
|
||||
|
||||
Reference in New Issue
Block a user