refactor(governance-ui): align clear sync errors guard with backend scopes

This commit is contained in:
萝卜
2026-03-16 22:44:15 +08:00
parent f6fa80c95c
commit 68735ee914

View File

@@ -120,20 +120,24 @@ class PlatformOrderToolsGuard
*/ */
public static function clearSyncErrorsReason(array $filters): string public static function clearSyncErrorsReason(array $filters): string
{ {
// 口径对齐后端安全阀:清理「同步失败」标记必须在失败治理集合内执行,且不得叠加与失败集合互斥的筛选 // 与后端 clearSyncErrors() 阻断口径对齐:避免运营在互斥集合上误清理
if ((string) ($filters['sync_status'] ?? '') !== 'failed' && (string) ($filters['fail_only'] ?? '') === '') {
return '建议先筛选「同步失败」集合sync_status=failed后再执行清理避免误清理。';
}
if ((string) ($filters['syncable_only'] ?? '') === '1') {
return '当前已勾选「只看可同步」:该集合与「同步失败」互斥。请先取消只看可同步或切到失败集合后再清理。';
}
$syncStatus = (string) ($filters['sync_status'] ?? ''); $syncStatus = (string) ($filters['sync_status'] ?? '');
if ($syncStatus !== '' && $syncStatus !== 'failed') { if ($syncStatus !== '' && $syncStatus !== 'failed') {
return '当前为「清理同步失败标记」动作:若需要筛选同步状态,请使用 sync_status=failed或清空该筛选后再执行。'; return '当前为「清理同步失败标记」动作:若需要筛选同步状态,请使用 sync_status=failed或清空该筛选后再执行。';
} }
if ((string) ($filters['syncable_only'] ?? '') === '1') {
return '当前已勾选「只看可同步」:该集合与「同步失败」互斥,请先取消只看可同步或切到失败集合后再清理。';
}
$hasAnyFailedScope = ($syncStatus === 'failed')
|| ((string) ($filters['fail_only'] ?? '') === '1')
|| (trim((string) ($filters['sync_error_keyword'] ?? '')) !== '');
if (! $hasAnyFailedScope) {
return '建议先筛选「同步失败」集合sync_status=failed / fail_only=1 / 失败原因关键词)后再执行清理,避免误清理。';
}
return ''; return '';
} }