refactor(web): 删除前端空转链路(任务中心/草稿/attempt/运营工作台/素材面板)
- 删页面目录 tasks/ drafts/ attempts/ creator/workbench/ - 竞品页移除素材处理 Drawer 与素材操作 - metadata 菜单与页头规则同步收敛 - api.ts/listQuery.ts 移除对应 resource 与函数 - 固定表头测试文件清单同步
This commit is contained in:
+1
-33
@@ -6,10 +6,6 @@ export const resourcePaths = {
|
||||
browsers: '/browsers',
|
||||
gateways: '/gateways',
|
||||
accounts: '/phase-a/accounts',
|
||||
drafts: '/phase-a/drafts',
|
||||
confirmations: '/phase-a/confirmations',
|
||||
tasks: '/phase-a/tasks',
|
||||
attempts: '/phase-a/attempts',
|
||||
'network-exits': '/network-exits',
|
||||
'creator-accounts': '/creator/accounts',
|
||||
'creator-competitors': '/creator/competitors',
|
||||
@@ -18,27 +14,17 @@ export const resourcePaths = {
|
||||
'creator-comments': '/creator/comments',
|
||||
'creator-leads': '/creator/leads',
|
||||
'creator-rules': '/creator/rules',
|
||||
'creator-operations': '/creator/operations',
|
||||
'creator-conversations': '/creator/conversations',
|
||||
'creator-events': '/creator/events',
|
||||
'creator-listeners': '/creator/listeners',
|
||||
} as const;
|
||||
|
||||
export type Resource = keyof typeof resourcePaths;
|
||||
|
||||
// 与归档版 filterKeys 一致:资源 → 允许透传的查询字段。
|
||||
const filterKeys: Partial<Record<Resource, string[]>> = {
|
||||
drafts: ['account_id'],
|
||||
confirmations: ['draft_id'],
|
||||
tasks: ['account_id', 'draft_id', 'state'],
|
||||
'creator-competitors': ['platform'],
|
||||
'creator-competitor-share-jobs': ['platform', 'status'],
|
||||
'creator-works': ['platform', 'source_id', 'source_type', 'published_at_status', 'published_after', 'published_before', 'min_likes', 'min_comments', 'min_shares', 'growth_hours', 'min_likes_growth'],
|
||||
'creator-comments': ['platform', 'work_id'],
|
||||
'creator-leads': ['platform'],
|
||||
'creator-operations': ['account_id'],
|
||||
'creator-conversations': ['account_id'],
|
||||
'creator-events': ['account_id'],
|
||||
};
|
||||
|
||||
export interface ListParams {
|
||||
@@ -70,7 +56,7 @@ export async function getList<T = any>({ resource, page, pageSize, filters = {}
|
||||
};
|
||||
}
|
||||
|
||||
const GETONE_ALLOWED: Resource[] = ['accounts', 'network-exits', 'browsers', 'drafts', 'confirmations', 'tasks', 'attempts', 'creator-accounts', 'creator-competitors', 'creator-competitor-share-jobs', 'creator-works', 'creator-comments', 'creator-rules', 'creator-operations'];
|
||||
const GETONE_ALLOWED: Resource[] = ['accounts', 'network-exits', 'browsers', 'creator-accounts', 'creator-competitors', 'creator-competitor-share-jobs', 'creator-works', 'creator-comments', 'creator-rules'];
|
||||
|
||||
export async function getOne<T = any>(resource: Resource, id: string | number): Promise<T> {
|
||||
if (!GETONE_ALLOWED.includes(resource)) throw new Error(`${resource} 不支持 getOne`);
|
||||
@@ -109,24 +95,6 @@ export async function accountAction(id: string, action: 'pause' | 'resume'): Pro
|
||||
await request(`/phase-a/accounts/${encodeURIComponent(id)}/${action}`, { method: 'POST' });
|
||||
}
|
||||
|
||||
export function createDraft(accountID: string, content: string) {
|
||||
return request('/phase-a/drafts', jsonOptions('POST', { account_id: accountID, content }));
|
||||
}
|
||||
|
||||
export function confirmDraft(draftID: string, accountVersion: number, draftVersion: number) {
|
||||
return request('/phase-a/confirmations', jsonOptions('POST', { draft_id: draftID, account_version: accountVersion, draft_version: draftVersion }));
|
||||
}
|
||||
|
||||
export function enqueueConfirmation(confirmationID: string) {
|
||||
return request('/phase-a/tasks', jsonOptions('POST', { confirmation_id: confirmationID }));
|
||||
}
|
||||
|
||||
export async function taskAction(id: string, action: 'verify' | 'resume' | 'finish' | 'cancel', data?: unknown): Promise<void> {
|
||||
if (!['verify', 'resume', 'finish', 'cancel'].includes(action)) throw new Error(`未知任务操作: ${action}`);
|
||||
const options = data ? jsonOptions('POST', data) : { method: 'POST' };
|
||||
await request(`/phase-a/tasks/${encodeURIComponent(id)}/${action}`, options);
|
||||
}
|
||||
|
||||
export async function networkExitAction(id: string, action: 'check' | 'disable' | 'enable'): Promise<any> {
|
||||
if (!['check', 'disable', 'enable'].includes(action)) throw new Error(`未知网络出口操作: ${action}`);
|
||||
return request(`/network-exits/${encodeURIComponent(id)}/${action}`, { method: 'POST' });
|
||||
|
||||
Reference in New Issue
Block a user