|
|
|
@@ -1,4 +1,4 @@
|
|
|
|
|
import { del, get, http, post, type JavaApiResponse, unwrapJavaResponse } from '@/shared/api/http'
|
|
|
|
|
import { del, get, http, post, put, type JavaApiResponse, unwrapJavaResponse } from '@/shared/api/http'
|
|
|
|
|
|
|
|
|
|
const JAVA_API_PREFIX = '/newApi/api'
|
|
|
|
|
|
|
|
|
@@ -398,6 +398,206 @@ export function submitDeleteBrandResult(taskId: number, request: DeleteBrandSubm
|
|
|
|
|
return unwrapJavaResponse(post<JavaApiResponse<null>, DeleteBrandSubmitResultRequest>(`${JAVA_API_PREFIX}/delete-brand/tasks/${taskId}/result`, request))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 商品风险解决:备选店铺与匹配(推队列由前端 pywebview 完成) */
|
|
|
|
|
export interface ProductRiskCandidateVo {
|
|
|
|
|
id: number
|
|
|
|
|
shop_name: string
|
|
|
|
|
created_at?: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ProductRiskShopQueueItem {
|
|
|
|
|
shopName: string
|
|
|
|
|
matched: boolean
|
|
|
|
|
shopId?: string
|
|
|
|
|
platform?: string
|
|
|
|
|
companyName?: string
|
|
|
|
|
openStoreUrl?: string
|
|
|
|
|
matchedUserId?: number
|
|
|
|
|
matchStatus?: string
|
|
|
|
|
matchMessage?: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ProductRiskMatchShopsVo {
|
|
|
|
|
items: ProductRiskShopQueueItem[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function listProductRiskCandidates() {
|
|
|
|
|
return unwrapJavaResponse(
|
|
|
|
|
get<JavaApiResponse<ProductRiskCandidateVo[]>>(`${JAVA_API_PREFIX}/product-risk-resolve/candidates`, {
|
|
|
|
|
params: { user_id: getCurrentUserId() },
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function addProductRiskCandidate(shopName: string) {
|
|
|
|
|
return unwrapJavaResponse(
|
|
|
|
|
post<JavaApiResponse<ProductRiskCandidateVo>, { user_id: number; shop_name: string }>(
|
|
|
|
|
`${JAVA_API_PREFIX}/product-risk-resolve/candidates`,
|
|
|
|
|
{ user_id: getCurrentUserId(), shop_name: shopName },
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function deleteProductRiskCandidate(id: number) {
|
|
|
|
|
return unwrapJavaResponse(
|
|
|
|
|
del<JavaApiResponse<null>>(`${JAVA_API_PREFIX}/product-risk-resolve/candidates/${id}`, {
|
|
|
|
|
params: { user_id: getCurrentUserId() },
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ProductRiskCountryPreferenceVo {
|
|
|
|
|
country_codes: string[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function getProductRiskCountryPreference() {
|
|
|
|
|
return unwrapJavaResponse(
|
|
|
|
|
get<JavaApiResponse<ProductRiskCountryPreferenceVo>>(`${JAVA_API_PREFIX}/product-risk-resolve/country-preference`, {
|
|
|
|
|
params: { user_id: getCurrentUserId() },
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function putProductRiskCountryPreference(countryCodes: string[]) {
|
|
|
|
|
return unwrapJavaResponse(
|
|
|
|
|
put<
|
|
|
|
|
JavaApiResponse<ProductRiskCountryPreferenceVo>,
|
|
|
|
|
{ user_id: number; country_codes: string[] }
|
|
|
|
|
>(`${JAVA_API_PREFIX}/product-risk-resolve/country-preference`, {
|
|
|
|
|
user_id: getCurrentUserId(),
|
|
|
|
|
country_codes: countryCodes,
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function matchProductRiskShops(shopNames: string[]) {
|
|
|
|
|
return unwrapJavaResponse(
|
|
|
|
|
post<JavaApiResponse<ProductRiskMatchShopsVo>, { user_id: number; shop_names: string[] }>(
|
|
|
|
|
`${JAVA_API_PREFIX}/product-risk-resolve/match-shops`,
|
|
|
|
|
{ user_id: getCurrentUserId(), shop_names: shopNames },
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ProductRiskDashboardVo {
|
|
|
|
|
candidateCount: number
|
|
|
|
|
processedTaskCount: number
|
|
|
|
|
successTaskCount: number
|
|
|
|
|
failedTaskCount: number
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ProductRiskHistoryItem {
|
|
|
|
|
resultId?: number
|
|
|
|
|
taskId?: number
|
|
|
|
|
shopName?: string
|
|
|
|
|
shopId?: string
|
|
|
|
|
platform?: string
|
|
|
|
|
companyName?: string
|
|
|
|
|
matched?: boolean
|
|
|
|
|
matchStatus?: string
|
|
|
|
|
matchMessage?: string
|
|
|
|
|
taskStatus?: string
|
|
|
|
|
success?: boolean
|
|
|
|
|
error?: string
|
|
|
|
|
outputFilename?: string
|
|
|
|
|
downloadUrl?: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ProductRiskHistoryVo {
|
|
|
|
|
items: ProductRiskHistoryItem[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ProductRiskTaskSummary {
|
|
|
|
|
id?: number
|
|
|
|
|
taskNo?: string
|
|
|
|
|
status?: string
|
|
|
|
|
errorMessage?: string
|
|
|
|
|
createdAt?: string
|
|
|
|
|
updatedAt?: string
|
|
|
|
|
finishedAt?: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ProductRiskTaskDetailVo {
|
|
|
|
|
task?: ProductRiskTaskSummary
|
|
|
|
|
items?: ProductRiskHistoryItem[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ProductRiskTaskBatchVo {
|
|
|
|
|
items: ProductRiskTaskDetailVo[]
|
|
|
|
|
missingTaskIds?: number[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ProductRiskPendingDeleteVo {
|
|
|
|
|
removed: boolean
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ProductRiskCreateTaskVo {
|
|
|
|
|
taskId: number
|
|
|
|
|
items: ProductRiskHistoryItem[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function getProductRiskDashboard() {
|
|
|
|
|
return unwrapJavaResponse(
|
|
|
|
|
get<JavaApiResponse<ProductRiskDashboardVo>>(`${JAVA_API_PREFIX}/product-risk-resolve/dashboard`, {
|
|
|
|
|
params: { user_id: getCurrentUserId() },
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function getProductRiskHistory() {
|
|
|
|
|
return unwrapJavaResponse(
|
|
|
|
|
get<JavaApiResponse<ProductRiskHistoryVo>>(`${JAVA_API_PREFIX}/product-risk-resolve/history`, {
|
|
|
|
|
params: { user_id: getCurrentUserId() },
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function deleteProductRiskHistory(resultId: number) {
|
|
|
|
|
return unwrapJavaResponse(
|
|
|
|
|
del<JavaApiResponse<null>>(`${JAVA_API_PREFIX}/product-risk-resolve/history/${resultId}`, {
|
|
|
|
|
params: { user_id: getCurrentUserId() },
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function createProductRiskTask(items: ProductRiskShopQueueItem[]) {
|
|
|
|
|
return unwrapJavaResponse(
|
|
|
|
|
post<JavaApiResponse<ProductRiskCreateTaskVo>, { user_id: number; items: ProductRiskShopQueueItem[] }>(
|
|
|
|
|
`${JAVA_API_PREFIX}/product-risk-resolve/tasks`,
|
|
|
|
|
{ user_id: getCurrentUserId(), items },
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function deleteProductRiskTask(taskId: number) {
|
|
|
|
|
return unwrapJavaResponse(
|
|
|
|
|
del<JavaApiResponse<null>>(`${JAVA_API_PREFIX}/product-risk-resolve/tasks/${taskId}`, {
|
|
|
|
|
params: { user_id: getCurrentUserId() },
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function deletePendingProductRiskShopResult(shopName: string) {
|
|
|
|
|
return unwrapJavaResponse(
|
|
|
|
|
del<JavaApiResponse<ProductRiskPendingDeleteVo>>(`${JAVA_API_PREFIX}/product-risk-resolve/pending-shop-result`, {
|
|
|
|
|
params: { user_id: getCurrentUserId(), shop_name: shopName },
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function getProductRiskTasksBatch(taskIds: number[]) {
|
|
|
|
|
return unwrapJavaResponse(
|
|
|
|
|
post<JavaApiResponse<ProductRiskTaskBatchVo>, { taskIds: number[] }>(
|
|
|
|
|
`${JAVA_API_PREFIX}/product-risk-resolve/tasks/batch`,
|
|
|
|
|
{ taskIds },
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function getProductRiskResultDownloadUrl(resultId: number) {
|
|
|
|
|
return getJavaDownloadUrl(`/product-risk-resolve/results/${resultId}/download`)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function getJavaDownloadUrl(path: string) {
|
|
|
|
|
let raw = path.startsWith('http://') || path.startsWith('https://') ? path : `${JAVA_API_PREFIX}${path}`
|
|
|
|
|
// 核心修复:pywebview 的 save_file_from_url 需要完整带 schema 的 URL
|
|
|
|
|