提交任务更新
This commit is contained in:
@@ -916,6 +916,181 @@ export function getShopMatchResultDownloadUrl(resultId: number) {
|
||||
return getJavaDownloadUrl(`/shop-match/results/${resultId}/download`);
|
||||
}
|
||||
|
||||
// ========== 跟价 ==========
|
||||
|
||||
export interface PriceTrackCandidateVo {
|
||||
id: number;
|
||||
shopName: string;
|
||||
}
|
||||
|
||||
export interface PriceTrackShopQueueItem {
|
||||
shopName?: string;
|
||||
shopId?: number | string | null;
|
||||
matched?: boolean;
|
||||
matchStatus?: string;
|
||||
matchMessage?: string;
|
||||
platform?: string;
|
||||
companyName?: string;
|
||||
}
|
||||
|
||||
export interface PriceTrackMatchShopsVo {
|
||||
items: PriceTrackShopQueueItem[];
|
||||
}
|
||||
|
||||
export interface PriceTrackCountryPreferenceVo {
|
||||
userId: number;
|
||||
countryCodes: string[];
|
||||
}
|
||||
|
||||
export interface PriceTrackDashboardVo {
|
||||
candidateCount: number;
|
||||
processedTaskCount: number;
|
||||
successTaskCount: number;
|
||||
failedTaskCount: number;
|
||||
}
|
||||
|
||||
export interface PriceTrackHistoryItem {
|
||||
resultId?: number;
|
||||
taskId?: number;
|
||||
shopName?: string;
|
||||
shopId?: number | string | null;
|
||||
platform?: string;
|
||||
companyName?: string;
|
||||
matched?: boolean;
|
||||
matchStatus?: string;
|
||||
matchMessage?: string;
|
||||
taskStatus?: string;
|
||||
outputFilename?: string;
|
||||
downloadUrl?: string;
|
||||
error?: string;
|
||||
success?: boolean;
|
||||
}
|
||||
|
||||
export interface PriceTrackHistoryVo {
|
||||
items: PriceTrackHistoryItem[];
|
||||
}
|
||||
|
||||
export interface PriceTrackCreateTaskVo {
|
||||
taskId: number;
|
||||
items: PriceTrackShopQueueItem[];
|
||||
}
|
||||
|
||||
export function listPriceTrackCandidates() {
|
||||
return unwrapJavaResponse(
|
||||
get<JavaApiResponse<PriceTrackCandidateVo[]>>(
|
||||
`${JAVA_API_PREFIX}/price-track/candidates?user_id=${encodeURIComponent(String(getCurrentUserId()))}`,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function addPriceTrackCandidate(shopName: string) {
|
||||
return unwrapJavaResponse(
|
||||
post<JavaApiResponse<PriceTrackCandidateVo>, { user_id: number; shopName: string }>(
|
||||
`${JAVA_API_PREFIX}/price-track/candidates`,
|
||||
{ user_id: getCurrentUserId(), shopName },
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function deletePriceTrackCandidate(id: number) {
|
||||
return unwrapJavaResponse(
|
||||
del<JavaApiResponse<null>>(
|
||||
`${JAVA_API_PREFIX}/price-track/candidates/${id}?user_id=${encodeURIComponent(String(getCurrentUserId()))}`,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function getPriceTrackCountryPreference() {
|
||||
return unwrapJavaResponse(
|
||||
get<JavaApiResponse<PriceTrackCountryPreferenceVo>>(
|
||||
`${JAVA_API_PREFIX}/price-track/country-preference?user_id=${encodeURIComponent(String(getCurrentUserId()))}`,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function putPriceTrackCountryPreference(countryCodes: string[]) {
|
||||
return unwrapJavaResponse(
|
||||
put<JavaApiResponse<PriceTrackCountryPreferenceVo>, { user_id: number; countryCodes: string[] }>(
|
||||
`${JAVA_API_PREFIX}/price-track/country-preference`,
|
||||
{ user_id: getCurrentUserId(), countryCodes },
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function matchPriceTrackShops(shopNames: string[]) {
|
||||
return unwrapJavaResponse(
|
||||
post<JavaApiResponse<PriceTrackMatchShopsVo>, { user_id: number; shopNames: string[] }>(
|
||||
`${JAVA_API_PREFIX}/price-track/match-shops`,
|
||||
{ user_id: getCurrentUserId(), shopNames },
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function getPriceTrackDashboard() {
|
||||
return unwrapJavaResponse(
|
||||
get<JavaApiResponse<PriceTrackDashboardVo>>(
|
||||
`${JAVA_API_PREFIX}/price-track/dashboard?user_id=${encodeURIComponent(String(getCurrentUserId()))}`,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function getPriceTrackHistory() {
|
||||
return unwrapJavaResponse(
|
||||
get<JavaApiResponse<PriceTrackHistoryVo>>(
|
||||
`${JAVA_API_PREFIX}/price-track/history?user_id=${encodeURIComponent(String(getCurrentUserId()))}`,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function deletePriceTrackHistory(resultId: number) {
|
||||
return unwrapJavaResponse(
|
||||
del<JavaApiResponse<null>>(
|
||||
`${JAVA_API_PREFIX}/price-track/history/${resultId}?user_id=${encodeURIComponent(String(getCurrentUserId()))}`,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export interface PriceTrackCreateTaskRequest {
|
||||
userId: number;
|
||||
statusMode: boolean;
|
||||
asinMode: boolean;
|
||||
items: PriceTrackShopQueueItem[];
|
||||
asinFiles: string[];
|
||||
countryCodes: string[];
|
||||
minPrice?: number;
|
||||
maxPrice?: number;
|
||||
priceDiffPercent?: number;
|
||||
}
|
||||
|
||||
export function createPriceTrackTask(request: PriceTrackCreateTaskRequest) {
|
||||
return unwrapJavaResponse(
|
||||
post<JavaApiResponse<PriceTrackCreateTaskVo>, PriceTrackCreateTaskRequest>(
|
||||
`${JAVA_API_PREFIX}/price-track/tasks`,
|
||||
{ ...request, user_id: getCurrentUserId() },
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function deletePriceTrackTask(taskId: number) {
|
||||
return unwrapJavaResponse(
|
||||
del<JavaApiResponse<null>>(
|
||||
`${JAVA_API_PREFIX}/price-track/tasks/${taskId}?user_id=${encodeURIComponent(String(getCurrentUserId()))}`,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function getPriceTrackResultDownloadUrl(resultId: number) {
|
||||
return getJavaDownloadUrl(`/price-track/results/${resultId}/download`);
|
||||
}
|
||||
|
||||
export function deletePendingPriceTrackShopResult(shopName: string) {
|
||||
return unwrapJavaResponse(
|
||||
del<JavaApiResponse<null>>(
|
||||
`${JAVA_API_PREFIX}/price-track/pending-shop-result?user_id=${encodeURIComponent(String(getCurrentUserId()))}&shop_name=${encodeURIComponent(shopName)}`,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function getJavaDownloadUrl(path: string) {
|
||||
let raw =
|
||||
path.startsWith("http://") || path.startsWith("https://")
|
||||
|
||||
Reference in New Issue
Block a user