feat(account): 添加批量编辑账户凭据功能并优化 CRS 同步
- 新增批量更新账户凭据接口(account_uuid/org_uuid/intercept_warmup_requests) - 新增前端批量编辑模态框组件 - 优化 CRS 同步逻辑,改进 extra 字段处理 - 优化 CRS 同步 UI,添加更详细的结果展示 - 完善国际化文案(中英文)
This commit is contained in:
@@ -213,6 +213,53 @@ export async function batchCreate(accounts: CreateAccountRequest[]): Promise<{
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch update credentials fields for multiple accounts
|
||||
* @param request - Batch update request containing account IDs, field name, and value
|
||||
* @returns Results of batch update
|
||||
*/
|
||||
export async function batchUpdateCredentials(request: {
|
||||
account_ids: number[];
|
||||
field: string;
|
||||
value: any;
|
||||
}): Promise<{
|
||||
success: number;
|
||||
failed: number;
|
||||
results: Array<{ account_id: number; success: boolean; error?: string }>;
|
||||
}> {
|
||||
const { data} = await apiClient.post<{
|
||||
success: number;
|
||||
failed: number;
|
||||
results: Array<{ account_id: number; success: boolean; error?: string }>;
|
||||
}>('/admin/accounts/batch-update-credentials', request);
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bulk update multiple accounts
|
||||
* @param accountIds - Array of account IDs
|
||||
* @param updates - Fields to update
|
||||
* @returns Success confirmation
|
||||
*/
|
||||
export async function bulkUpdate(
|
||||
accountIds: number[],
|
||||
updates: Record<string, unknown>
|
||||
): Promise<{
|
||||
success: number;
|
||||
failed: number;
|
||||
results: Array<{ account_id: number; success: boolean; error?: string }>;
|
||||
}> {
|
||||
const { data } = await apiClient.post<{
|
||||
success: number;
|
||||
failed: number;
|
||||
results: Array<{ account_id: number; success: boolean; error?: string }>;
|
||||
}>('/admin/accounts/bulk-update', {
|
||||
account_ids: accountIds,
|
||||
updates
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get account today statistics
|
||||
* @param id - Account ID
|
||||
@@ -285,6 +332,8 @@ export const accountsAPI = {
|
||||
generateAuthUrl,
|
||||
exchangeCode,
|
||||
batchCreate,
|
||||
batchUpdateCredentials,
|
||||
bulkUpdate,
|
||||
syncFromCrs,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user