From afd8302c7934517111d21ca1717a45eec561f5ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Wed, 18 Mar 2026 17:02:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E8=AE=A2=E5=8D=95=E5=88=97?= =?UTF-8?q?=E8=A1=A8=20SOP=20=E9=93=BE=E6=8E=A5=E8=A1=A5=E9=BD=90=20data-r?= =?UTF-8?q?ole=20=E4=B8=8E=20back=20=E5=8F=A3=E5=BE=84=E6=8A=A4=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/platform_orders/index.blade.php | 6 +- ...LinksShouldHaveDataRoleAndKeepBackTest.php | 70 +++++++++++++++++++ 2 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 tests/Feature/AdminPlatformOrderIndexSopLinksShouldHaveDataRoleAndKeepBackTest.php diff --git a/resources/views/admin/platform_orders/index.blade.php b/resources/views/admin/platform_orders/index.blade.php index 51efd08..1fb1048 100644 --- a/resources/views/admin/platform_orders/index.blade.php +++ b/resources/views/admin/platform_orders/index.blade.php @@ -761,9 +761,9 @@
建议按以下顺序治理当前筛选集合:
    -
  1. 先处理 对账不一致:优先补齐支付回执,并核对回执渠道/金额,确保回执总额与已付金额一致。
  2. -
  3. 再处理 退款不一致:优先补齐退款回执/核对退款轨迹/修正退款状态(带审计)。
  4. -
  5. 最后处理 可同步:确认无对账/退款异常、无同步失败原因后,再批量同步订阅。
  6. +
  7. 先处理 对账不一致:优先补齐支付回执,并核对回执渠道/金额,确保回执总额与已付金额一致。
  8. +
  9. 再处理 退款不一致:优先补齐退款回执/核对退款轨迹/修正退款状态(带审计)。
  10. +
  11. 最后处理 可同步:确认无对账/退款异常、无同步失败原因后,再批量同步订阅。
说明:本页“批量同步/批量生效/清理失败标记”等工具动作会透传当前筛选条件;建议先缩小到明确集合再操作。
diff --git a/tests/Feature/AdminPlatformOrderIndexSopLinksShouldHaveDataRoleAndKeepBackTest.php b/tests/Feature/AdminPlatformOrderIndexSopLinksShouldHaveDataRoleAndKeepBackTest.php new file mode 100644 index 0000000..3a18c76 --- /dev/null +++ b/tests/Feature/AdminPlatformOrderIndexSopLinksShouldHaveDataRoleAndKeepBackTest.php @@ -0,0 +1,70 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_platform_orders_index_sop_links_should_have_data_role_and_keep_back(): void + { + $this->loginAsPlatformAdmin(); + + $res = $this->get('/admin/platform-orders?merchant_id=1&back=/admin&page=2'); + $res->assertOk(); + + $html = (string) $res->getContent(); + + $cases = [ + [ + 'role' => 'po-sop-link-reconcile-mismatch', + 'expect' => ['reconcile_mismatch' => '1'], + ], + [ + 'role' => 'po-sop-link-refund-inconsistent', + 'expect' => ['refund_inconsistent' => '1'], + ], + [ + 'role' => 'po-sop-link-syncable', + 'expect' => ['syncable_only' => '1', 'sync_status' => 'unsynced'], + ], + ]; + + foreach ($cases as $c) { + $role = (string) ($c['role'] ?? ''); + $this->assertNotSame('', $role); + + $re = '/]*data-role="' . preg_quote($role, '/') . '"[^>]*href="([^"]+)"/u'; + $this->assertMatchesRegularExpression($re, $html); + preg_match($re, $html, $m); + + $rawHref = (string) ($m[1] ?? ''); + $this->assertStringNotContainsString('&back=', $rawHref); + + $href = html_entity_decode($rawHref); + $query = parse_url($href, PHP_URL_QUERY) ?: ''; + parse_str($query, $q); + + foreach (($c['expect'] ?? []) as $k => $v) { + $this->assertSame((string) $v, (string) ($q[$k] ?? ''), $role . ' missing expected ' . $k); + } + + // SOP 链接应保留 back,并清空 page + $this->assertSame('/admin', (string) ($q['back'] ?? '')); + $this->assertArrayNotHasKey('page', $q); + } + } +}