refactor(platform-orders): created_at 快捷日期范围由 controller 注入

This commit is contained in:
萝卜
2026-03-17 06:43:58 +08:00
parent 96f19ecdf2
commit df99fb00ed
2 changed files with 17 additions and 3 deletions

View File

@@ -411,9 +411,10 @@
<input type="date" name="created_to" data-role="po-created-to" placeholder="创建时间到YYYY-MM-DD" value="{{ $filters['created_to'] ?? '' }}" class="w-180">
@php
// 运营提效:常用时间范围快捷入口(保持 query/back 安全口径;不依赖 JS
$today = now()->format('Y-m-d');
$from7d = now()->subDays(6)->format('Y-m-d');
$from30d = now()->subDays(29)->format('Y-m-d');
// 日期范围由 Controller 注入,避免 Blade 内多次 now() 调用跨天漂移。
$today = (string) ($createdRangeToday ?? now()->format('Y-m-d'));
$from7d = (string) ($createdRangeFrom7d ?? now()->subDays(6)->format('Y-m-d'));
$from30d = (string) ($createdRangeFrom30d ?? now()->subDays(29)->format('Y-m-d'));
$createdRangeTodayUrl = $safeFullUrlWithQuery([
'created_from' => $today,