chore(governance): guard clear bmpa errors when filters not bmpa scope

This commit is contained in:
萝卜
2026-03-16 21:30:51 +08:00
parent d3793d062a
commit 968cba3c08

View File

@@ -2156,6 +2156,25 @@ class PlatformOrderController extends Controller
'refund_inconsistent' => (string) $request->input('refund_inconsistent', ''),
];
// 防误操作后端兜底清理“BMPA 失败”标记时,建议先锁定 BMPA 失败集合,避免误清理。
// 说明:列表页 UI 已做按钮禁用,但仍需后端兜底以防绕过 UI 直接 POST。
if ($scope === 'filtered') {
if ((string) ($filters['syncable_only'] ?? '') === '1') {
return redirect()->back()->with('warning', '当前已勾选「只看可同步」该集合与「BMPA失败」治理集合无关请先取消只看可同步或切到 BMPA 失败集合后再清理。');
}
if ((string) ($filters['fail_only'] ?? '') === '1' || trim((string) ($filters['sync_error_keyword'] ?? '')) !== '') {
return redirect()->back()->with('warning', '当前筛选包含「同步失败/失败原因」:该集合用于订阅同步治理,请切到 BMPA 失败集合后再清理 BMPA 失败标记。');
}
$hasBmpaScope = ((string) ($filters['bmpa_failed_only'] ?? '') === '1')
|| (trim((string) ($filters['bmpa_error_keyword'] ?? '')) !== '')
|| ((string) ($filters['batch_mark_paid_and_activate_24h'] ?? '') === '1');
if (! $hasBmpaScope) {
return redirect()->back()->with('warning', '为避免误操作请先筛选「BMPA失败」集合bmpa_failed_only=1 或失败原因关键词,或勾选 batch_mark_paid_and_activate_24h后再执行清理。');
}
}
$query = PlatformOrder::query()
->whereRaw("JSON_EXTRACT(meta, '$.batch_mark_paid_and_activate_error.message') IS NOT NULL");