feat(weibo): 展示 CK 导入重复账号明细
This commit is contained in:
@@ -777,12 +777,20 @@ export interface WeiboImportError {
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface WeiboImportDuplicate {
|
||||
line: number;
|
||||
uid: string;
|
||||
nickname: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface WeiboImportResult {
|
||||
success: boolean;
|
||||
message: string;
|
||||
count: number;
|
||||
skipped: number;
|
||||
errors: WeiboImportError[];
|
||||
duplicates: WeiboImportDuplicate[];
|
||||
accounts: WeiboAccountItem[];
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ import {
|
||||
type WeiboBindQrResult,
|
||||
type WeiboExchangeRecordsResult,
|
||||
type WeiboImportError,
|
||||
type WeiboImportDuplicate,
|
||||
type WeiboMallListResult,
|
||||
type WeiboPaymentStatusResult,
|
||||
type WeiboPointHistoryResult,
|
||||
@@ -212,6 +213,9 @@ export default function WeiboAccountsPage({
|
||||
const [importOpen, setImportOpen] = useState(false);
|
||||
const [importing, setImporting] = useState(false);
|
||||
const [importErrors, setImportErrors] = useState<WeiboImportError[]>([]);
|
||||
const [importDuplicates, setImportDuplicates] = useState<
|
||||
WeiboImportDuplicate[]
|
||||
>([]);
|
||||
const [form] = Form.useForm<{
|
||||
text: string;
|
||||
tag?: string;
|
||||
@@ -327,6 +331,7 @@ export default function WeiboAccountsPage({
|
||||
Boolean(values.update_existing),
|
||||
);
|
||||
setImportErrors(result.errors);
|
||||
setImportDuplicates(result.duplicates);
|
||||
let workbenchError = '';
|
||||
if (isWorkbench && result.accounts.length > 0) {
|
||||
try {
|
||||
@@ -1722,6 +1727,7 @@ export default function WeiboAccountsPage({
|
||||
disabled={!canImport}
|
||||
onClick={() => {
|
||||
setImportErrors([]);
|
||||
setImportDuplicates([]);
|
||||
form.resetFields();
|
||||
form.setFieldsValue({ update_existing: false });
|
||||
setImportOpen(true);
|
||||
@@ -2753,6 +2759,26 @@ export default function WeiboAccountsPage({
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{importDuplicates.length > 0 && (
|
||||
<Alert
|
||||
type="info"
|
||||
showIcon
|
||||
style={{ marginTop: importErrors.length > 0 ? 12 : 0 }}
|
||||
title={`${importDuplicates.length} 条重复账号已跳过`}
|
||||
description={
|
||||
<div style={{ maxHeight: 220, overflowY: 'auto' }}>
|
||||
{importDuplicates.map((item) => (
|
||||
<div key={`${item.line}-${item.uid}`}>
|
||||
<Text style={{ fontSize: 12 }}>
|
||||
第 {item.line} 行 · UID {item.uid} ·{' '}
|
||||
{item.nickname || '无昵称'}:{item.message}
|
||||
</Text>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
|
||||
Reference in New Issue
Block a user