refactor(site-subscriptions): ends_at 快捷日期范围由 controller 注入
This commit is contained in:
@@ -386,6 +386,12 @@ class SiteSubscriptionController extends Controller
|
|||||||
->all();
|
->all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ends_at 快捷入口日期范围:由 Controller 统一注入,避免 Blade 内多次 now() 调用跨天漂移。
|
||||||
|
$baseToday = now();
|
||||||
|
$endsRangeToday = $baseToday->format('Y-m-d');
|
||||||
|
$endsRange7d = $baseToday->copy()->addDays(7)->format('Y-m-d');
|
||||||
|
$endsRange30d = $baseToday->copy()->addDays(30)->format('Y-m-d');
|
||||||
|
|
||||||
return view('admin.site_subscriptions.index', [
|
return view('admin.site_subscriptions.index', [
|
||||||
'subscriptions' => $subscriptions,
|
'subscriptions' => $subscriptions,
|
||||||
'filters' => $filters,
|
'filters' => $filters,
|
||||||
@@ -413,6 +419,11 @@ class SiteSubscriptionController extends Controller
|
|||||||
],
|
],
|
||||||
'expiryMerchantRows' => $expiryMerchantRows,
|
'expiryMerchantRows' => $expiryMerchantRows,
|
||||||
'expiryMerchantPlanRows' => $expiryMerchantPlanRows,
|
'expiryMerchantPlanRows' => $expiryMerchantPlanRows,
|
||||||
|
|
||||||
|
// ends_at 快捷入口日期范围
|
||||||
|
'endsRangeToday' => $endsRangeToday,
|
||||||
|
'endsRange7d' => $endsRange7d,
|
||||||
|
'endsRange30d' => $endsRange30d,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -276,9 +276,10 @@
|
|||||||
<input type="date" name="ends_from" data-role="sub-ends-from" placeholder="到期时间从" value="{{ $filters['ends_from'] ?? '' }}" class="w-180">
|
<input type="date" name="ends_from" data-role="sub-ends-from" placeholder="到期时间从" value="{{ $filters['ends_from'] ?? '' }}" class="w-180">
|
||||||
<div class="muted muted-xs mt-6">
|
<div class="muted muted-xs mt-6">
|
||||||
@php
|
@php
|
||||||
$endsToday = now()->format('Y-m-d');
|
// 到期区间快捷入口:日期范围由 Controller 注入,避免 Blade 内多次 now() 调用导致跨天漂移。
|
||||||
$ends7d = now()->addDays(7)->format('Y-m-d');
|
$endsToday = (string) ($endsRangeToday ?? now()->format('Y-m-d'));
|
||||||
$ends30d = now()->addDays(30)->format('Y-m-d');
|
$ends7d = (string) ($endsRange7d ?? now()->addDays(7)->format('Y-m-d'));
|
||||||
|
$ends30d = (string) ($endsRange30d ?? now()->addDays(30)->format('Y-m-d'));
|
||||||
|
|
||||||
// 到期区间快捷入口:应保留当前筛选上下文(status/expiry/merchant/plan/keyword/back),仅覆盖 ends_from/ends_to,并清空 page。
|
// 到期区间快捷入口:应保留当前筛选上下文(status/expiry/merchant/plan/keyword/back),仅覆盖 ends_from/ends_to,并清空 page。
|
||||||
$endsQuickTodayUrl = $safeFullUrlWithQuery(['ends_from' => $endsToday, 'ends_to' => $endsToday, 'page' => null]);
|
$endsQuickTodayUrl = $safeFullUrlWithQuery(['ends_from' => $endsToday, 'ends_to' => $endsToday, 'page' => null]);
|
||||||
|
|||||||
Reference in New Issue
Block a user