From 429c84bfc23c277d4f5d39774614489d77a7db34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Tue, 10 Mar 2026 23:27:05 +0000 Subject: [PATCH] =?UTF-8?q?feat(platform-orders):=20=E6=B8=85=E9=99=A4?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E5=A4=B1=E8=B4=A5=E6=A0=87=E8=AE=B0=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=20YES=20=E7=A1=AE=E8=AE=A4=E6=8A=A4=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Admin/PlatformOrderController.php | 7 ++++++- resources/views/admin/platform_orders/index.blade.php | 9 ++++++++- tests/Feature/AdminPlatformOrderClearSyncErrorsTest.php | 7 +++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Admin/PlatformOrderController.php b/app/Http/Controllers/Admin/PlatformOrderController.php index 555a95a..a424763 100644 --- a/app/Http/Controllers/Admin/PlatformOrderController.php +++ b/app/Http/Controllers/Admin/PlatformOrderController.php @@ -984,10 +984,15 @@ class PlatformOrderController extends Controller $this->ensurePlatformAdmin($request); // 支持两种模式: - // - scope=all(默认):清理所有订单的失败标记 + // - scope=all(默认):清理所有订单的失败标记(需要 confirm=YES) // - scope=filtered:仅清理当前筛选结果命中的订单(更安全) $scope = (string) $request->input('scope', 'all'); + // 防误操作:scope=all 需要二次确认 + if ($scope === 'all' && (string) $request->input('confirm', '') !== 'YES') { + return redirect()->back()->with('warning', '为避免误操作,清除全部失败标记前请在确认框输入 YES。'); + } + $filters = [ 'status' => trim((string) $request->input('status', '')), 'payment_status' => trim((string) $request->input('payment_status', '')), diff --git a/resources/views/admin/platform_orders/index.blade.php b/resources/views/admin/platform_orders/index.blade.php index ae49cdc..94b4398 100644 --- a/resources/views/admin/platform_orders/index.blade.php +++ b/resources/views/admin/platform_orders/index.blade.php @@ -332,9 +332,16 @@ -
+ @csrf + + +
diff --git a/tests/Feature/AdminPlatformOrderClearSyncErrorsTest.php b/tests/Feature/AdminPlatformOrderClearSyncErrorsTest.php index ef21d14..b92bfab 100644 --- a/tests/Feature/AdminPlatformOrderClearSyncErrorsTest.php +++ b/tests/Feature/AdminPlatformOrderClearSyncErrorsTest.php @@ -61,9 +61,16 @@ class AdminPlatformOrderClearSyncErrorsTest extends TestCase ], ]); + // scope=all 需要二次确认 $this->post('/admin/platform-orders/clear-sync-errors', ['scope' => 'all']) ->assertRedirect(); + $order->refresh(); + $this->assertNotEmpty(data_get($order->meta, 'subscription_activation_error.message')); + + $this->post('/admin/platform-orders/clear-sync-errors', ['scope' => 'all', 'confirm' => 'YES']) + ->assertRedirect(); + $order->refresh(); $this->assertEmpty(data_get($order->meta, 'subscription_activation_error')); }