fix(platform-orders): make bmpa_success_only and bmpa_failed_only mutually exclusive
This commit is contained in:
@@ -251,6 +251,17 @@ class PlatformOrderController extends Controller
|
|||||||
// 只看批量“标记支付并生效”成功:存在 run_id 且 error.message 为空
|
// 只看批量“标记支付并生效”成功:存在 run_id 且 error.message 为空
|
||||||
'bmpa_success_only' => (string) $request->query('bmpa_success_only', ''),
|
'bmpa_success_only' => (string) $request->query('bmpa_success_only', ''),
|
||||||
'synced_only' => (string) $request->query('synced_only', ''),
|
'synced_only' => (string) $request->query('synced_only', ''),
|
||||||
|
];
|
||||||
|
|
||||||
|
// 治理口径:bmpa_failed_only 与 bmpa_success_only 互斥(两者同时勾选会导致空集合)。
|
||||||
|
// 优先级:失败优先(更贴近“需要处理”的治理语义)。
|
||||||
|
if (($filters['bmpa_failed_only'] ?? '') === '1') {
|
||||||
|
$filters['bmpa_success_only'] = '';
|
||||||
|
} elseif (($filters['bmpa_success_only'] ?? '') === '1') {
|
||||||
|
$filters['bmpa_failed_only'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$filters += [
|
||||||
'sync_status' => trim((string) $request->query('sync_status', '')),
|
'sync_status' => trim((string) $request->query('sync_status', '')),
|
||||||
'keyword' => trim((string) $request->query('keyword', '')),
|
'keyword' => trim((string) $request->query('keyword', '')),
|
||||||
// 同步失败原因关键词:用于快速定位同原因失败订单(可治理)
|
// 同步失败原因关键词:用于快速定位同原因失败订单(可治理)
|
||||||
@@ -1324,6 +1335,17 @@ class PlatformOrderController extends Controller
|
|||||||
// 只看批量“标记支付并生效”成功:存在 run_id 且 error.message 为空
|
// 只看批量“标记支付并生效”成功:存在 run_id 且 error.message 为空
|
||||||
'bmpa_success_only' => (string) $request->query('bmpa_success_only', ''),
|
'bmpa_success_only' => (string) $request->query('bmpa_success_only', ''),
|
||||||
'synced_only' => (string) $request->query('synced_only', ''),
|
'synced_only' => (string) $request->query('synced_only', ''),
|
||||||
|
];
|
||||||
|
|
||||||
|
// 治理口径:bmpa_failed_only 与 bmpa_success_only 互斥(两者同时勾选会导致空集合)。
|
||||||
|
// 优先级:失败优先(更贴近“需要处理”的治理语义)。
|
||||||
|
if (($filters['bmpa_failed_only'] ?? '') === '1') {
|
||||||
|
$filters['bmpa_success_only'] = '';
|
||||||
|
} elseif (($filters['bmpa_success_only'] ?? '') === '1') {
|
||||||
|
$filters['bmpa_failed_only'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$filters += [
|
||||||
'sync_status' => trim((string) $request->query('sync_status', '')),
|
'sync_status' => trim((string) $request->query('sync_status', '')),
|
||||||
'keyword' => trim((string) $request->query('keyword', '')),
|
'keyword' => trim((string) $request->query('keyword', '')),
|
||||||
// 同步失败原因关键词:用于快速定位同原因失败订单(可治理)
|
// 同步失败原因关键词:用于快速定位同原因失败订单(可治理)
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class AdminPlatformOrderBmpaFailedAndSuccessFiltersShouldBeMutuallyExclusiveTest extends TestCase
|
||||||
|
{
|
||||||
|
use RefreshDatabase;
|
||||||
|
|
||||||
|
protected function loginAsPlatformAdmin(): void
|
||||||
|
{
|
||||||
|
$this->seed();
|
||||||
|
|
||||||
|
$this->post('/admin/login', [
|
||||||
|
'email' => 'platform.admin@demo.local',
|
||||||
|
'password' => 'Platform@123456',
|
||||||
|
])->assertRedirect('/admin');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_platform_orders_bmpa_failed_and_success_filters_should_be_mutually_exclusive(): void
|
||||||
|
{
|
||||||
|
$this->loginAsPlatformAdmin();
|
||||||
|
|
||||||
|
// 同时传 success + failed:Controller 侧应执行互斥清洗(失败优先),避免落入空集合。
|
||||||
|
$html = $this->get('/admin/platform-orders?bmpa_failed_only=1&bmpa_success_only=1')
|
||||||
|
->assertOk()
|
||||||
|
->getContent();
|
||||||
|
|
||||||
|
// UI:success checkbox 不应保持 checked(已被清洗掉)
|
||||||
|
$this->assertStringNotContainsString('name="bmpa_success_only" value="1" checked', $html);
|
||||||
|
|
||||||
|
// UI:failed checkbox 仍应 checked
|
||||||
|
$this->assertStringContainsString('name="bmpa_failed_only" value="1" checked', $html);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user