处理修复BUG
This commit is contained in:
@@ -799,7 +799,9 @@ async function runMatch() {
|
||||
countryCodes: resolveCountryCodesForRequest(),
|
||||
})
|
||||
const batch = res.items || []
|
||||
matchAsinRowsByCountry.value = res.asinRowsByCountry || {}
|
||||
// 移除:不再使用后端返回的 ASIN 数据
|
||||
// matchAsinRowsByCountry.value = res.asinRowsByCountry || {}
|
||||
matchAsinRowsByCountry.value = {}
|
||||
const nextByShop = new Map(
|
||||
matchedItems.value.map((item) => [((item.shopName || '').trim()), item] as const),
|
||||
)
|
||||
@@ -989,9 +991,6 @@ async function pushToPythonQueueLegacy() {
|
||||
function buildQueuePayload(taskVo: PriceTrackCreateTaskVo, row: PriceTrackShopQueueItem) {
|
||||
const taskItem = taskVo.items?.[0]
|
||||
const shopName = (row.shopName || '').trim()
|
||||
const skipAsinsByCountry = row.skipAsins || taskVo.skipAsinsByCountry || {}
|
||||
const skipAsinDetailsByCountry = taskVo.skipAsinDetailsByCountry || {}
|
||||
const minimumPriceByCountryAndAsin = taskVo.minimumPriceByCountryAndAsin || {}
|
||||
const skipAsinDeletePolicy = buildSkipAsinDeletePolicy()
|
||||
const resultId = taskItem?.resultId ?? null
|
||||
const loopRunId = taskItem?.loopRunId ?? null
|
||||
@@ -1001,6 +1000,7 @@ function buildQueuePayload(taskVo: PriceTrackCreateTaskVo, row: PriceTrackShopQu
|
||||
const error = taskItem?.error || null
|
||||
const outputFilename = taskItem?.outputFilename || null
|
||||
const downloadUrl = taskItem?.downloadUrl || null
|
||||
|
||||
return {
|
||||
type: 'price-track-run',
|
||||
ts: Date.now(),
|
||||
@@ -1024,16 +1024,14 @@ function buildQueuePayload(taskVo: PriceTrackCreateTaskVo, row: PriceTrackShopQu
|
||||
round_index: roundIndex,
|
||||
country_codes: resolveCountryCodesForRequest(),
|
||||
mode: statusModeEnabled.value ? 'status' : 'asin',
|
||||
skip_asins: skipAsinsByCountry,
|
||||
skip_asins_by_country: skipAsinsByCountry,
|
||||
skip_asin_details_by_country: skipAsinDetailsByCountry,
|
||||
minimum_price_by_country_and_asin: minimumPriceByCountryAndAsin,
|
||||
// 分页拉取配置(Python 端统一处理)
|
||||
use_paginated_skip_asins: true,
|
||||
skip_asin_page_size: 1000,
|
||||
// 移除:不再传递任何 ASIN 数据,Python 端统一分页拉取
|
||||
skip_asin_delete_policy: skipAsinDeletePolicy,
|
||||
delete_skip_asin_when_price_below_minimum: skipAsinDeletePolicy.deleteWhenPriceBelowMinimum,
|
||||
deleteSkipAsinWhenPriceBelowMinimum: skipAsinDeletePolicy.deleteWhenPriceBelowMinimum,
|
||||
asin_rows_by_country: Object.keys(matchAsinRowsByCountry.value).length
|
||||
? matchAsinRowsByCountry.value
|
||||
: (taskVo.asinRowsByCountry || {}),
|
||||
// 兼容字段
|
||||
taskId: taskVo.taskId,
|
||||
resultId: resultId,
|
||||
shopName,
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
<p class="hint listing-filter-hint">与「推送到 Python 队列」一并下发,供 Python 区分处理场景。</p>
|
||||
<div class="listing-filter-row">
|
||||
<el-select v-model="productRiskListingFilter" class="listing-filter-select" teleported placeholder="选择筛选类型">
|
||||
<el-option v-for="opt in LISTING_FILTER_OPTIONS" :key="opt.value" :label="opt.label"
|
||||
<el-option v-for="opt in PRODUCT_RISK_LISTING_FILTER_OPTIONS" :key="opt.value" :label="opt.label"
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</div>
|
||||
@@ -235,6 +235,12 @@ const autoQueueEnabled = ref(false)
|
||||
const queuePushResult = ref('')
|
||||
const queuePayloadText = ref('')
|
||||
|
||||
const PRODUCT_RISK_LISTING_FILTER_OPTIONS = [
|
||||
...LISTING_FILTER_OPTIONS,
|
||||
{ value: 'AccountStatus', label: '账户状态处理' },
|
||||
] as const
|
||||
type ProductRiskListingFilterValue = ListingFilterValue | 'AccountStatus'
|
||||
|
||||
/** 与后端 ProductRiskCountryCode / 默认顺序 DE→UK→FR→IT→ES 一致 */
|
||||
const COUNTRY_OPTIONS = [
|
||||
{ code: 'DE', label: '德国' },
|
||||
@@ -245,7 +251,7 @@ const COUNTRY_OPTIONS = [
|
||||
] as const
|
||||
|
||||
const orderedCountryCodes = ref<string[]>(['DE', 'UK', 'FR', 'IT', 'ES'])
|
||||
const productRiskListingFilter = ref<ListingFilterValue>('SearchSuppressed')
|
||||
const productRiskListingFilter = ref<ProductRiskListingFilterValue>('SearchSuppressed')
|
||||
const dragCountryIndex = ref<number | null>(null)
|
||||
const countryPrefSaving = ref(false)
|
||||
/** 用户已改过顺序/勾选后,忽略晚到的 GET,避免把界面打回全选 */
|
||||
@@ -527,8 +533,8 @@ async function removeMatchedRow(row: ProductRiskShopQueueItem) {
|
||||
/** 历史列表中已无该 taskId 时,停止轮询并清本地快照 */
|
||||
function syncPollingIdsWithHistory() {
|
||||
for (const taskId of [...pollingTaskIds.value]) {
|
||||
const any = historyItems.value.some((r) => r.taskId === taskId)
|
||||
if (!any) {
|
||||
const rows = historyItems.value.filter((r) => r.taskId === taskId)
|
||||
if (!rows.length || rows.some((row) => isHistoryItemTerminal(row))) {
|
||||
removePollingTask(taskId)
|
||||
}
|
||||
}
|
||||
@@ -640,9 +646,22 @@ function taskStatusOf(taskId?: number) {
|
||||
return taskDetails.value[taskId] || ''
|
||||
}
|
||||
|
||||
function isTerminalStatus(status?: string) {
|
||||
return status === 'SUCCESS' || status === 'FAILED'
|
||||
}
|
||||
|
||||
function isTaskTerminalById(taskId?: number) {
|
||||
const s = taskStatusOf(taskId)
|
||||
return s === 'SUCCESS' || s === 'FAILED'
|
||||
return isTerminalStatus(s)
|
||||
}
|
||||
|
||||
function isHistoryItemTerminal(item: ProductRiskHistoryItem) {
|
||||
if (isTerminalStatus(item.taskStatus)) return true
|
||||
if (item.success === true) return true
|
||||
if (item.fileStatus === 'SUCCESS' && item.fileReady) return true
|
||||
if (item.fileStatus === 'FAILED') return true
|
||||
if (item.success === false && !!item.error) return true
|
||||
return false
|
||||
}
|
||||
|
||||
const currentSectionItems = computed(() => {
|
||||
@@ -650,7 +669,8 @@ const currentSectionItems = computed(() => {
|
||||
(row) =>
|
||||
row.taskId &&
|
||||
pollingTaskIds.value.includes(row.taskId) &&
|
||||
!isTaskTerminalById(row.taskId),
|
||||
!isTaskTerminalById(row.taskId) &&
|
||||
!isHistoryItemTerminal(row),
|
||||
)
|
||||
|
||||
const existingTaskIds = new Set(out.map((row) => row.taskId).filter((id): id is number => typeof id === 'number'))
|
||||
@@ -669,7 +689,8 @@ const historySectionItems = computed(() =>
|
||||
(row) =>
|
||||
!row.taskId ||
|
||||
!pollingTaskIds.value.includes(row.taskId) ||
|
||||
isTaskTerminalById(row.taskId),
|
||||
isTaskTerminalById(row.taskId) ||
|
||||
isHistoryItemTerminal(row),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -953,6 +974,9 @@ async function runMatch() {
|
||||
}
|
||||
|
||||
function resolvedTaskStatus(item: ProductRiskHistoryItem) {
|
||||
if (isTerminalStatus(item.taskStatus)) return item.taskStatus || ''
|
||||
if (item.success === true || (item.fileStatus === 'SUCCESS' && item.fileReady)) return 'SUCCESS'
|
||||
if (item.fileStatus === 'FAILED' || (item.success === false && !!item.error)) return 'FAILED'
|
||||
const tid = item.taskId
|
||||
if (!tid) return item.taskStatus || ''
|
||||
return taskStatusOf(tid) || item.taskStatus || ''
|
||||
|
||||
Reference in New Issue
Block a user