From 2e05adf801a9be2b1b9e3f79e5b968672dd31c3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Fri, 13 Mar 2026 14:13:02 +0000 Subject: [PATCH] platform orders: add batch bmpa 24h filter --- .../Admin/PlatformOrderController.php | 17 ++++ .../admin/platform_orders/index.blade.php | 4 + ...rBatchMarkPaidAndActivate24hFilterTest.php | 96 +++++++++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 tests/Feature/AdminPlatformOrderBatchMarkPaidAndActivate24hFilterTest.php diff --git a/app/Http/Controllers/Admin/PlatformOrderController.php b/app/Http/Controllers/Admin/PlatformOrderController.php index 5d6a889..7113580 100644 --- a/app/Http/Controllers/Admin/PlatformOrderController.php +++ b/app/Http/Controllers/Admin/PlatformOrderController.php @@ -151,6 +151,8 @@ class PlatformOrderController extends Controller 'syncable_only' => (string) $request->query('syncable_only', ''), // 只看最近 24 小时批量同步过的订单(可治理追踪) 'batch_synced_24h' => (string) $request->query('batch_synced_24h', ''), + // 只看最近 24 小时批量“标记支付并生效(BMPA)”过的订单(可治理追踪) + 'batch_mark_paid_and_activate_24h' => (string) $request->query('batch_mark_paid_and_activate_24h', ''), // 只看最近 24 小时批量“仅标记为已生效”过的订单(可治理追踪) 'batch_mark_activated_24h' => (string) $request->query('batch_mark_activated_24h', ''), // 只看“对账不一致”的订单(粗版):meta.payment_summary.total_amount 与 paid_amount 不一致 @@ -852,6 +854,8 @@ class PlatformOrderController extends Controller 'syncable_only' => (string) $request->query('syncable_only', ''), // 只看最近 24 小时批量同步过的订单(可治理追踪) 'batch_synced_24h' => (string) $request->query('batch_synced_24h', ''), + // 只看最近 24 小时批量“标记支付并生效(BMPA)”过的订单(可治理追踪) + 'batch_mark_paid_and_activate_24h' => (string) $request->query('batch_mark_paid_and_activate_24h', ''), // 只看最近 24 小时批量“仅标记为已生效”过的订单(可治理追踪) 'batch_mark_activated_24h' => (string) $request->query('batch_mark_activated_24h', ''), // 只看“对账不一致”的订单(粗版):meta.payment_summary.total_amount 与 paid_amount 不一致 @@ -1744,6 +1748,19 @@ class PlatformOrderController extends Controller $builder->whereRaw("JSON_UNQUOTE(JSON_EXTRACT(meta, '$.batch_activation.at')) >= ?", [$since]); } }) + ->when(($filters['batch_mark_paid_and_activate_24h'] ?? '') !== '', function (Builder $builder) { + // 只看最近 24 小时批量“标记支付并生效(BMPA)”过的订单(基于 meta.batch_mark_paid_and_activate.at) + $since = now()->subHours(24)->format('Y-m-d H:i:s'); + + $builder->whereRaw("JSON_EXTRACT(meta, '$.batch_mark_paid_and_activate.at') IS NOT NULL"); + + $driver = $builder->getQuery()->getConnection()->getDriverName(); + if ($driver === 'sqlite') { + $builder->whereRaw("JSON_EXTRACT(meta, '$.batch_mark_paid_and_activate.at') >= ?", [$since]); + } else { + $builder->whereRaw("JSON_UNQUOTE(JSON_EXTRACT(meta, '$.batch_mark_paid_and_activate.at')) >= ?", [$since]); + } + }) ->when(($filters['batch_mark_activated_24h'] ?? '') !== '', function (Builder $builder) { // 只看最近 24 小时批量“仅标记为已生效”过的订单(基于 meta.batch_mark_activated.at) $since = now()->subHours(24)->format('Y-m-d H:i:s'); diff --git a/resources/views/admin/platform_orders/index.blade.php b/resources/views/admin/platform_orders/index.blade.php index 17927ae..5b850f9 100644 --- a/resources/views/admin/platform_orders/index.blade.php +++ b/resources/views/admin/platform_orders/index.blade.php @@ -113,6 +113,10 @@ 最近24小时批量同步过 +