fix: use i18n for mixed-channel warning messages and improve bulk pre-check

- BulkUpdate handler: add structured details to 409 response
- BulkUpdateAccounts: simplify to global pre-check before any DB write;
  remove per-account snapshot tracking which is no longer needed
- MixedChannelError.Error(): restore English message for API compatibility
- BulkEditAccountModal: use t() with details for both pre-check and 409
  fallback paths instead of displaying raw backend strings
- Update test to verify pre-check blocks on existing group conflicts
This commit is contained in:
erio
2026-03-01 14:39:07 +08:00
parent b67bf2227e
commit 3a04552f98
4 changed files with 36 additions and 33 deletions

View File

@@ -1283,7 +1283,11 @@ const preCheckMixedChannelRisk = async (built: Record<string, unknown>): Promise
if (!result.has_risk) return true
pendingUpdatesForConfirm.value = built
mixedChannelWarningMessage.value = result.message || t('admin.accounts.bulkEdit.failed')
mixedChannelWarningMessage.value = t('admin.accounts.mixedChannelWarning', {
groupName: result.details?.group_name,
currentPlatform: result.details?.current_platform,
otherPlatform: result.details?.other_platform
})
showMixedChannelWarning.value = true
return false
} catch (error: any) {
@@ -1358,7 +1362,11 @@ const submitBulkUpdate = async (baseUpdates: Record<string, unknown>) => {
// 兜底:多平台混合场景下,预检查跳过,由后端 409 触发确认框
if (error.status === 409 && error.error === 'mixed_channel_warning') {
pendingUpdatesForConfirm.value = baseUpdates
mixedChannelWarningMessage.value = error.message
mixedChannelWarningMessage.value = t('admin.accounts.mixedChannelWarning', {
groupName: error.details?.group_name,
currentPlatform: error.details?.current_platform,
otherPlatform: error.details?.other_platform
})
showMixedChannelWarning.value = true
} else {
appStore.showError(error.message || t('admin.accounts.bulkEdit.failed'))