feat(phase-4/5 用户端): 恢复巡店删除与指定删除ASIN两个功能页与全部表件
用户口径:这两个功能是随 fdaae3c5 连带删错(该退役的只有紫鸟新版/旧版选项控件),
本次按历史逐字找回并摘掉紫鸟引用。
- 页面:BrandDeleteBrandTab.vue(1740行) / BrandPatrolDeleteTab.vue(1370行) 从 fdaae3c5~1 找回,
两页各摘 5 处 ZiniaoVersionSetting/useZiniaoVersion 引用与 1 个 ziniao_version 载荷字段
(checkQueuePayload 只钉 taskId,摘掉不触闸;全树其余读点 0 处)
- 表件:router 两条路由、tool-catalog 18→20 工具与四条图标/详情、BrandTopBar 导航两条、
endpoints 两块(deleteBrand 10 键 / patrolDelete 16 键)、progress-light 10→12、
java-modules re-export、module-templates 联合、withdraw.ts 巡店段整文件找回(513 行,
含两个 ProductRisk*Vo import)
- 测试面:9 支退役时改过的用例从 fdaae3c5~1 逐字找回(含 modules-delete-brand.test.ts 167 行/11 例)
- 自证:npm test 854/854 绿(基线 840+找回 14 例)、vue-tsc --noEmit 与 vite build 通过
- 未触碰他人在飞件:BrandSimilarAsinTab.vue / task-status-text.ts / similar-asin-fake-completed.test.ts
注:恢复后的三支大文件将顶破 ops 侧 readability 棘轮,基线随本轮在 ops 仓重锚并登记。
This commit is contained in:
@@ -40,6 +40,18 @@ export const API_ENDPOINTS = {
|
||||
history: '/api/publish/history',
|
||||
taskDelete: '/api/publish/tasks/{taskId}',
|
||||
},
|
||||
deleteBrand: {
|
||||
run: '/api/delete-brand/run',
|
||||
history: '/api/delete-brand/history',
|
||||
historyDelete: '/api/delete-brand/history/{resultId}',
|
||||
taskDetail: '/api/delete-brand/tasks/{taskId}',
|
||||
taskDetails: '/api/delete-brand/tasks/batch',
|
||||
taskDownload: '/api/delete-brand/tasks/{taskId}/download',
|
||||
resultDownload: '/api/delete-brand/results/{resultId}/download',
|
||||
resultSubmit: '/api/delete-brand/tasks/{taskId}/result',
|
||||
progressBatch: '/api/delete-brand/tasks/progress/batch',
|
||||
progressLight: '/api/delete-brand/tasks/progress/light',
|
||||
},
|
||||
productRisk: {
|
||||
candidates: '/api/product-risk-resolve/candidates',
|
||||
candidateAdd: '/api/product-risk-resolve/candidates',
|
||||
@@ -76,6 +88,24 @@ export const API_ENDPOINTS = {
|
||||
skipAsins: '/api/shop-match/tasks/{taskId}/skip-asins/paginated',
|
||||
resultDownload: '/api/shop-match/results/{resultId}/download',
|
||||
},
|
||||
patrolDelete: {
|
||||
candidates: '/api/patrol-delete/candidates',
|
||||
candidateAdd: '/api/patrol-delete/candidates',
|
||||
candidateDelete: '/api/patrol-delete/candidates/{id}',
|
||||
conditions: '/api/patrol-delete/conditions',
|
||||
conditionAdd: '/api/patrol-delete/conditions',
|
||||
conditionDelete: '/api/patrol-delete/conditions/{id}',
|
||||
matchShops: '/api/patrol-delete/match-shops',
|
||||
dashboard: '/api/patrol-delete/dashboard',
|
||||
history: '/api/patrol-delete/history',
|
||||
historyDelete: '/api/patrol-delete/history/{resultId}',
|
||||
progressBatch: '/api/patrol-delete/tasks/progress/batch',
|
||||
progressLight: '/api/patrol-delete/tasks/progress/light',
|
||||
taskCreate: '/api/patrol-delete/tasks',
|
||||
taskDelete: '/api/patrol-delete/tasks/{taskId}',
|
||||
taskResult: '/api/patrol-delete/tasks/{taskId}/result',
|
||||
resultDownload: '/api/patrol-delete/results/{resultId}/download',
|
||||
},
|
||||
queryAsin: {
|
||||
candidates: '/api/query-asin/candidates',
|
||||
candidateAdd: '/api/query-asin/candidates',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
export * from "./types/modules/dedupe.ts";
|
||||
export * from "./types/modules/split.ts";
|
||||
export * from "./types/modules/convert.ts";
|
||||
export * from "./types/modules/delete-brand.ts";
|
||||
export * from "./types/modules/publish.ts";
|
||||
export * from "./types/modules/similar-asin.ts";
|
||||
export * from "./types/modules/appearance-patent.ts";
|
||||
|
||||
@@ -6,6 +6,7 @@ export type ModuleTemplateCode =
|
||||
| 'price-track'
|
||||
| 'collect-data'
|
||||
| 'similar-asin'
|
||||
| 'delete-brand'
|
||||
|
||||
export function getModuleTemplateDownloadUrl(moduleCode: ModuleTemplateCode) {
|
||||
return getJavaDownloadUrl(`/module-templates/${encodeURIComponent(moduleCode)}/download`)
|
||||
|
||||
@@ -19,8 +19,10 @@ import type { TaskProgressBatchVo } from './types/task.ts'
|
||||
*/
|
||||
export const PROGRESS_LIGHT_MODULES = [
|
||||
'publish',
|
||||
'deleteBrand',
|
||||
'productRisk',
|
||||
'shopMatch',
|
||||
'patrolDelete',
|
||||
'queryAsin',
|
||||
'shopDataCrawl',
|
||||
'withdraw',
|
||||
|
||||
@@ -0,0 +1,315 @@
|
||||
import { get, post, del, type JavaApiResponse, unwrapJavaResponse } from '../../http.ts'
|
||||
import { buildJavaUrl, JAVA_API_PREFIX } from '../../url.ts'
|
||||
import { getCurrentUserId } from '../../user.ts'
|
||||
import { getJavaDownloadUrl } from '../../download-url.ts'
|
||||
import { getTaskProgressCacheTtlMs, getTaskProgressTimeoutMs } from '../../../task-progress-config.ts'
|
||||
import { createTaskProgressRequestCache } from '../../../task-progress-request-cache.ts'
|
||||
import type { UploadedFileRef } from '../upload.ts'
|
||||
import { API_ENDPOINTS } from '../../endpoints.ts'
|
||||
|
||||
export interface DeleteBrandPreviewRow {
|
||||
rowIndex: number;
|
||||
country: string;
|
||||
asin: string;
|
||||
status: string;
|
||||
}
|
||||
|
||||
export interface DeleteBrandCountryAsinItem {
|
||||
rowIndex: number;
|
||||
asin: string;
|
||||
status: string;
|
||||
}
|
||||
|
||||
export interface DeleteBrandCountryGroup {
|
||||
country: string;
|
||||
asinCount: number;
|
||||
items: DeleteBrandCountryAsinItem[];
|
||||
}
|
||||
|
||||
export interface DeleteBrandCountryResultItem {
|
||||
asin: string;
|
||||
status?: string;
|
||||
}
|
||||
|
||||
export interface DeleteBrandProcessedCountry {
|
||||
country: string;
|
||||
items: DeleteBrandCountryResultItem[];
|
||||
}
|
||||
|
||||
export interface DeleteBrandResultFile {
|
||||
fileKey?: string;
|
||||
sourceFilename: string;
|
||||
fileIndex?: number;
|
||||
fileTotal?: number;
|
||||
chunkIndex?: number;
|
||||
chunkTotal?: number;
|
||||
processedRows?: number;
|
||||
totalRows?: number;
|
||||
currentCountry?: string;
|
||||
currentAsin?: string;
|
||||
countries: DeleteBrandProcessedCountry[];
|
||||
}
|
||||
|
||||
export interface DeleteBrandSubmitResultRequest {
|
||||
submissionId?: string;
|
||||
files: DeleteBrandResultFile[];
|
||||
}
|
||||
|
||||
export interface DeleteBrandLineProgressInfo {
|
||||
file_index?: number;
|
||||
file_total?: number;
|
||||
file_name?: string;
|
||||
current_line?: number;
|
||||
total_lines?: number;
|
||||
current_country?: string;
|
||||
current_asin?: string;
|
||||
finished_files?: number;
|
||||
phase?: string;
|
||||
}
|
||||
|
||||
export interface DeleteBrandLineProgress {
|
||||
has_progress: boolean;
|
||||
info?: DeleteBrandLineProgressInfo;
|
||||
}
|
||||
|
||||
export interface DeleteBrandTaskItem {
|
||||
id: number;
|
||||
taskNo?: string;
|
||||
status?: string;
|
||||
sourceFileCount?: number;
|
||||
successFileCount?: number;
|
||||
failedFileCount?: number;
|
||||
errorMessage?: string;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
finishedAt?: string;
|
||||
downloadUrl?: string;
|
||||
downloadFilename?: string;
|
||||
}
|
||||
|
||||
export interface DeleteBrandTaskFileProgress {
|
||||
fileKey?: string;
|
||||
sourceFilename?: string;
|
||||
processedRows?: number;
|
||||
totalRows?: number;
|
||||
percent?: number;
|
||||
status?: "PENDING" | "RUNNING" | "COMPLETED" | "FAILED";
|
||||
}
|
||||
|
||||
export interface DeleteBrandTaskDetailVo {
|
||||
task: DeleteBrandTaskItem;
|
||||
line_progress: DeleteBrandLineProgress;
|
||||
items?: DeleteBrandResultItem[];
|
||||
fileProgress?: DeleteBrandTaskFileProgress[];
|
||||
}
|
||||
|
||||
export interface DeleteBrandTaskBatchVo {
|
||||
items: DeleteBrandTaskDetailVo[];
|
||||
missingTaskIds: number[];
|
||||
}
|
||||
|
||||
export type DeleteBrandMatchStatus =
|
||||
| "MATCHED"
|
||||
| "PENDING"
|
||||
| "CONFLICT"
|
||||
| "INDEX_STALE";
|
||||
|
||||
export interface DeleteBrandResultItem {
|
||||
resultId?: number;
|
||||
fileKey?: string;
|
||||
sourceFilename: string;
|
||||
shopName?: string;
|
||||
companyName?: string;
|
||||
matched?: boolean;
|
||||
matchStatus?: DeleteBrandMatchStatus;
|
||||
matchMessage?: string;
|
||||
shopId?: string;
|
||||
platform?: string;
|
||||
openStoreUrl?: string;
|
||||
outputFilename?: string;
|
||||
downloadUrl?: string;
|
||||
fileJobId?: number;
|
||||
fileStatus?: string;
|
||||
fileError?: string;
|
||||
fileReady?: boolean;
|
||||
taskId?: number;
|
||||
countryCount?: number;
|
||||
countries?: DeleteBrandCountryGroup[];
|
||||
totalRows?: number;
|
||||
truncated?: boolean;
|
||||
previewRows?: DeleteBrandPreviewRow[];
|
||||
success: boolean;
|
||||
error?: string;
|
||||
taskStatus?: string;
|
||||
}
|
||||
|
||||
export interface DeleteBrandRunVo {
|
||||
total: number;
|
||||
successCount: number;
|
||||
failedCount: number;
|
||||
items: DeleteBrandResultItem[];
|
||||
}
|
||||
|
||||
export interface DeleteBrandHistoryVo {
|
||||
items: DeleteBrandResultItem[];
|
||||
}
|
||||
|
||||
export interface DeleteBrandRunRequest {
|
||||
files: UploadedFileRef[];
|
||||
user_id: number;
|
||||
}
|
||||
|
||||
interface TaskProgressBatchOptions {
|
||||
force?: boolean;
|
||||
}
|
||||
|
||||
const taskProgressResponseCache = createTaskProgressRequestCache<unknown>({
|
||||
ttlMs: () => getTaskProgressCacheTtlMs(),
|
||||
maxEntries: 100,
|
||||
maxInflight: 16,
|
||||
});
|
||||
|
||||
function normalizeTaskIds(taskIds: number[]) {
|
||||
return Array.from(
|
||||
new Set(
|
||||
(taskIds || [])
|
||||
.map((taskId) => Number(taskId))
|
||||
.filter((taskId) => Number.isFinite(taskId) && taskId > 0),
|
||||
),
|
||||
).sort((left, right) => left - right);
|
||||
}
|
||||
|
||||
function buildTaskProgressRequestKey(path: string, taskIds: number[]) {
|
||||
return `${path}::${taskIds.join(",")}`;
|
||||
}
|
||||
|
||||
async function postTaskProgressBatch<T>(
|
||||
path: string,
|
||||
taskIds: number[],
|
||||
options: TaskProgressBatchOptions = {},
|
||||
) {
|
||||
const normalizedTaskIds = normalizeTaskIds(taskIds);
|
||||
if (!normalizedTaskIds.length) {
|
||||
return { items: [], missingTaskIds: [] } as T;
|
||||
}
|
||||
|
||||
const cacheKey = buildTaskProgressRequestKey(path, normalizedTaskIds);
|
||||
const cached = taskProgressResponseCache.get(cacheKey);
|
||||
if (!options.force && cached !== undefined) {
|
||||
return cached as T;
|
||||
}
|
||||
|
||||
const inflight = taskProgressResponseCache.getInflight(cacheKey);
|
||||
if (!options.force && inflight) {
|
||||
return (await inflight) as T;
|
||||
}
|
||||
|
||||
const requestPromise = unwrapJavaResponse(
|
||||
post<JavaApiResponse<T>, { taskIds: number[]; userId?: number }>(path, {
|
||||
taskIds: normalizedTaskIds,
|
||||
// 传当前用户 id:后端据此过滤非归属任务(未传时后端不过滤,保持向后兼容)
|
||||
userId: Number(window.localStorage.getItem('uid')) || undefined,
|
||||
}, {
|
||||
timeout: getTaskProgressTimeoutMs(),
|
||||
}),
|
||||
)
|
||||
.then((data) => {
|
||||
taskProgressResponseCache.set(cacheKey, data);
|
||||
return data;
|
||||
})
|
||||
.finally(() => {
|
||||
taskProgressResponseCache.endInflight(cacheKey);
|
||||
});
|
||||
|
||||
taskProgressResponseCache.startInflight(cacheKey, requestPromise);
|
||||
return requestPromise;
|
||||
}
|
||||
|
||||
export function runDeleteBrand(
|
||||
request: Omit<DeleteBrandRunRequest, "user_id"> | DeleteBrandRunRequest,
|
||||
) {
|
||||
return unwrapJavaResponse(
|
||||
post<JavaApiResponse<DeleteBrandRunVo>, DeleteBrandRunRequest>(
|
||||
buildJavaUrl(API_ENDPOINTS.deleteBrand.run),
|
||||
{
|
||||
...request,
|
||||
user_id: getCurrentUserId(),
|
||||
},
|
||||
{ timeout: 180000 },
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function getDeleteBrandHistory() {
|
||||
return unwrapJavaResponse(
|
||||
get<JavaApiResponse<DeleteBrandHistoryVo>>(
|
||||
buildJavaUrl(API_ENDPOINTS.deleteBrand.history),
|
||||
{
|
||||
params: { user_id: getCurrentUserId() },
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function deleteDeleteBrandHistory(resultId: number) {
|
||||
return unwrapJavaResponse(
|
||||
del<JavaApiResponse<null>>(
|
||||
buildJavaUrl(API_ENDPOINTS.deleteBrand.historyDelete.replace('{resultId}', String(resultId))),
|
||||
{
|
||||
params: { user_id: getCurrentUserId() },
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function getDeleteBrandTaskDetail(taskId: number) {
|
||||
return unwrapJavaResponse(
|
||||
get<JavaApiResponse<DeleteBrandTaskDetailVo>>(
|
||||
buildJavaUrl(API_ENDPOINTS.deleteBrand.taskDetail.replace('{taskId}', String(taskId))),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function getDeleteBrandTaskDetails(taskIds: number[]) {
|
||||
return unwrapJavaResponse(
|
||||
post<JavaApiResponse<DeleteBrandTaskBatchVo>, { taskIds: number[]; userId?: number }>(
|
||||
buildJavaUrl(API_ENDPOINTS.deleteBrand.taskDetails),
|
||||
{
|
||||
taskIds,
|
||||
// 传当前用户 id:后端据此过滤非归属任务(未传时后端不过滤,保持向后兼容)
|
||||
userId: Number(window.localStorage.getItem('uid')) || undefined,
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function getDeleteBrandTaskDownloadUrl(taskId: number) {
|
||||
return getJavaDownloadUrl(
|
||||
API_ENDPOINTS.deleteBrand.taskDownload.replace('{taskId}', String(taskId)),
|
||||
);
|
||||
}
|
||||
|
||||
export function getDeleteBrandResultDownloadUrl(resultId: number) {
|
||||
return getJavaDownloadUrl(
|
||||
API_ENDPOINTS.deleteBrand.resultDownload.replace('{resultId}', String(resultId)),
|
||||
);
|
||||
}
|
||||
|
||||
export function submitDeleteBrandResult(
|
||||
taskId: number,
|
||||
request: DeleteBrandSubmitResultRequest,
|
||||
) {
|
||||
return unwrapJavaResponse(
|
||||
post<JavaApiResponse<null>, DeleteBrandSubmitResultRequest>(
|
||||
buildJavaUrl(API_ENDPOINTS.deleteBrand.resultSubmit.replace('{taskId}', String(taskId))),
|
||||
request,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function getDeleteBrandTaskProgress(taskIds: number[]) {
|
||||
return postTaskProgressBatch<DeleteBrandTaskBatchVo>(
|
||||
`${JAVA_API_PREFIX}/delete-brand/tasks/progress/batch`,
|
||||
taskIds,
|
||||
);
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import { getJavaDownloadUrl } from '../../download-url.ts'
|
||||
import { getTaskProgressCacheTtlMs, getTaskProgressTimeoutMs } from '../../../task-progress-config.ts'
|
||||
import { createTaskProgressRequestCache } from '../../../task-progress-request-cache.ts'
|
||||
import type {
|
||||
ProductRiskCandidateVo,
|
||||
ProductRiskDashboardVo,
|
||||
ProductRiskMatchShopsVo,
|
||||
ProductRiskShopQueueItem,
|
||||
} from './shop-match.ts'
|
||||
@@ -74,6 +76,94 @@ export interface WithdrawCreateTaskVo {
|
||||
items: WithdrawHistoryItem[];
|
||||
}
|
||||
|
||||
export type PatrolDeleteCandidateVo = ProductRiskCandidateVo;
|
||||
export type PatrolDeleteDashboardVo = ProductRiskDashboardVo;
|
||||
export type PatrolDeleteShopQueueItem = ProductRiskShopQueueItem;
|
||||
|
||||
export interface PatrolDeleteConditionVo {
|
||||
id: number;
|
||||
conditionText: string;
|
||||
createdAt?: string;
|
||||
}
|
||||
|
||||
export interface PatrolDeleteCountryMetricRow {
|
||||
status: string;
|
||||
quantity: string;
|
||||
deleteQuantity: string;
|
||||
processStatus: string;
|
||||
}
|
||||
|
||||
export interface PatrolDeleteCountrySection {
|
||||
country: string;
|
||||
rows: PatrolDeleteCountryMetricRow[];
|
||||
}
|
||||
|
||||
export interface PatrolDeleteCartRatio {
|
||||
country: string;
|
||||
ratio: string;
|
||||
}
|
||||
|
||||
export interface PatrolDeleteTaskItem {
|
||||
shopName?: string;
|
||||
matched?: boolean;
|
||||
shopId?: string;
|
||||
platform?: string;
|
||||
companyName?: string;
|
||||
matchStatus?: string;
|
||||
matchMessage?: string;
|
||||
countrySections: PatrolDeleteCountrySection[];
|
||||
cartRatios: PatrolDeleteCartRatio[];
|
||||
}
|
||||
|
||||
export interface PatrolDeleteHistoryItem {
|
||||
resultId?: number;
|
||||
taskId?: number;
|
||||
shopName?: string;
|
||||
shopId?: string;
|
||||
platform?: string;
|
||||
companyName?: string;
|
||||
matched?: boolean;
|
||||
matchStatus?: string;
|
||||
matchMessage?: string;
|
||||
taskStatus?: string;
|
||||
success?: boolean;
|
||||
error?: string;
|
||||
createdAt?: string;
|
||||
finishedAt?: string;
|
||||
outputFilename?: string;
|
||||
downloadUrl?: string;
|
||||
fileJobId?: number;
|
||||
fileStatus?: string;
|
||||
fileError?: string;
|
||||
fileReady?: boolean;
|
||||
countrySections: PatrolDeleteCountrySection[];
|
||||
cartRatios: PatrolDeleteCartRatio[];
|
||||
}
|
||||
|
||||
export interface PatrolDeleteHistoryVo {
|
||||
items: PatrolDeleteHistoryItem[];
|
||||
}
|
||||
|
||||
export interface PatrolDeleteTaskBatchVo {
|
||||
items: PatrolDeleteHistoryItem[];
|
||||
missingTaskIds: number[];
|
||||
}
|
||||
|
||||
export interface PatrolDeleteCreateTaskVo {
|
||||
taskId: number;
|
||||
items: PatrolDeleteHistoryItem[];
|
||||
}
|
||||
|
||||
export interface PatrolDeleteSubmitShopPayload {
|
||||
shopName: string;
|
||||
error?: string;
|
||||
countrySections: PatrolDeleteCountrySection[];
|
||||
cartRatios: PatrolDeleteCartRatio[];
|
||||
shopDone?: boolean;
|
||||
submissionId?: string;
|
||||
chunkIndex?: number;
|
||||
chunkTotal?: number;
|
||||
}
|
||||
|
||||
const taskProgressResponseCache = createTaskProgressRequestCache<unknown>({
|
||||
ttlMs: () => getTaskProgressCacheTtlMs(),
|
||||
@@ -254,3 +344,170 @@ export function deleteWithdrawHistory(resultId: number) {
|
||||
);
|
||||
}
|
||||
|
||||
export function listPatrolDeleteCandidates() {
|
||||
return unwrapJavaResponse(
|
||||
get<JavaApiResponse<PatrolDeleteCandidateVo[]>>(
|
||||
`${JAVA_API_PREFIX}/patrol-delete/candidates`,
|
||||
{
|
||||
params: { user_id: getCurrentUserId() },
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function addPatrolDeleteCandidate(shopName: string) {
|
||||
return unwrapJavaResponse(
|
||||
post<
|
||||
JavaApiResponse<PatrolDeleteCandidateVo>,
|
||||
{ user_id: number; shop_name: string }
|
||||
>(`${JAVA_API_PREFIX}/patrol-delete/candidates`, {
|
||||
user_id: getCurrentUserId(),
|
||||
shop_name: shopName,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
export function deletePatrolDeleteCandidate(id: number) {
|
||||
return unwrapJavaResponse(
|
||||
del<JavaApiResponse<null>>(
|
||||
`${JAVA_API_PREFIX}/patrol-delete/candidates/${id}`,
|
||||
{
|
||||
params: { user_id: getCurrentUserId() },
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function listPatrolDeleteConditions() {
|
||||
return unwrapJavaResponse(
|
||||
get<JavaApiResponse<PatrolDeleteConditionVo[]>>(
|
||||
`${JAVA_API_PREFIX}/patrol-delete/conditions`,
|
||||
{
|
||||
params: { user_id: getCurrentUserId() },
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function addPatrolDeleteCondition(conditionText: string) {
|
||||
return unwrapJavaResponse(
|
||||
post<
|
||||
JavaApiResponse<PatrolDeleteConditionVo>,
|
||||
{ user_id: number; conditionText: string }
|
||||
>(`${JAVA_API_PREFIX}/patrol-delete/conditions`, {
|
||||
user_id: getCurrentUserId(),
|
||||
conditionText,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
export function deletePatrolDeleteCondition(id: number) {
|
||||
return unwrapJavaResponse(
|
||||
del<JavaApiResponse<null>>(
|
||||
`${JAVA_API_PREFIX}/patrol-delete/conditions/${id}`,
|
||||
{
|
||||
params: { user_id: getCurrentUserId() },
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function matchPatrolDeleteShops(shopNames: string[]) {
|
||||
return unwrapJavaResponse(
|
||||
post<
|
||||
JavaApiResponse<ProductRiskMatchShopsVo>,
|
||||
{ user_id: number; shop_names: string[] }
|
||||
>(`${JAVA_API_PREFIX}/patrol-delete/match-shops`, {
|
||||
user_id: getCurrentUserId(),
|
||||
shop_names: shopNames,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
export function getPatrolDeleteDashboard() {
|
||||
return unwrapJavaResponse(
|
||||
get<JavaApiResponse<PatrolDeleteDashboardVo>>(
|
||||
`${JAVA_API_PREFIX}/patrol-delete/dashboard`,
|
||||
{
|
||||
params: { user_id: getCurrentUserId() },
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function getPatrolDeleteHistory() {
|
||||
return unwrapJavaResponse(
|
||||
get<JavaApiResponse<PatrolDeleteHistoryVo>>(
|
||||
`${JAVA_API_PREFIX}/patrol-delete/history`,
|
||||
{
|
||||
params: { user_id: getCurrentUserId() },
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function getPatrolDeleteTaskProgressBatch(taskIds: number[]) {
|
||||
return postTaskProgressBatch<PatrolDeleteTaskBatchVo>(
|
||||
`${JAVA_API_PREFIX}/patrol-delete/tasks/progress/batch`,
|
||||
taskIds,
|
||||
);
|
||||
}
|
||||
|
||||
export function createPatrolDeleteTask(
|
||||
items: PatrolDeleteTaskItem[],
|
||||
deleteConditions: unknown[] = [],
|
||||
) {
|
||||
return unwrapJavaResponse(
|
||||
post<
|
||||
JavaApiResponse<PatrolDeleteCreateTaskVo>,
|
||||
{ user_id: number; items: PatrolDeleteTaskItem[]; delete_conditions: unknown[] }
|
||||
>(`${JAVA_API_PREFIX}/patrol-delete/tasks`, {
|
||||
user_id: getCurrentUserId(),
|
||||
items,
|
||||
// 服务端校验删除条件非空(创建即 RUNNING,空条件的任务 Python 端无内容可执行)
|
||||
delete_conditions: deleteConditions,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
export function submitPatrolDeleteTaskResult(
|
||||
taskId: number,
|
||||
payload: {
|
||||
shops: PatrolDeleteSubmitShopPayload[];
|
||||
},
|
||||
) {
|
||||
return unwrapJavaResponse(
|
||||
post<
|
||||
JavaApiResponse<null>,
|
||||
{ shops: PatrolDeleteSubmitShopPayload[] }
|
||||
>(`${JAVA_API_PREFIX}/patrol-delete/tasks/${taskId}/result`, payload),
|
||||
);
|
||||
}
|
||||
|
||||
export function getPatrolDeleteResultDownloadUrl(resultId: number) {
|
||||
return getJavaDownloadUrl(
|
||||
API_ENDPOINTS.patrolDelete.resultDownload.replace('{resultId}', String(resultId)),
|
||||
);
|
||||
}
|
||||
|
||||
export function deletePatrolDeleteTask(taskId: number) {
|
||||
return unwrapJavaResponse(
|
||||
del<JavaApiResponse<null>>(
|
||||
`${JAVA_API_PREFIX}/patrol-delete/tasks/${taskId}`,
|
||||
{
|
||||
params: { user_id: getCurrentUserId() },
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function deletePatrolDeleteHistory(resultId: number) {
|
||||
return unwrapJavaResponse(
|
||||
del<JavaApiResponse<null>>(
|
||||
`${JAVA_API_PREFIX}/patrol-delete/history/${resultId}`,
|
||||
{
|
||||
params: { user_id: getCurrentUserId() },
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user