chore(governance): batch mark activated requires unsynced scope

This commit is contained in:
萝卜
2026-03-16 19:04:40 +08:00
parent 33ab55b10a
commit dbb88f59f6
4 changed files with 12 additions and 2 deletions

View File

@@ -1818,11 +1818,15 @@ class PlatformOrderController extends Controller
'refund_inconsistent' => (string) $request->input('refund_inconsistent', ''),
];
// 防误操作:批量“仅标记为已生效”默认要求当前筛选口径为「已支付 + 待处理(pending)」
// 防误操作:批量“仅标记为已生效”默认要求当前筛选口径为「已支付 + 待处理(pending) + 未同步(unsynced)
if ($scope === 'filtered') {
if (($filters['payment_status'] ?? '') !== 'paid' || ($filters['status'] ?? '') !== 'pending') {
return redirect()->back()->with('warning', '为避免误操作,请先筛选「支付状态=已支付」且「订单状态=待处理」,再执行批量仅标记为已生效。');
}
if (($filters['sync_status'] ?? '') !== 'unsynced') {
return redirect()->back()->with('warning', '为避免把同步失败等异常单混入,请先锁定「同步状态=未同步(sync_status=unsynced)」(建议用快捷筛选「待生效」)再执行批量仅标记为已生效。');
}
}
// 防误操作scope=all 需要二次确认

View File

@@ -87,6 +87,11 @@ class PlatformOrderToolsGuard
return '请先筛选「支付状态=已支付」且「订单状态=待处理」再执行批量生效。';
}
// 待生效口径一致paid + pending + unsynced排除同步失败等异常单避免误把失败单“批量生效”导致治理链路混乱。
if ((string) ($filters['sync_status'] ?? '') !== 'unsynced') {
return '为避免把同步失败等异常单混入,请先锁定「同步状态=未同步(sync_status=unsynced)」(建议用快捷筛选「待生效」)再执行批量生效。';
}
return '';
}

View File

@@ -97,6 +97,7 @@ class AdminPlatformOrderBatchMarkActivatedTest extends TestCase
'scope' => 'filtered',
'payment_status' => 'paid',
'status' => 'pending',
'sync_status' => 'unsynced',
'limit' => 50,
])->assertRedirect();

View File

@@ -156,7 +156,7 @@ class AdminPlatformOrderIndexBatchButtonsShouldEnableWhenFiltersMatchTest extend
'meta' => [],
]);
$res = $this->get('/admin/platform-orders?status=pending&payment_status=paid');
$res = $this->get('/admin/platform-orders?status=pending&payment_status=paid&sync_status=unsynced');
$res->assertOk();
$html = (string) $res->getContent();