chore: 移除项目内无用代码(28 文件)
- 清理任务面板/SPA 化改造遗留的未使用变量与函数(模板管理配套 6 函数、 payloadForDisplay/showTip/hasRunning/schedulePoll/removeMatchedRowLocally 等 30+ 处) - 清理未使用 import(getBrandTemplateXlsxUrl/uploadTempFileToJava/getProductRiskTasksBatch 等) - useTaskProgressLoop 改为仅类型导入;progress/task-request 缓存未用参数精简 - DeleteBrandRunService 删除永不执行的 taskItems 死分支 - 全量 vue-tsc(含 --noUnusedLocals/--noUnusedParameters)0 错误;648 测试全过
This commit is contained in:
@@ -213,7 +213,6 @@ import ModuleTemplateDownload from '@/shared/components/ModuleTemplateDownload.v
|
||||
import ZiniaoVersionSetting from '@/shared/components/ZiniaoVersionSetting.vue'
|
||||
import TaskCenterPanel from '@/shared/components/tasks/TaskCenterPanel.vue'
|
||||
import type { TaskItemView, TaskStatCard } from '@/shared/components/tasks/types'
|
||||
import { LISTING_FILTER_OPTIONS, type ListingFilterValue } from '@/pages/brand/components/listingFilters'
|
||||
import { expandBrandFolderRecursive } from '@/shared/api/brand'
|
||||
import { getPywebviewApi, type PywebviewApi, type UploadedJavaFile } from '@/shared/bridges/pywebview'
|
||||
import { getTaskPollIntervalMs } from '@/shared/task-progress-config'
|
||||
@@ -242,7 +241,6 @@ import {
|
||||
getPriceTrackLoopRun,
|
||||
getPriceTrackResultDownloadUrl,
|
||||
getPriceTrackTaskProgressBatch,
|
||||
getPriceTrackTasksBatch,
|
||||
getTaskSkipPriceAsinsPaginated,
|
||||
listPriceTrackCandidates,
|
||||
matchPriceTrackShops,
|
||||
@@ -942,88 +940,6 @@ async function removeMatchedRow(row: PriceTrackShopQueueItem) {
|
||||
}
|
||||
}
|
||||
|
||||
async function pushToPythonQueueLegacy() {
|
||||
if (!hasValidMode.value) {
|
||||
ElMessage.warning('请至少选择一个跟价模式')
|
||||
return
|
||||
}
|
||||
if (asinModeEnabled.value && !asinFiles.value.length) {
|
||||
ElMessage.warning('请先选择 ASIN 文件')
|
||||
return
|
||||
}
|
||||
const api = getPywebviewApi()
|
||||
if (!api?.enqueue_json) {
|
||||
ElMessage.error('当前环境未启用 pywebview enqueue_json')
|
||||
return
|
||||
}
|
||||
const matchedRows = matchedItems.value.filter((i) => i.matched)
|
||||
if (!matchedRows.length) {
|
||||
ElMessage.warning('无可用匹配店铺')
|
||||
return
|
||||
}
|
||||
pushing.value = true
|
||||
queuePayloadText.value = ''
|
||||
try {
|
||||
// 1. 先调用 Java API 创建任务(落库,含 skip ASIN)
|
||||
const taskReq = {
|
||||
userId: 0, // 会被 java-modules 自动填充
|
||||
statusMode: statusModeEnabled.value,
|
||||
asinMode: asinModeEnabled.value,
|
||||
items: matchedRows as unknown as Record<string, unknown>[],
|
||||
asinFiles: resolveAsinRequestPaths(),
|
||||
countryCodes: resolveCountryCodesForRequest(),
|
||||
}
|
||||
const taskVo = await createPriceTrackTask(taskReq)
|
||||
taskSnapshots.value = {
|
||||
...taskSnapshots.value,
|
||||
[taskVo.taskId]: {
|
||||
task: { id: taskVo.taskId, status: 'RUNNING' },
|
||||
items: taskVo.items,
|
||||
},
|
||||
}
|
||||
taskDetails.value = {
|
||||
...taskDetails.value,
|
||||
[taskVo.taskId]: 'RUNNING',
|
||||
}
|
||||
saveTaskSnapshotsToStorage()
|
||||
saveTaskDetailsToStorage()
|
||||
|
||||
const firstRow = matchedRows[0]
|
||||
const asinRowsByCountry = await loadAsinRowsForAppClient(taskVo)
|
||||
const minimumPriceByCountryAndAsin = buildMinimumPriceMapForAppClient(taskVo, asinRowsByCountry)
|
||||
|
||||
// 2. 推送 app_client 当前消费的字段
|
||||
const queuePayload = {
|
||||
type: 'price-track-run',
|
||||
ts: Date.now(),
|
||||
data: {
|
||||
task_id: taskVo.taskId,
|
||||
ziniao_version: ziniaoVersion.value,
|
||||
shop_name: (firstRow.shopName || '').trim(),
|
||||
shopName: (firstRow.shopName || '').trim(),
|
||||
companyName: firstRow.companyName || '',
|
||||
shopMallName: firstRow.shopMallName || '',
|
||||
country_codes: resolveCountryCodesForRequest(),
|
||||
mode: priceTrackModeForAppClient(),
|
||||
asin_rows_by_country: asinRowsByCountry,
|
||||
minimum_price_by_country_and_asin: minimumPriceByCountryAndAsin,
|
||||
},
|
||||
}
|
||||
queuePayloadText.value = JSON.stringify(queuePayload, null, 2)
|
||||
|
||||
await enqueueCreatedTask(api, taskVo.taskId, queuePayload)
|
||||
queuePushResult.value = `任务 ${taskVo.taskId} 已入队,等待执行完成...`
|
||||
addPollingTask(taskVo.taskId)
|
||||
scheduleNextPoll(true)
|
||||
ElMessage.success('已启动任务')
|
||||
} catch (e) {
|
||||
queuePushResult.value = e instanceof Error ? e.message : '推送异常'
|
||||
ElMessage.error(queuePushResult.value)
|
||||
} finally {
|
||||
pushing.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// ========== 任务状态轮询 ==========
|
||||
async function buildQueuePayload(taskVo: PriceTrackCreateTaskVo, row: PriceTrackShopQueueItem) {
|
||||
const shopName = (row.shopName || '').trim()
|
||||
@@ -1155,11 +1071,6 @@ async function waitForTaskTerminal(taskId: number) {
|
||||
}
|
||||
}
|
||||
|
||||
async function pushToPythonQueue() {
|
||||
autoQueueEnabled.value = true
|
||||
await processMatchedQueue()
|
||||
}
|
||||
|
||||
function nextMatchedQueueItem() {
|
||||
return matchedItems.value.find((item) => item.matched)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user