后端优化修复问题

This commit is contained in:
super
2026-06-18 18:53:16 +08:00
parent 021b0c618b
commit 0ecf5cd45a
44 changed files with 4275 additions and 81 deletions

View File

@@ -1485,6 +1485,180 @@ export function deleteQueryAsinHistory(resultId: number) {
);
}
// ========== 取款 ==========
export type WithdrawCandidateVo = QueryAsinCandidateVo;
export type WithdrawDashboardVo = QueryAsinDashboardVo;
export type WithdrawShopQueueItem = ProductRiskShopQueueItem;
export type WithdrawStatusCode =
| "ZERO_AVAILABLE"
| "SUCCESS"
| "BALANCE_FORBIDDEN"
| "NEGATIVE_WITHDRAW_BLANK";
export interface WithdrawRow {
country?: string;
shopAmount?: number | string | null;
withdrawAmount?: number | string | null;
status?: WithdrawStatusCode | string;
}
export interface WithdrawTaskItem {
shopName: string;
matched: boolean;
shopId?: string;
platform?: string;
companyName?: string;
matchStatus?: string;
matchMessage?: string;
}
export interface WithdrawHistoryItem extends WithdrawTaskItem {
resultId?: number;
taskId?: number;
taskStatus?: string;
reservedAmount?: number | string | null;
success?: boolean;
error?: string;
outputFilename?: string;
downloadUrl?: string;
fileJobId?: number;
fileStatus?: string;
fileError?: string;
fileReady?: boolean;
createdAt?: string;
finishedAt?: string;
rows?: WithdrawRow[];
shops?: WithdrawHistoryItem[];
}
export interface WithdrawHistoryVo {
items: WithdrawHistoryItem[];
}
export interface WithdrawTaskBatchVo {
items: WithdrawHistoryItem[];
missingTaskIds: number[];
}
export interface WithdrawCreateTaskVo {
taskId: number;
items: WithdrawHistoryItem[];
}
export function listWithdrawCandidates() {
return unwrapJavaResponse(
get<JavaApiResponse<WithdrawCandidateVo[]>>(`${JAVA_API_PREFIX}/withdraw/candidates`, {
params: { user_id: getCurrentUserId() },
}),
);
}
export function addWithdrawCandidate(shopName: string) {
return unwrapJavaResponse(
post<JavaApiResponse<WithdrawCandidateVo>, { user_id: number; shop_name: string }>(
`${JAVA_API_PREFIX}/withdraw/candidates`,
{ user_id: getCurrentUserId(), shop_name: shopName },
),
);
}
export function deleteWithdrawCandidate(id: number) {
return unwrapJavaResponse(
del<JavaApiResponse<null>>(`${JAVA_API_PREFIX}/withdraw/candidates/${id}`, {
params: { user_id: getCurrentUserId() },
}),
);
}
export function clearWithdrawCandidates(shopNames: string[]) {
return unwrapJavaResponse(
post<JavaApiResponse<null>, { user_id: number; shop_names: string[] }>(
`${JAVA_API_PREFIX}/withdraw/candidates/clear`,
{ user_id: getCurrentUserId(), shop_names: shopNames },
),
);
}
export function matchWithdrawShops(shopNames: string[]) {
return unwrapJavaResponse(
post<JavaApiResponse<ProductRiskMatchShopsVo>, { user_id: number; shop_names: string[] }>(
`${JAVA_API_PREFIX}/withdraw/match-shops`,
{ user_id: getCurrentUserId(), shop_names: shopNames },
),
);
}
export function getWithdrawDashboard() {
return unwrapJavaResponse(
get<JavaApiResponse<WithdrawDashboardVo>>(`${JAVA_API_PREFIX}/withdraw/dashboard`, {
params: { user_id: getCurrentUserId() },
}),
);
}
export function getWithdrawHistory() {
return unwrapJavaResponse(
get<JavaApiResponse<WithdrawHistoryVo>>(`${JAVA_API_PREFIX}/withdraw/history`, {
params: { user_id: getCurrentUserId() },
}),
);
}
export function getWithdrawTaskProgressBatch(taskIds: number[]) {
return postTaskProgressBatch<WithdrawTaskBatchVo>(
`${JAVA_API_PREFIX}/withdraw/tasks/progress/batch`,
taskIds,
);
}
export function createWithdrawTask(items: WithdrawTaskItem[], reservedAmount: number | string | null) {
return unwrapJavaResponse(
post<JavaApiResponse<WithdrawCreateTaskVo>, { user_id: number; reserved_amount: number | string | null; items: WithdrawTaskItem[] }>(
`${JAVA_API_PREFIX}/withdraw/tasks`,
{ user_id: getCurrentUserId(), reserved_amount: reservedAmount, items },
),
);
}
export function submitWithdrawTaskResult(
taskId: number,
payload: {
shops: Array<{
shopName: string;
error?: string;
rows?: WithdrawRow[];
shopDone?: boolean;
submissionId?: string;
}>;
},
) {
return unwrapJavaResponse(
post<JavaApiResponse<null>, typeof payload>(`${JAVA_API_PREFIX}/withdraw/tasks/${taskId}/result`, payload),
);
}
export function getWithdrawResultDownloadUrl(resultId: number) {
return getJavaDownloadUrl(`/withdraw/results/${resultId}/download`);
}
export function deleteWithdrawTask(taskId: number) {
return unwrapJavaResponse(
del<JavaApiResponse<null>>(`${JAVA_API_PREFIX}/withdraw/tasks/${taskId}`, {
params: { user_id: getCurrentUserId() },
}),
);
}
export function deleteWithdrawHistory(resultId: number) {
return unwrapJavaResponse(
del<JavaApiResponse<null>>(`${JAVA_API_PREFIX}/withdraw/history/${resultId}`, {
params: { user_id: getCurrentUserId() },
}),
);
}
// ========== 外观专利检测 ==========
export interface AppearancePatentParsedRow {
@@ -2235,6 +2409,27 @@ export function getTaskSkipPriceAsinsPaginated(
);
}
export function checkTaskSkipPriceAsin(taskId: number, country: string, asin: string) {
return unwrapJavaResponse(
get<JavaApiResponse<SkipPriceAsinCheckVo>>(
`${JAVA_API_PREFIX}/price-track/tasks/${taskId}/skip-asin/check`,
{
params: {
country,
asin,
},
},
),
);
}
export interface SkipPriceAsinCheckVo {
country: string;
asin: string;
exists: boolean;
minimumPrice?: string;
}
export interface SkipPriceAsinPageVo {
page: number;
pageSize: number;