diff --git a/app/Http/Controllers/Admin/PlatformOrderController.php b/app/Http/Controllers/Admin/PlatformOrderController.php
index 38ee768..0d8c858 100644
--- a/app/Http/Controllers/Admin/PlatformOrderController.php
+++ b/app/Http/Controllers/Admin/PlatformOrderController.php
@@ -273,6 +273,9 @@ class PlatformOrderController extends Controller
'refund_inconsistent' => (string) $request->query('refund_inconsistent', ''),
// 线索联动:用于从开通线索跳转查看关联订单
'lead_id' => trim((string) $request->query('lead_id', '')),
+ // 创建时间范围(用于“趋势→集合”跳转与运营筛选)
+ 'created_from' => trim((string) $request->query('created_from', '')),
+ 'created_to' => trim((string) $request->query('created_to', '')),
];
@@ -1235,6 +1238,9 @@ class PlatformOrderController extends Controller
'refund_inconsistent' => (string) $request->query('refund_inconsistent', ''),
// 线索联动:用于从开通线索跳转查看关联订单
'lead_id' => trim((string) $request->query('lead_id', '')),
+ // 创建时间范围(用于“趋势→集合”跳转与运营筛选)
+ 'created_from' => trim((string) $request->query('created_from', '')),
+ 'created_to' => trim((string) $request->query('created_to', '')),
];
@@ -2404,6 +2410,32 @@ class PlatformOrderController extends Controller
} else {
$builder->whereRaw("CAST(JSON_UNQUOTE(JSON_EXTRACT(meta, '$.platform_lead_id')) AS UNSIGNED) = ?", [$leadId]);
}
+ })
+ ->when(($filters['created_from'] ?? '') !== '' || ($filters['created_to'] ?? '') !== '', function (Builder $builder) use ($filters) {
+ // 创建时间范围筛选:用于“趋势→集合”跳转与运营快速定位
+ // 口径:基于 created_at。
+ $from = trim((string) ($filters['created_from'] ?? ''));
+ $to = trim((string) ($filters['created_to'] ?? ''));
+
+ // 容错:仅接受 YYYY-MM-DD 格式;不合法则忽略,避免异常输入污染查询
+ if ($from !== '' && ! preg_match('/^\d{4}-\d{2}-\d{2}$/', $from)) {
+ $from = '';
+ }
+ if ($to !== '' && ! preg_match('/^\d{4}-\d{2}-\d{2}$/', $to)) {
+ $to = '';
+ }
+
+ if ($from !== '' && $to !== '') {
+ // [from 00:00:00, to 23:59:59]
+ $builder->whereBetween('created_at', [
+ $from . ' 00:00:00',
+ $to . ' 23:59:59',
+ ]);
+ } elseif ($from !== '') {
+ $builder->where('created_at', '>=', $from . ' 00:00:00');
+ } elseif ($to !== '') {
+ $builder->where('created_at', '<=', $to . ' 23:59:59');
+ }
});
}
diff --git a/resources/views/admin/platform_orders/index.blade.php b/resources/views/admin/platform_orders/index.blade.php
index 5e9b970..0dd2ac9 100644
--- a/resources/views/admin/platform_orders/index.blade.php
+++ b/resources/views/admin/platform_orders/index.blade.php
@@ -249,13 +249,13 @@
@php
- // 快捷筛选:尽量保留当前筛选上下文(站点/套餐/订阅ID/keyword/lead_id/back 等),仅覆盖目标筛选字段,并清空 page。
+ // 快捷筛选:尽量保留当前筛选上下文(站点/套餐/订阅ID/keyword/lead_id/back/时间范围等),仅覆盖目标筛选字段,并清空 page。
// 注意:不保留 syncable_only/fail_only 等“工具型开关”,避免用户从一个集合切到另一个集合时被残留开关影响(导致误判/空结果)。
$buildQuickFilterUrl = function (array $overrides) use ($safeBackForLinks) {
- // 快捷筛选:仅保留上下文字段(站点/套餐/订阅ID/keyword/lead_id/安全 back),避免把其它筛选条件叠加导致空结果。
+ // 快捷筛选:仅保留上下文字段(站点/套餐/订阅ID/keyword/lead_id/时间范围/安全 back),避免把其它筛选条件叠加导致空结果。
// 该构造器内部会强制清空 page,并且不会继承 syncable_only/fail_only 等“工具型开关”。
return \App\Support\BackUrl::currentPathQuickFilter(
- ['merchant_id', 'plan_id', 'site_subscription_id', 'keyword', 'lead_id'],
+ ['merchant_id', 'plan_id', 'site_subscription_id', 'keyword', 'lead_id', 'created_from', 'created_to'],
$overrides,
$safeBackForLinks
);
@@ -349,6 +349,8 @@
+
+