refactor(site-subscriptions): ends_at 快捷日期范围由 controller 注入

This commit is contained in:
萝卜
2026-03-17 06:41:15 +08:00
parent 3408b13e44
commit 96f19ecdf2
2 changed files with 15 additions and 3 deletions

View File

@@ -276,9 +276,10 @@
<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">
@php
$endsToday = now()->format('Y-m-d');
$ends7d = now()->addDays(7)->format('Y-m-d');
$ends30d = now()->addDays(30)->format('Y-m-d');
// 到期区间快捷入口:日期范围由 Controller 注入,避免 Blade 内多次 now() 调用导致跨天漂移。
$endsToday = (string) ($endsRangeToday ?? now()->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。
$endsQuickTodayUrl = $safeFullUrlWithQuery(['ends_from' => $endsToday, 'ends_to' => $endsToday, 'page' => null]);