后台查询Asin文档更新

This commit is contained in:
super
2026-04-24 15:14:14 +08:00
parent 326f78705d
commit 0caf62c3d2
34 changed files with 798 additions and 540 deletions

View File

@@ -624,6 +624,7 @@ function resetQueueWorkerIfIdle() {
}
queueWorkerRunning.value = false;
pushing.value = false;
autoQueueEnabled.value = false;
stopHistoryPolling();
saveQueueState();
}
@@ -818,11 +819,6 @@ async function runMatch() {
const data = await matchQueryAsinShops(names);
matchedItems.value = mergeMatchedItems(matchedItems.value, data.items || []);
saveMatchedItems();
if (autoQueueEnabled.value) {
pendingQueue.value = mergeQueueItems(pendingQueue.value, matchedRunnableItems.value);
saveQueueState();
void processQueue();
}
ElMessage.success(`本次返回 ${data.items?.length || 0} 条匹配结果`);
} catch (error) {
ElMessage.error(error instanceof Error ? error.message : "匹配失败");
@@ -856,6 +852,7 @@ function buildTaskItem(item: QueryAsinShopQueueItem): QueryAsinTaskItem {
}
function buildQueuePayload(taskId: number, item: QueryAsinHistoryItem) {
const submissionId = createSubmissionId(taskId, item.shopName);
return {
type: "query-asin-run",
ts: Date.now(),
@@ -863,9 +860,11 @@ function buildQueuePayload(taskId: number, item: QueryAsinHistoryItem) {
taskId,
user_id: Number(uidForStorage()) || 0,
source: "frontend-vue-query-asin",
submissionId,
items: [
{
shopName: item.shopName,
submissionId,
shopId: item.shopId,
platform: item.platform,
companyName: item.companyName,
@@ -973,25 +972,20 @@ async function processQueue() {
{
shopName: createdItem.shopName || nextItem.shopName || "",
error: pushResult?.error || `任务 ${created.taskId} 推送失败`,
queryAsins: copyQueryAsins(createdItem.queryAsins || nextItem.queryAsins),
shopDone: true,
submissionId: createSubmissionId(
created.taskId,
createdItem.shopName || nextItem.shopName,
),
chunkIndex: 1,
chunkTotal: 1,
},
],
});
removeMatchedRowLocally(nextItem);
await refreshTaskViews();
queuePushResult.value = `任务 ${created.taskId} 推送失败,已自动继续下一个任务`;
clearActiveQueueTask();
continue;
}
removeMatchedRowLocally(nextItem);
queuePushResult.value =
pendingQueue.value.length > 0
? `任务 ${created.taskId} 已入队,等待完成后自动继续下一个(剩余 ${pendingQueue.value.length} 条)`

View File

@@ -1199,6 +1199,16 @@ export interface QueryAsinCountryAsins {
asins: string[];
}
export interface QueryAsinStatusItem {
asin?: string;
status?: string;
}
export interface QueryAsinCountryResult {
country: string;
items: QueryAsinStatusItem[];
}
export interface QueryAsinTaskItem {
shopName?: string;
matched?: boolean;
@@ -1228,6 +1238,7 @@ export interface QueryAsinHistoryItem {
outputFilename?: string;
downloadUrl?: string;
queryAsins: QueryAsinCountryAsins[];
countryResults?: QueryAsinCountryResult[];
}
export interface QueryAsinHistoryVo {
@@ -1316,11 +1327,9 @@ export function submitQueryAsinTaskResult(
shops: Array<{
shopName: string;
error?: string;
queryAsins: QueryAsinCountryAsins[];
countryResults?: QueryAsinCountryResult[];
shopDone?: boolean;
submissionId?: string;
chunkIndex?: number;
chunkTotal?: number;
}>;
},
) {