匹配回收,bug修复

This commit is contained in:
super
2026-04-10 19:33:58 +08:00
parent 144d03965e
commit 03a85d5523
40 changed files with 913104 additions and 72 deletions

View File

@@ -624,6 +624,7 @@ export interface ProductRiskHistoryItem {
error?: string;
outputFilename?: string;
downloadUrl?: string;
scheduledAt?: string;
}
export interface ProductRiskHistoryVo {
@@ -638,6 +639,7 @@ export interface ProductRiskTaskSummary {
createdAt?: string;
updatedAt?: string;
finishedAt?: string;
scheduledAt?: string;
}
export interface ProductRiskTaskDetailVo {
@@ -659,6 +661,16 @@ export interface ProductRiskCreateTaskVo {
items: ProductRiskHistoryItem[];
}
export type ShopMatchCandidateVo = ProductRiskCandidateVo;
export type ShopMatchCountryPreferenceVo = ProductRiskCountryPreferenceVo;
export type ShopMatchShopQueueItem = ProductRiskShopQueueItem;
export type ShopMatchDashboardVo = ProductRiskDashboardVo;
export type ShopMatchHistoryItem = ProductRiskHistoryItem;
export type ShopMatchHistoryVo = ProductRiskHistoryVo;
export type ShopMatchTaskDetailVo = ProductRiskTaskDetailVo;
export type ShopMatchTaskBatchVo = ProductRiskTaskBatchVo;
export type ShopMatchCreateTaskVo = ProductRiskCreateTaskVo;
export function getProductRiskDashboard() {
return unwrapJavaResponse(
get<JavaApiResponse<ProductRiskDashboardVo>>(
@@ -741,6 +753,148 @@ export function getProductRiskResultDownloadUrl(resultId: number) {
);
}
export function listShopMatchCandidates() {
return unwrapJavaResponse(
get<JavaApiResponse<ShopMatchCandidateVo[]>>(
`${JAVA_API_PREFIX}/shop-match/candidates`,
{
params: { user_id: getCurrentUserId() },
},
),
);
}
export function addShopMatchCandidate(shopName: string) {
return unwrapJavaResponse(
post<
JavaApiResponse<ShopMatchCandidateVo>,
{ user_id: number; shop_name: string }
>(`${JAVA_API_PREFIX}/shop-match/candidates`, {
user_id: getCurrentUserId(),
shop_name: shopName,
}),
);
}
export function deleteShopMatchCandidate(id: number) {
return unwrapJavaResponse(
del<JavaApiResponse<null>>(`${JAVA_API_PREFIX}/shop-match/candidates/${id}`, {
params: { user_id: getCurrentUserId() },
}),
);
}
export function getShopMatchCountryPreference() {
return unwrapJavaResponse(
get<JavaApiResponse<ShopMatchCountryPreferenceVo>>(
`${JAVA_API_PREFIX}/shop-match/country-preference`,
{
params: { user_id: getCurrentUserId() },
},
),
);
}
export function putShopMatchCountryPreference(countryCodes: string[]) {
return unwrapJavaResponse(
put<
JavaApiResponse<ShopMatchCountryPreferenceVo>,
{ user_id: number; country_codes: string[] }
>(`${JAVA_API_PREFIX}/shop-match/country-preference`, {
user_id: getCurrentUserId(),
country_codes: countryCodes,
}),
);
}
export function matchShopMatchShops(shopNames: string[]) {
return unwrapJavaResponse(
post<
JavaApiResponse<ProductRiskMatchShopsVo>,
{ user_id: number; shop_names: string[] }
>(`${JAVA_API_PREFIX}/shop-match/match-shops`, {
user_id: getCurrentUserId(),
shop_names: shopNames,
}),
);
}
export function getShopMatchDashboard() {
return unwrapJavaResponse(
get<JavaApiResponse<ShopMatchDashboardVo>>(
`${JAVA_API_PREFIX}/shop-match/dashboard`,
{
params: { user_id: getCurrentUserId() },
},
),
);
}
export function getShopMatchHistory() {
return unwrapJavaResponse(
get<JavaApiResponse<ShopMatchHistoryVo>>(
`${JAVA_API_PREFIX}/shop-match/history`,
{
params: { user_id: getCurrentUserId() },
},
),
);
}
export function deleteShopMatchHistory(resultId: number) {
return unwrapJavaResponse(
del<JavaApiResponse<null>>(`${JAVA_API_PREFIX}/shop-match/history/${resultId}`, {
params: { user_id: getCurrentUserId() },
}),
);
}
export function createShopMatchTask(
items: ShopMatchShopQueueItem[],
scheduleTime?: string,
) {
return unwrapJavaResponse(
post<
JavaApiResponse<ShopMatchCreateTaskVo>,
{ user_id: number; items: ShopMatchShopQueueItem[]; schedule_time?: string }
>(`${JAVA_API_PREFIX}/shop-match/tasks`, {
user_id: getCurrentUserId(),
items,
schedule_time: scheduleTime,
}),
);
}
export function deleteShopMatchTask(taskId: number) {
return unwrapJavaResponse(
del<JavaApiResponse<null>>(`${JAVA_API_PREFIX}/shop-match/tasks/${taskId}`, {
params: { user_id: getCurrentUserId() },
}),
);
}
export function activateShopMatchTask(taskId: number) {
return unwrapJavaResponse(
post<JavaApiResponse<null>, undefined>(
`${JAVA_API_PREFIX}/shop-match/tasks/${taskId}/activate?user_id=${encodeURIComponent(String(getCurrentUserId()))}`,
undefined,
),
);
}
export function getShopMatchTasksBatch(taskIds: number[]) {
return unwrapJavaResponse(
post<JavaApiResponse<ShopMatchTaskBatchVo>, { taskIds: number[] }>(
`${JAVA_API_PREFIX}/shop-match/tasks/batch`,
{ taskIds },
),
);
}
export function getShopMatchResultDownloadUrl(resultId: number) {
return getJavaDownloadUrl(`/shop-match/results/${resultId}/download`);
}
export function getJavaDownloadUrl(path: string) {
let raw =
path.startsWith("http://") || path.startsWith("https://")