frontend-vue 退役:删新版/旧版选项控件与删除品牌/巡店删除入口,用例族随实况收敛

- 删 ZiniaoVersionSetting.vue / ziniao-version.ts;9 个 Tab 摘 ziniao_version 载荷
- 删 BrandDeleteBrandTab.vue / BrandPatrolDeleteTab.vue 与 delete-brand 类型模块;
  路由、工具目录(20→18)、端点表、progress-light 模块(12→10)、withdraw.ts 巡店段、
  java-modules re-export 同步摘除
- 测试面:node --test 17 处红按实况收敛(端点冻结快照摘两组、适配器 16→14、窄集合台账
  摘两页、六页→五页、reexport/快照随实况),modules-delete-brand.test.ts 整文件删
- vue-tsc+vite build 通过;node --test 837/837 绿
This commit is contained in:
2026-10-15 22:30:06 +08:00
parent 785dbb7c2d
commit fdaae3c560
34 changed files with 42 additions and 4212 deletions
+3 -27
View File
@@ -146,11 +146,9 @@ export const TOOL_GROUPS: ReadonlyArray<ToolGroup> = [
workflowHint: '10步工作流 · 从上架到复盘,环环相扣',
workflow: [
{ name: '上架', desc: '安全数据批量上架', toolId: 'list' },
{ name: '指定删除ASIN', desc: '批量清理无效ASIN', toolId: 'delasin' },
{ name: '商品风险解决', desc: '4类风险一键处理', toolId: 'risk' },
{ name: '商品风险解决', desc: '3类风险一键处理', toolId: 'risk' },
{ name: '定时匹配', desc: '定时价格匹配', toolId: 'time' },
{ name: '跟价', desc: '跟价规则配置', toolId: 'follow' },
{ name: '巡店删除', desc: '巡检店铺状态', toolId: 'patrol' },
{ name: '查询ASIN', desc: '排查ASIN在售状态', toolId: 'qasin' },
{ name: '店铺数据抓取', desc: '抓取运营数据', toolId: 'scrape' },
{ name: '取款', desc: '留足平台扣款费用', toolId: 'cash' },
@@ -164,17 +162,10 @@ export const TOOL_GROUPS: ReadonlyArray<ToolGroup> = [
href: '/publish',
permissionKeys: ['publish'],
},
{
id: 'delasin',
name: '指定删除ASIN',
desc: '批量删除需清理的 ASIN(风险 / 优化 / 邮箱汇总)',
href: '/delete-brand',
permissionKeys: ['delete-brand'],
},
{
id: 'risk',
name: '商品风险解决',
desc: '4 类风险一键处理:禁止显示 / 需要批准 / 详情已删 / 账户状态',
desc: '3 类风险一键处理:禁止显示 / 需要批准 / 详情已删',
tag: '高频',
core: true,
href: '/product-risk',
@@ -196,13 +187,6 @@ export const TOOL_GROUPS: ReadonlyArray<ToolGroup> = [
href: '/price-track',
permissionKeys: ['pricing', 'price-track'],
},
{
id: 'patrol',
name: '巡店删除',
desc: '按商品状态巡店清理,摸清店铺商品全貌',
href: '/patrol-delete',
permissionKeys: ['patrol-delete'],
},
{
id: 'qasin',
name: '查询ASIN',
@@ -269,11 +253,9 @@ export const TOOL_ICON_GRADIENTS: Record<string, string> = {
split: 'linear-gradient(180deg, #86EFAC, #22C55E)',
convert: 'linear-gradient(180deg, #FCA5A5, #EF4444)',
list: 'linear-gradient(180deg, #5EEAD4, #14B8A6)',
delasin: 'linear-gradient(180deg, #93C5FD, #3B82F6)',
risk: 'linear-gradient(180deg, #C4B5FD, #8B5CF6)',
time: 'linear-gradient(180deg, #F9A8D4, #EC4899)',
follow: 'linear-gradient(180deg, #FDBA74, #F97316)',
patrol: 'linear-gradient(180deg, #FDE047, #EAB308)',
qasin: 'linear-gradient(180deg, #86EFAC, #22C55E)',
scrape: 'linear-gradient(180deg, #FCA5A5, #EF4444)',
cash: 'linear-gradient(180deg, #5EEAD4, #14B8A6)',
@@ -305,16 +287,12 @@ export const TOOL_ICON_SHAPES: Record<string, string> = {
convert: '<path d="M11.88 31 A 14 14 0 0 1 36.12 17"/><path d="M36.12 17 A 14 14 0 0 1 11.88 31"/><path class="fill" d="M32 18 L40 18 L36 14 Z"/><path class="fill" d="M8 30 L16 30 L12 34 Z"/>',
// 上架:方框+向上箭头
list: '<rect x="10" y="16" width="28" height="24"/><line x1="24" y1="34" x2="24" y2="12"/><path class="fill" d="M19 15 L29 15 L24 10 Z"/>',
// 删除ASIN:垃圾桶
delasin: '<rect x="10" y="10" width="28" height="6"/><path d="M13 18 L35 18 L33 40 L15 40 Z"/><line x1="20" y1="22" x2="20" y2="36"/><line x1="28" y1="22" x2="28" y2="36"/>',
// 商品风险解决:三角+感叹号
risk: '<path d="M24 8 L40 38 L8 38 Z"/><line x1="24" y1="18" x2="24" y2="28" stroke-width="3"/><circle class="fill" cx="24" cy="33" r="2"/>',
// 定时匹配:时钟
time: '<circle cx="24" cy="24" r="16"/><line x1="24" y1="14" x2="24" y2="24"/><line x1="24" y1="24" x2="32" y2="28"/>',
// 跟价:标签
follow: '<path d="M10 12 L32 12 L40 24 L32 36 L10 36 Z"/><circle cx="32" cy="23" r="2" stroke-width="2"/>',
// 巡店删除:眼睛
patrol: '<ellipse cx="24" cy="24" rx="16" ry="8"/><circle class="fill" cx="24" cy="24" r="4"/>',
// 查询ASIN:放大镜
qasin: '<circle cx="20" cy="20" r="12"/><line x1="28" y1="28" x2="40" y2="40" stroke-width="4"/>',
// 店铺数据抓取:立方体
@@ -340,12 +318,10 @@ export const TOOL_DETAILS: Readonly<Record<string, string>> = {
collect: '默认勾选有排名和FBM这两个选择',
dedupe: '去重之后,切记一定上传到数富后台去重数据库',
brand: '核查上架数据品牌风险,先跑精确匹配,后跑嵌入式',
delasin: '收集统一要删除的ASIN,批量删除清理',
risk:
'A 搜索结果中禁止显示;B 需要批准(最通用、使用频率最高);C 详情页面已删除;D 账户状态处理(需要审批没有时候后台处理)。',
'A 搜索结果中禁止显示;B 需要批准(最通用、使用频率最高);C 详情页面已删除。',
follow:
'一个虚拟桌面跟一个国家,错开跑即可时时跟价抢购物车。指定 ASIN 文档跟价:用后台有利润数据快速跟价,下班前跑一下,确保出单数据及时是我们的购物车。',
patrol: '巡店删除是按商品状态删除,如审核多次不通过的商品。不放任何状态跑一遍,可清楚掌握店铺数据情况。',
qasin: '通过店小蜜导出出单 ASIN,上传后台,时不时排查是否还在店铺售卖,确保优质数据时刻在店。',
scrape:
'没排名、久未出单数据可优化删除;获取店铺所有数据的排名、品牌和销售情况。半个月到一个月复查一次品牌,确保数据没有被注册。',
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -118,7 +118,6 @@
<div v-if="countryPrefSaving" class="country-pref-status">保存中…</div>
</template>
<ZiniaoVersionSetting v-model="ziniaoVersion" />
<!-- 状态指示 -->
<div v-if="statusModeEnabled" class="mode-status-bar">
@@ -225,7 +224,6 @@ import { ElMessage } from 'element-plus'
import type { TableInstance } from 'element-plus'
import AmazonToolPageShell from '@/pages/amazon/components/AmazonToolPageShell.vue';
import ModuleTemplateDownload from '@/shared/components/ModuleTemplateDownload.vue'
import ZiniaoVersionSetting from '@/shared/components/ZiniaoVersionSetting.vue'
import FileUploadZone from '@/shared/components/FileUploadZone.vue'
import TaskCenterPanel from '@/shared/components/tasks/TaskCenterPanel.vue'
import type { TaskItemView, TaskStatCard } from '@/shared/components/tasks/types'
@@ -243,7 +241,6 @@ import {
shouldDeferQueuePush,
} from '@/shared/dispatch-guard'
import { passGuard } from '@/shared/dispatch-guard-ui'
import { useZiniaoVersion } from '@/shared/utils/ziniao-version'
import {
addPriceTrackCandidate,
completePriceTrackLoopChild,
@@ -293,7 +290,6 @@ import {
selectionNotice,
} from '@/shared/utils/candidate-selection-memory'
const ziniaoVersion = useZiniaoVersion()
// ========== 类型定义 ==========
const COUNTRY_OPTIONS = [
@@ -1037,7 +1033,6 @@ async function buildQueuePayload(taskVo: PriceTrackCreateTaskVo, row: PriceTrack
ts: Date.now(),
data: {
task_id: taskVo.taskId,
ziniao_version: ziniaoVersion.value,
shop_name: shopName,
country_codes: resolveCountryCodesForRequest(),
mode: priceTrackModeForAppClient(),
@@ -67,7 +67,6 @@
</el-select>
</div>
<ZiniaoVersionSetting v-model="ziniaoVersion" />
<div class="run-row">
<button type="button" class="btn-run" :disabled="matching" @click="runMatch">
@@ -185,8 +184,6 @@ import { saveUrlWithProgress } from '@/shared/utils/download-progress'
import { isTerminalTaskStatus, waitForTaskTerminal as waitForTaskTerminalShared } from '@/shared/utils/task-terminal'
import { checkQueuePayload, guardBlocked } from '@/shared/dispatch-guard'
import { passGuard } from '@/shared/dispatch-guard-ui'
import ZiniaoVersionSetting from '@/shared/components/ZiniaoVersionSetting.vue'
import { useZiniaoVersion } from '@/shared/utils/ziniao-version'
import { formatDateTime } from '@/shared/utils/datetime'
import { taskStatusClass, taskStatusText } from '@/shared/utils/task-status-text'
import { runBatchDelete } from '@/shared/utils/batch-delete'
@@ -222,13 +219,9 @@ const queueWorkerRunning = ref(false)
const autoQueueEnabled = ref(false)
const queuePushResult = ref('')
const queuePayloadText = ref('')
const ziniaoVersion = useZiniaoVersion()
const PRODUCT_RISK_LISTING_FILTER_OPTIONS = [
...LISTING_FILTER_OPTIONS,
{ value: 'AccountStatus', label: '账户状态处理' },
] as const
type ProductRiskListingFilterValue = ListingFilterValue | 'AccountStatus'
const PRODUCT_RISK_LISTING_FILTER_OPTIONS = LISTING_FILTER_OPTIONS
type ProductRiskListingFilterValue = ListingFilterValue
/** 与后端 ProductRiskCountryCode / 默认顺序 DE→UK→FR→IT→ES 一致 */
const COUNTRY_OPTIONS = [
@@ -1146,7 +1139,6 @@ async function processMatchedBatchQueue(toPush: ProductRiskShopQueueItem[]) {
ts: Date.now(),
data: {
taskId,
ziniao_version: ziniaoVersion.value,
items: toPush,
country_codes: [...orderedCountryCodes.value],
risk_listing_filter: productRiskListingFilter.value,
@@ -1242,7 +1234,6 @@ async function processMatchedQueue() {
ts: Date.now(),
data: {
taskId,
ziniao_version: ziniaoVersion.value,
items: [item],
country_codes: [...orderedCountryCodes.value],
risk_listing_filter: productRiskListingFilter.value,
@@ -58,7 +58,6 @@
<p class="country-hint">发布国家会从同步国家中自动排除。</p>
</div>
<ZiniaoVersionSetting v-model="ziniaoVersion" />
<div class="run-row">
<button
@@ -182,7 +181,6 @@ import FileUploadZone from '@/shared/components/FileUploadZone.vue'
import ModuleTemplateDownload from '@/shared/components/ModuleTemplateDownload.vue'
import TaskCenterPanel from '@/shared/components/tasks/TaskCenterPanel.vue'
import type { TaskItemView, TaskStatCard } from '@/shared/components/tasks/types'
import ZiniaoVersionSetting from '@/shared/components/ZiniaoVersionSetting.vue'
import {
activatePublishFile,
activatePublishTask,
@@ -211,7 +209,6 @@ import {
guardBlocked,
} from '@/shared/dispatch-guard'
import { passGuard } from '@/shared/dispatch-guard-ui'
import { useZiniaoVersion, type ZiniaoVersion } from '@/shared/utils/ziniao-version'
import { runBatchDelete } from '@/shared/utils/batch-delete'
const COUNTRY_OPTIONS = [
@@ -225,7 +222,6 @@ const COUNTRY_OPTIONS = [
interface PublishDispatchOptions {
publishCountry: string
syncCountries: string[]
ziniaoVersion: ZiniaoVersion
}
interface PublishQueueBatch {
@@ -263,7 +259,6 @@ const queueWorkerRunning = ref(false)
const queueMessage = ref('')
const publishCountry = ref<string>('DE')
const syncCountries = ref<string[]>(['UK', 'FR', 'IT', 'ES'])
const ziniaoVersion = useZiniaoVersion()
const currentTaskId = ref<number | null>(null)
const currentFiles = ref<PublishFileItem[]>([])
const pendingFileIds = ref<number[]>([])
@@ -541,7 +536,6 @@ async function submitRun() {
const options: PublishDispatchOptions = {
publishCountry: publishCountry.value,
syncCountries: syncCountries.value.filter((country) => country !== publishCountry.value),
ziniaoVersion: ziniaoVersion.value,
}
const files = parsed.files || []
applyTaskSnapshot(parsed.taskId, {
@@ -634,7 +628,6 @@ function setActiveBatch(batch: PublishQueueBatch, restoreForm = false) {
if (restoreForm) {
publishCountry.value = batch.options.publishCountry
syncCountries.value = [...batch.options.syncCountries]
ziniaoVersion.value = batch.options.ziniaoVersion
}
}
@@ -737,7 +730,6 @@ function buildQueuePayload(taskId: number, file: PublishFileItem) {
matched: isMatchedFile(file),
matchStatus: file.matchStatus || '',
matchMessage: file.matchMessage || '',
ziniao_version: options.ziniaoVersion,
publish_country: options.publishCountry,
sync_countries: options.syncCountries,
paginationUrl,
@@ -80,7 +80,6 @@
</button>
</div>
<ZiniaoVersionSetting v-model="ziniaoVersion" />
<div class="run-row">
<button
@@ -242,8 +241,6 @@ import { createCategorizedTimers } from "@/shared/utils/categorized-timers";
import { saveUrlWithProgress } from "@/shared/utils/download-progress";
import { checkQueuePayload } from "@/shared/dispatch-guard";
import { passGuard } from "@/shared/dispatch-guard-ui";
import ZiniaoVersionSetting from "@/shared/components/ZiniaoVersionSetting.vue";
import { useZiniaoVersion } from "@/shared/utils/ziniao-version";
import { formatDateTime } from '@/shared/utils/datetime'
import { RUNNING_UNTIL_DONE_STATUS_OPTIONS, taskStatusClass, taskStatusText } from '@/shared/utils/task-status-text'
import { useHistoryPolling } from '@/shared/composables/useHistoryPolling'
@@ -265,7 +262,6 @@ import {
} from '@/shared/utils/candidate-selection-memory';
const MAX_TRANSIENT_ERRORS = 30;
const ziniaoVersion = useZiniaoVersion();
const shopInput = ref("");
const candidates = ref<QueryAsinCandidateVo[]>([]);
@@ -972,7 +968,6 @@ function buildQueuePayload(taskId: number, item: QueryAsinHistoryItem) {
ts: Date.now(),
data: {
taskId,
ziniao_version: ziniaoVersion.value,
user_id: Number(uidForStorage()) || 0,
source: "frontend-vue-query-asin",
submissionId,
@@ -54,7 +54,6 @@
</div>
<div v-if="countryPrefSaving" class="country-pref-status">保存中...</div>
<ZiniaoVersionSetting v-model="ziniaoVersion" />
<div class="run-row">
<button type="button" class="btn-run" :disabled="matching" @click="runMatch">
@@ -135,8 +134,6 @@ import { ElMessage } from 'element-plus'
import AmazonToolPageShell from '@/pages/amazon/components/AmazonToolPageShell.vue';
import TaskCenterPanel from '@/shared/components/tasks/TaskCenterPanel.vue'
import type { TaskItemView, TaskStatCard } from '@/shared/components/tasks/types'
import ZiniaoVersionSetting from '@/shared/components/ZiniaoVersionSetting.vue'
import { useZiniaoVersion } from '@/shared/utils/ziniao-version'
import { getPywebviewApi } from '@/shared/bridges/pywebview'
import { getTaskPollIntervalMs } from '@/shared/task-progress-config'
import { createCategorizedTimers } from '@/shared/utils/categorized-timers'
@@ -182,7 +179,6 @@ const COUNTRY_OPTIONS = [
] as const
const timers = createCategorizedTimers('shop-data-crawl')
const ziniaoVersion = useZiniaoVersion()
const shopInput = ref('')
const candidates = ref<ShopDataCrawlCandidateVo[]>([])
const selectedCandidates = ref<ShopDataCrawlCandidateVo[]>([])
@@ -217,7 +213,6 @@ const activeTaskId = ref<number | null>(null)
const activeQueueItem = ref<ShopDataCrawlShopItem | null>(null)
const activeDispatched = ref(false)
const activeCountryCodes = ref<string[]>([])
const activeZiniaoVersion = ref<'new' | 'old'>('new')
const pollingTaskIds = ref<number[]>([])
/** 任务快照(审查 C3):整份含行明细、体积大,shallowRef 只跟踪整份替换,写入后统一 triggerRef */
const taskSnapshots = shallowRef<Record<number, ShopDataCrawlTaskDetailVo>>({})
@@ -297,13 +292,12 @@ function setStorage(name: string, value: unknown) {
function loadLocalState() {
try { matchedItems.value = JSON.parse(window.localStorage.getItem(storageKey('matched')) || '[]') } catch { matchedItems.value = [] }
try {
const state = JSON.parse(window.localStorage.getItem(storageKey('queue')) || '{}') as { pendingQueue?: ShopDataCrawlShopItem[]; activeTaskId?: number | null; activeQueueItem?: ShopDataCrawlShopItem | null; activeDispatched?: boolean; activeCountryCodes?: string[]; activeZiniaoVersion?: 'new' | 'old'; autoQueueEnabled?: boolean }
const state = JSON.parse(window.localStorage.getItem(storageKey('queue')) || '{}') as { pendingQueue?: ShopDataCrawlShopItem[]; activeTaskId?: number | null; activeQueueItem?: ShopDataCrawlShopItem | null; activeDispatched?: boolean; activeCountryCodes?: string[]; autoQueueEnabled?: boolean }
pendingQueue.value = state.pendingQueue || []
activeTaskId.value = state.activeTaskId || null
activeQueueItem.value = state.activeQueueItem || null
activeDispatched.value = state.activeDispatched || false
activeCountryCodes.value = state.activeCountryCodes || []
activeZiniaoVersion.value = state.activeZiniaoVersion || 'new'
autoQueueEnabled.value = state.autoQueueEnabled || false
} catch { pendingQueue.value = []; activeTaskId.value = null; activeQueueItem.value = null }
try { pollingTaskIds.value = JSON.parse(window.localStorage.getItem(storageKey('polling-task-ids')) || '[]') } catch { pollingTaskIds.value = [] }
@@ -312,7 +306,7 @@ function loadLocalState() {
}
function saveQueueState() {
setStorage('queue', { pendingQueue: pendingQueue.value, activeTaskId: activeTaskId.value, activeQueueItem: activeQueueItem.value, activeDispatched: activeDispatched.value, activeCountryCodes: activeCountryCodes.value, activeZiniaoVersion: activeZiniaoVersion.value, autoQueueEnabled: autoQueueEnabled.value })
setStorage('queue', { pendingQueue: pendingQueue.value, activeTaskId: activeTaskId.value, activeQueueItem: activeQueueItem.value, activeDispatched: activeDispatched.value, activeCountryCodes: activeCountryCodes.value, autoQueueEnabled: autoQueueEnabled.value })
setStorage('polling-task-ids', pollingTaskIds.value)
setStorage('task-snapshots', taskSnapshots.value)
}
@@ -476,7 +470,7 @@ async function waitForTerminal(taskId: number) {
function clearActiveTask() {
const taskId = activeTaskId.value
activeTaskId.value = null; activeQueueItem.value = null; activeDispatched.value = false
activeCountryCodes.value = []; activeZiniaoVersion.value = 'new'
activeCountryCodes.value = []
if (taskId) pollingTaskIds.value = pollingTaskIds.value.filter((id) => id !== taskId)
saveQueueState()
}
@@ -490,7 +484,6 @@ async function dispatchActiveTask(api: NonNullable<ReturnType<typeof getPywebvie
ts: Date.now(),
data: {
taskId: activeTaskId.value,
ziniao_version: activeZiniaoVersion.value,
items: [buildTaskItem(activeQueueItem.value)],
country_codes: [...activeCountryCodes.value],
},
@@ -557,7 +550,6 @@ async function processQueue() {
activeQueueItem.value = next
activeDispatched.value = false
activeCountryCodes.value = countries
activeZiniaoVersion.value = ziniaoVersion.value
pollingTaskIds.value = [...new Set([...pollingTaskIds.value, created.taskId])]
const createdItems = (created.items || []).map((item) => ({ ...item, taskId: item.taskId || created.taskId }))
taskSnapshots.value = { ...taskSnapshots.value, [created.taskId]: { task: { id: created.taskId, status: createdItems[0]?.taskStatus }, items: createdItems } }
@@ -58,7 +58,6 @@
<button type="button" class="schedule-add" :disabled="pushing" @click="addScheduleValue">添加时间点</button>
<p class="hint schedule-hint">启用后可按 `MM-DD HH:mm` 添加多个执行时间点。</p>
</div>
<ZiniaoVersionSetting v-model="ziniaoVersion" />
<div class="run-row">
<button type="button" class="btn-run" :disabled="matching" @click="runMatch">{{ matching ? '匹配中...' : '匹配店铺' }}</button>
@@ -125,7 +124,6 @@ import { ElMessage } from 'element-plus'
import AmazonToolPageShell from '@/pages/amazon/components/AmazonToolPageShell.vue';
import TaskCenterPanel from '@/shared/components/tasks/TaskCenterPanel.vue'
import type { TaskItemView, TaskStatCard } from '@/shared/components/tasks/types'
import ZiniaoVersionSetting from '@/shared/components/ZiniaoVersionSetting.vue'
import { LISTING_FILTER_OPTIONS, type ListingFilterValue } from '@/pages/brand/components/listingFilters'
import { activateShopMatchTask, addShopMatchCandidate, createShopMatchTask, deleteShopMatchCandidate, deleteShopMatchHistory, deleteShopMatchTask, getShopMatchCountryPreference, getShopMatchDashboard, getShopMatchHistory, getShopMatchResultDownloadUrl, getShopMatchTaskProgressBatch, listShopMatchCandidates, matchShopMatchShops, putShopMatchCountryPreference, type ShopMatchCandidateVo, type ShopMatchCreateTaskItem, type ShopMatchDashboardVo, type ShopMatchHistoryItem, type ShopMatchShopQueueItem, type ShopMatchTaskDetailVo } from '@/shared/api/java-modules'
import { getPollingProgressBatch } from '@/shared/api/task-progress-polling.ts'
@@ -136,7 +134,6 @@ import { createCategorizedTimers } from '@/shared/utils/categorized-timers'
import { createRowId } from '@/shared/utils/row-id'
import { saveUrlWithProgress } from '@/shared/utils/download-progress'
import { taskStatusClass, taskStatusText } from '@/shared/utils/task-status-text'
import { useZiniaoVersion } from '@/shared/utils/ziniao-version'
import { runBatchDelete } from '@/shared/utils/batch-delete'
import { useTablePaging } from '@/shared/composables/useTablePaging.ts'
import { confirmTaskDeletion } from '@/shared/task-delete-confirm'
@@ -170,7 +167,6 @@ const queueWorkerRunning = ref(false)
const autoQueueEnabled = ref(false)
const queuePushResult = ref('')
const queuePayloadText = ref('')
const ziniaoVersion = useZiniaoVersion()
const orderedCountryCodes = ref<string[]>(['DE', 'UK', 'FR', 'IT', 'ES'])
const dragCountryIndex = ref<number | null>(null)
const countryPrefSaving = ref(false)
@@ -418,7 +414,6 @@ function buildQueuePayload(taskId: number, item: Pick<ShopMatchHistoryItem, 'sho
ts: Date.now(),
data: {
taskId,
ziniao_version: ziniaoVersion.value,
user_id: currentUserId(),
items: [{
shopName: item.shopName,
@@ -50,11 +50,9 @@ type ActiveNavKey =
| 'dedupe'
| 'convert'
| 'split'
| 'delete-brand'
| 'product-risk'
| 'shop-match'
| 'pricing'
| 'patrol-delete'
| 'query-asin'
| 'shop-data-crawl'
| 'withdraw'
@@ -114,11 +112,9 @@ const navGroups: ReadonlyArray<NavGroup> = [
label: '运营工具',
items: [
{ key: 'publish', label: '上架', href: '/publish' },
{ key: 'delete-brand', label: '删除ASIN', href: '/delete-brand' },
{ key: 'product-risk', label: '商品风险解决', href: '/product-risk' },
{ key: 'shop-match', label: '定时匹配', href: '/shop-match' },
{ key: 'pricing', label: '跟价', href: '/price-track', aliases: ['price-track'] },
{ key: 'patrol-delete', label: '巡店删除', href: '/patrol-delete' },
{ key: 'query-asin', label: '查询ASIN', href: '/query-asin' },
{ key: 'shop-data-crawl', label: '店铺数据抓取', href: '/shop-data-crawl', columnKey: 'shop_data_crawl', aliases: ['shop-data-crawl'] },
{ key: 'withdraw', label: '取款', href: '/withdraw' },
@@ -79,7 +79,6 @@
v-model:current-page="candidatePage"
/>
<ZiniaoVersionSetting v-model="ziniaoVersion" />
<div class="run-row">
<button
@@ -269,8 +268,6 @@ import { createCategorizedTimers } from "@/shared/utils/categorized-timers";
import { saveUrlWithProgress } from "@/shared/utils/download-progress";
import { checkQueuePayload } from "@/shared/dispatch-guard";
import { passGuard } from "@/shared/dispatch-guard-ui";
import ZiniaoVersionSetting from "@/shared/components/ZiniaoVersionSetting.vue";
import { useZiniaoVersion } from "@/shared/utils/ziniao-version";
import { formatDateTime } from '@/shared/utils/datetime'
import { RUNNING_UNTIL_DONE_STATUS_OPTIONS, taskStatusClass, taskStatusText } from '@/shared/utils/task-status-text'
import { useHistoryPolling } from '@/shared/composables/useHistoryPolling'
@@ -284,7 +281,6 @@ import { confirmTaskDeletion } from '@/shared/task-delete-confirm'
import { waitForTaskTerminal as waitForTaskTerminalShared } from '@/shared/utils/task-terminal'
const MAX_TRANSIENT_ERRORS = 30;
const ziniaoVersion = useZiniaoVersion();
type WithdrawTaskBatchQueueItem = {
batchId: string;
@@ -1002,7 +998,6 @@ function buildQueuePayload(taskId: number, batch: WithdrawTaskBatchQueueItem) {
ts: Date.now(),
data: {
task_id: taskId,
ziniao_version: ziniaoVersion.value,
user_id: Number(uidForStorage()) || 0,
source: "frontend-vue-withdraw",
reserved_amount: batch.reservedAmount,
-10
View File
@@ -82,11 +82,6 @@ const routes = [
name: 'publish',
component: () => import('@/pages/brand/components/BrandPublishTab.vue'),
},
{
path: '/delete-brand',
name: 'delete-brand',
component: () => import('@/pages/brand/components/BrandDeleteBrandTab.vue'),
},
{
path: '/product-risk',
name: 'product-risk',
@@ -102,11 +97,6 @@ const routes = [
name: 'price-track',
component: () => import('@/pages/brand/components/BrandPriceTrackTab.vue'),
},
{
path: '/patrol-delete',
name: 'patrol-delete',
component: () => import('@/pages/brand/components/BrandPatrolDeleteTab.vue'),
},
{
path: '/query-asin',
name: 'query-asin',
-30
View File
@@ -40,18 +40,6 @@ 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',
@@ -88,24 +76,6 @@ 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',
@@ -4,7 +4,6 @@ export * from "./types/modules/convert.ts";
export * from "./types/modules/publish.ts";
export * from "./types/modules/similar-asin.ts";
export * from "./types/modules/appearance-patent.ts";
export * from "./types/modules/delete-brand.ts";
export * from "./types/modules/price-track.ts";
export * from "./types/modules/shop-match.ts";
export * from "./types/modules/query-asin.ts";
@@ -2,7 +2,6 @@ import { getJavaDownloadUrl } from '@/shared/api/java-modules'
export type ModuleTemplateCode =
| 'publish'
| 'delete-brand'
| 'appearance-patent'
| 'price-track'
| 'collect-data'
@@ -19,10 +19,8 @@ import type { TaskProgressBatchVo } from './types/task.ts'
*/
export const PROGRESS_LIGHT_MODULES = [
'publish',
'deleteBrand',
'productRisk',
'shopMatch',
'patrolDelete',
'queryAsin',
'shopDataCrawl',
'withdraw',
@@ -1,315 +0,0 @@
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,8 +5,6 @@ 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'
@@ -76,94 +74,6 @@ 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(),
@@ -344,170 +254,3 @@ 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() },
},
),
);
}
@@ -1,32 +0,0 @@
<template>
<section class="ziniao-version-setting">
<div class="setting-title">紫鸟版本</div>
<div class="version-options" role="group" aria-label="紫鸟版本">
<button v-for="option in options" :key="option.value" type="button" class="version-option"
:class="{ active: modelValue === option.value }" :aria-pressed="modelValue === option.value"
@mousedown.prevent @click="emit('update:modelValue', option.value)">
<span>{{ option.label }}</span>
</button>
</div>
</section>
</template>
<script setup lang="ts">
import type { ZiniaoVersion } from '@/shared/utils/ziniao-version'
defineProps<{ modelValue: ZiniaoVersion }>()
const emit = defineEmits<{ 'update:modelValue': [value: ZiniaoVersion] }>()
const options: Array<{ label: string; value: ZiniaoVersion }> = [
{ label: '新版', value: 'new' },
{ label: '旧版', value: 'old' },
]
</script>
<style scoped>
.ziniao-version-setting { margin: 16px 0; }
.setting-title { margin-bottom: 10px; color: #bbb; font-size: 13px; }
.version-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; min-height: 40px; padding: 3px; border: 1px solid #3a3a3a; border-radius: 6px; background: #202020; }
.version-option { display: flex; min-width: 0; align-items: center; justify-content: center; border: 0; border-radius: 4px; background: transparent; color: #aaa; cursor: pointer; font-size: 13px; transition: background-color .15s ease, color .15s ease; }
.version-option:hover { color: #eee; }
.version-option.active { background: #409eff; color: #fff; }
</style>
@@ -23,7 +23,7 @@ import type { TaskItemView } from '../components/tasks/types'
* - 轮询回调抛错时是否打断轮询(SimilarAsin 吞掉、Patent 上抛——保持原行为)
* - 下载 URL / 文件名兜底 / 进度 key 前缀、删除判定与本地清理
*
* 其余手写轮询的 Tab(DeleteBrand/PatrolDelete/QueryAsin/Withdraw 等)后续可渐进接入。
* 其余手写轮询的 Tab(QueryAsin/Withdraw 等)后续可渐进接入。
*/
/** 两个模块 history/progress item 的公共字段(SimilarAsinHistoryItem / AppearancePatentHistoryItem 结构一致) */
@@ -1,7 +1,7 @@
/**
* 任务队列在工具页之间的共享纯逻辑(2026-09 全维度审查 G3)。
*
* 7 个工具页(query-asin / withdraw / price-track / product-risk / patrol-delete / shop-match /
* 6 个工具页(query-asin / withdraw / price-track / product-risk / shop-match /
* shop-data-crawl)各有一份逐字重复的「任务开始时间 localStorage 持久化 + 记录缺失错误判定」实现。
* 这里先收敛**无副作用、无页面状态依赖**的部分:序列化/反序列化校验、开始时间表增删、
* 记录缺失错误判定。队列 worker 的状态机(谁在跑、防抖、轮询句柄)仍留在各页,
@@ -86,7 +86,7 @@ export function taskStatusClass(status?: string | null, overrides?: TaskStatusOp
}
/**
* 非终态一律显示「执行中」/ running 的页面(BrandWithdrawTab、BrandPatrolDeleteTab、
* 非终态一律显示「执行中」/ running 的页面(BrandWithdrawTab、
* BrandQueryAsinTab 原行为):只区分 SUCCESS/COMPLETED/FAILED 三种终态。
*
* 但"取消"不是"还没跑完":任务已经被撤掉了却说成执行中,用户会一直等一个不会来的结果
@@ -5,8 +5,8 @@
* PriceTrack / ProductRisk / ShopMatch 三页只认 `SUCCESS|FAILED`,另三页认 `SUCCESS|COMPLETED|FAILED`。
* 而 COMPLETED≡SUCCESS 在两头早就定了:本仓统一文案表 `shared/utils/task-status-text.ts`
* 把两者都映射成「已完成」/success 样式,后端看板 `TaskCenterQueryMapper.SUCCESS_STATUSES_ORDERED`
* 也是 List.of("SUCCESS","COMPLETED")。窄集合那三页一旦收到 COMPLETED(后端 delete-brand 链路
* 与本地会话态 `BrandDeleteBrandTab:611` 都会产出这个值)就会**一路空转到 30 次瞬断预算耗尽**,
* 也是 List.of("SUCCESS","COMPLETED")。窄集合那三页一旦收到 COMPLETED(后端某条链路
* 都会产出这个值)就会**一路空转到 30 次瞬断预算耗尽**,
* 用户看到的是"任务永远执行中",而服务端那边任务早就结束了。
*
* 除状态外的差异(取数方式、提示文案、页专属副作用)留在调用方回调里,本文件不统一它们:
@@ -1,20 +0,0 @@
import { ref, watch } from 'vue'
export type ZiniaoVersion = 'new' | 'old'
const STORAGE_KEY = 'ziniao:version'
function loadZiniaoVersion(): ZiniaoVersion {
if (typeof window === 'undefined') return 'new'
return window.localStorage.getItem(STORAGE_KEY) === 'old' ? 'old' : 'new'
}
export function useZiniaoVersion() {
const ziniaoVersion = ref<ZiniaoVersion>(loadZiniaoVersion())
watch(ziniaoVersion, (value) => {
if (typeof window !== 'undefined') window.localStorage.setItem(STORAGE_KEY, value)
})
return ziniaoVersion
}
@@ -11,9 +11,11 @@ import {
TOOL_MAP,
} from '../src/pages/amazon/tool-catalog.ts'
test('工具目录:20 个工具 id 唯一且每个都有图标与渐变配色', () => {
test('工具目录:18 个工具 id 唯一且每个都有图标与渐变配色', () => {
const ids = TOOL_GROUPS.flatMap((g) => g.tools.map((t) => t.id))
assert.equal(ids.length, 20, '工具总数应为 20(前端8 + 运营10 + 后勤2)')
// 2026-10-15 旧版界面退役:删除品牌(delasin)与巡店删除(patrol)两条目随功能摘除,
// 工具总数 20→18(前端8 + 运营8 + 后勤2)。
assert.equal(ids.length, 18, '工具总数应为 18(前端8 + 运营8 + 后勤2)')
assert.equal(new Set(ids).size, ids.length, '工具 id 不应重复')
for (const id of ids) {
assert.ok(TOOL_ICON_SHAPES[id], `图标形状缺失: ${id}`)
@@ -6,16 +6,17 @@ import { dirname, join } from 'node:path'
/**
* 「行数据按需拉取」接线守卫(审查 F5 后续):
* 5 个品牌工具页用轻量端点的结果行版本跳过重型 batch;这里守住两件最容易写错的事
* 品牌工具页用轻量端点的结果行版本跳过重型 batch;这里守住两件最容易写错的事
* ——①接线没被误删;②跳过分支的返回值必须符合调用方契约(曾经把 shopDataCrawl 写成裸 return,
* 而调用方 waitForTerminal 把 falsy 当「任务已消失 → FAILED」,会误杀正在跑的任务)。
*/
const PAGES_DIR = join(dirname(fileURLToPath(import.meta.url)), '../src/pages/brand/components')
// 2026-10-15 旧版界面退役:原第 3 个页签 BrandPatrolDeleteTab.vue(巡店删除)随功能
// 一并退役删除,接线名单 5→4;其余四页一字未动。
const WIRED_PAGES = [
'BrandQueryAsinTab.vue',
'BrandWithdrawTab.vue',
'BrandPatrolDeleteTab.vue',
'BrandShopDataCrawlTab.vue',
'BrandAppearancePatentTab.vue',
]
@@ -37,7 +38,7 @@ test('轻量请求失败必须回退为全量拉取(不得因此少拉任务
// 多任务页:catch 里把 heavyIds 还原成全部任务
// 回退必须写在 catch 体内:用 [^}] 锁住,否则窗口会跨过 catch 的右花括号,
// 把后面正常分支的 return(如 { taskIds, force: true })当成回退,断言恒真。
for (const page of ['BrandQueryAsinTab.vue', 'BrandWithdrawTab.vue', 'BrandPatrolDeleteTab.vue']) {
for (const page of ['BrandQueryAsinTab.vue', 'BrandWithdrawTab.vue']) {
assert.match(sourceOf(page), /catch\s*\{[^}]{0,200}?heavyIds = ids/, `${page} 缺少轻量失败回退`)
}
assert.match(sourceOf('BrandAppearancePatentTab.vue'),
@@ -57,8 +58,4 @@ test('跳过分支的返回值符合调用方契约', () => {
assert.match(shopDataCrawl, /selectTasksNeedingRows\([\s\S]{0,200}?return true/,
'BrandShopDataCrawlTab 跳过分支必须 return true(false/undefined 会被当成任务已消失)')
const patrolDelete = sourceOf('BrandPatrolDeleteTab.vue')
// waitForTaskTerminal: `missingTaskIds.includes(taskId)` —— 未消失时返回空数组
assert.match(patrolDelete, /selectTasksNeedingRows\([\s\S]{0,300}?return \[\]/,
'BrandPatrolDeleteTab 跳过分支必须返回空 missingTaskIds 数组')
})
-34
View File
@@ -8,10 +8,8 @@ const MODULE_KEYS = [
'split',
'convert',
'publish',
'deleteBrand',
'productRisk',
'shopMatch',
'patrolDelete',
'queryAsin',
'shopDataCrawl',
'withdraw',
@@ -80,8 +78,6 @@ test('test_progress_batch_paths_match_controllers', () => {
'/api/appearance-patent/tasks/progress/batch',
'/api/collect-data/tasks/progress/batch',
'/api/publish/tasks/progress/batch',
'/api/delete-brand/tasks/progress/batch',
'/api/patrol-delete/tasks/progress/batch',
'/api/price-track/tasks/progress/batch',
'/api/product-risk-resolve/tasks/progress/batch',
'/api/shop-match/tasks/progress/batch',
@@ -148,18 +144,6 @@ test('test_endpoints_frozen_snapshot', () => {
"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",
@@ -196,24 +180,6 @@ test('test_endpoints_frozen_snapshot', () => {
"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",
@@ -14,7 +14,6 @@ import { resolve, dirname } from 'node:path'
*/
const here = dirname(fileURLToPath(import.meta.url))
const priceTrack = readFileSync(resolve(here, '../src/pages/brand/components/BrandPriceTrackTab.vue'), 'utf8')
const deleteBrand = readFileSync(resolve(here, '../src/pages/brand/components/BrandDeleteBrandTab.vue'), 'utf8')
function bodyOf(source: string, startMarker: string, endMarker: string, label: string) {
const start = source.indexOf(startMarker)
@@ -58,17 +57,10 @@ test('price_track_still_compensates_hard_failures', () => {
'三处收尾:数据闸 / 桥异常 / 拒绝且不可等待')
})
test('delete_brand_tab_uses_the_shared_classifier', () => {
// 旧写法 includes('当前店铺正在执行中') 匹配不到带店名的文案(客户端两个互斥出口都带名),
// 自动续跑的"重试"闸因此从未生效过。
assert.doesNotMatch(deleteBrand, /includes\('当前店铺正在执行中'\)/, '仍在用匹配不到的中文串判互斥')
assert.doesNotMatch(deleteBrand, /function isQueueBusyError/, '旧判定函数应随之删除,别留死代码')
assert.match(deleteBrand, /classifyQueueRejection\(pushResult\)/, '没有改用共享分类器')
})
test('both_tabs_import_the_classifier', () => {
for (const [name, src] of [['BrandPriceTrackTab.vue', priceTrack], ['BrandDeleteBrandTab.vue', deleteBrand]] as const) {
assert.match(src, /classifyQueueRejection/, `${name} 未引用分类器`)
assert.match(src, /from '@\/shared\/dispatch-guard'/, `${name} 未从 dispatch-guard 导入`)
}
// 2026-10-15 旧版界面退役:原「两页都引分类器」的 BrandDeleteBrandTab.vue 随功能删除,
// 只剩跟价这一页(钉形状不变)。
test('price_track_tab_imports_the_classifier', () => {
assert.match(priceTrack, /classifyQueueRejection/, 'BrandPriceTrackTab.vue 未引用分类器')
assert.match(priceTrack, /from '@\/shared\/dispatch-guard'/, 'BrandPriceTrackTab.vue 未从 dispatch-guard 导入')
})
@@ -6,16 +6,17 @@ import { resolve, dirname } from 'node:path'
import { http } from '../src/shared/api/http.ts'
import { http as httpAgain } from '../src/shared/api/http.ts'
// 2026-10-15 旧版界面退役:'delete-brand' 模块随删除品牌功能删除,名单同步摘除。
const moduleFiles = [
'dedupe', 'split', 'convert', 'publish', 'similar-asin', 'appearance-patent',
'delete-brand', 'price-track', 'shop-match', 'query-asin', 'withdraw',
'price-track', 'shop-match', 'query-asin', 'withdraw',
'collect-data', 'image-video', 'brand', 'permission', 'digital-human',
]
const functionNames = [
'runDedupe', 'getSplitHistory', 'runConvert', 'parsePublish',
'parseSimilarAsin', 'parseAppearancePatent',
'runDeleteBrand', 'listPriceTrackCandidates', 'listProductRiskCandidates',
'listPriceTrackCandidates', 'listProductRiskCandidates',
'listShopMatchCandidates', 'listQueryAsinCandidates', 'listWithdrawCandidates',
'listShopDataCrawlCandidates', 'parseCollectData', 'getImageVideoSecretStatus',
'expandBrandFolderRecursive', 'getCurrentUserAppColumnKeys',
@@ -1,167 +0,0 @@
import { test } from 'node:test'
import assert from 'node:assert/strict'
import { http } from '../src/shared/api/http.ts'
import {
runDeleteBrand,
getDeleteBrandHistory,
deleteDeleteBrandHistory,
getDeleteBrandTaskDetail,
getDeleteBrandTaskDetails,
getDeleteBrandTaskDownloadUrl,
getDeleteBrandResultDownloadUrl,
submitDeleteBrandResult,
getDeleteBrandTaskProgress,
type DeleteBrandRunRequest,
type DeleteBrandSubmitResultRequest,
} from '../src/shared/api/types/modules/delete-brand.ts'
function setupWindow() {
;(globalThis as Record<string, unknown>).window = {
localStorage: { getItem: () => '42' },
location: { origin: 'http://localhost' },
}
}
function mockRequest(
t: Parameters<typeof test>[1] extends (t: infer T) => unknown ? T : never,
impl: (config: { url?: string; method?: string; params?: Record<string, unknown>; data?: unknown; timeout?: number }) => Promise<unknown>,
) {
t.mock.method(http, 'request', impl as never)
}
const okResponse = (data: unknown) => Promise.resolve({ data: { success: true, message: 'ok', data } })
const runRequest: Omit<DeleteBrandRunRequest, 'user_id'> = {
files: [{ fileKey: 'k1' }],
}
test('test_delete_brand_run_url_payload', async (t) => {
setupWindow()
let captured: { url?: string; method?: string; data?: unknown; timeout?: number } = {}
mockRequest(t, (config) => {
captured = config
return okResponse({ total: 1, successCount: 0, failedCount: 1, items: [] })
})
await runDeleteBrand(runRequest)
assert.equal(captured.url, '/newApi/api/delete-brand/run')
assert.equal(captured.method, 'POST')
assert.deepEqual(captured.data, { ...runRequest, user_id: 42 })
assert.equal(captured.timeout, 180000)
})
test('test_delete_brand_history', async (t) => {
setupWindow()
let captured: { url?: string; params?: Record<string, unknown> } = {}
mockRequest(t, (config) => {
captured = config
return okResponse({ items: [] })
})
await getDeleteBrandHistory()
assert.equal(captured.url, '/newApi/api/delete-brand/history')
assert.deepEqual(captured.params, { user_id: 42 })
})
test('test_delete_brand_delete_history', async (t) => {
setupWindow()
let captured: { url?: string; method?: string; params?: Record<string, unknown> } = {}
mockRequest(t, (config) => {
captured = config
return okResponse(null)
})
await deleteDeleteBrandHistory(7)
assert.equal(captured.url, '/newApi/api/delete-brand/history/7')
assert.equal(captured.method, 'DELETE')
assert.deepEqual(captured.params, { user_id: 42 })
})
test('test_delete_brand_task_detail', async (t) => {
setupWindow()
let captured: { url?: string } = {}
mockRequest(t, (config) => {
captured = config
return okResponse({ task: { id: 7 }, line_progress: { has_progress: true }, items: [] })
})
const result = await getDeleteBrandTaskDetail(7)
assert.equal(captured.url, '/newApi/api/delete-brand/tasks/7')
assert.equal(result.task.id, 7)
assert.equal(result.line_progress.has_progress, true)
})
test('test_delete_brand_task_details', async (t) => {
setupWindow()
let captured: { url?: string; method?: string; data?: unknown } = {}
mockRequest(t, (config) => {
captured = config
return okResponse({ items: [], missingTaskIds: [] })
})
await getDeleteBrandTaskDetails([5, 3])
assert.equal(captured.url, '/newApi/api/delete-brand/tasks/batch')
assert.equal(captured.method, 'POST')
assert.deepEqual(captured.data, { taskIds: [5, 3], userId: 42 })
})
test('test_delete_brand_task_download_url', async (t) => {
setupWindow()
assert.equal(
getDeleteBrandTaskDownloadUrl(7),
'http://localhost/newApi/api/delete-brand/tasks/7/download?user_id=42',
)
})
test('test_delete_brand_result_download_url', async (t) => {
setupWindow()
assert.equal(
getDeleteBrandResultDownloadUrl(9),
'http://localhost/newApi/api/delete-brand/results/9/download?user_id=42',
)
})
test('test_delete_brand_submit_result_body', async (t) => {
setupWindow()
let captured: { url?: string; method?: string; data?: unknown } = {}
mockRequest(t, (config) => {
captured = config
return okResponse(null)
})
const body: DeleteBrandSubmitResultRequest = {
submissionId: 'sub-1',
files: [{ sourceFilename: 'a.xlsx', countries: [] }],
}
await submitDeleteBrandResult(7, body)
assert.equal(captured.url, '/newApi/api/delete-brand/tasks/7/result')
assert.equal(captured.method, 'POST')
assert.deepEqual(captured.data, body)
})
test('test_delete_brand_progress_batch', async (t) => {
setupWindow()
let captured: { url?: string; method?: string; data?: unknown; timeout?: number } = {}
mockRequest(t, (config) => {
captured = config
return okResponse({ items: [], missingTaskIds: [] })
})
const result = await getDeleteBrandTaskProgress([5, 3])
assert.equal(captured.url, '/newApi/api/delete-brand/tasks/progress/batch')
assert.equal(captured.method, 'POST')
assert.deepEqual(captured.data, { taskIds: [3, 5], userId: 42 })
assert.equal(captured.timeout, 10000)
assert.deepEqual(result, { items: [], missingTaskIds: [] })
})
test('test_delete_brand_export_compat', async (t) => {
setupWindow()
const fromJavaModules = await import('../src/shared/api/java-modules.ts')
const fromDeleteBrand = await import('../src/shared/api/types/modules/delete-brand.ts')
const names = [
'runDeleteBrand', 'getDeleteBrandHistory', 'deleteDeleteBrandHistory',
'getDeleteBrandTaskDetail', 'getDeleteBrandTaskDetails', 'getDeleteBrandTaskDownloadUrl',
'getDeleteBrandResultDownloadUrl', 'submitDeleteBrandResult', 'getDeleteBrandTaskProgress',
]
for (const name of names) {
assert.equal(fromJavaModules[name], fromDeleteBrand[name], `${name} 应为同一引用`)
}
const item = { id: 1, taskNo: 'T1', status: 'RUNNING' }
assert.equal(item.taskNo, 'T1')
const status: 'MATCHED' | 'PENDING' = 'MATCHED'
assert.equal(status, 'MATCHED')
})
+3 -103
View File
@@ -15,21 +15,6 @@ import {
getWithdrawResultDownloadUrl,
deleteWithdrawTask,
deleteWithdrawHistory,
listPatrolDeleteCandidates,
addPatrolDeleteCandidate,
deletePatrolDeleteCandidate,
listPatrolDeleteConditions,
addPatrolDeleteCondition,
deletePatrolDeleteCondition,
matchPatrolDeleteShops,
getPatrolDeleteDashboard,
getPatrolDeleteHistory,
getPatrolDeleteTaskProgressBatch,
createPatrolDeleteTask,
submitPatrolDeleteTaskResult,
getPatrolDeleteResultDownloadUrl,
deletePatrolDeleteTask,
deletePatrolDeleteHistory,
} from '../src/shared/api/types/modules/withdraw.ts'
function setupWindow() {
@@ -141,91 +126,12 @@ test('test_withdraw_match', async (t) => {
assert.deepEqual(calls[0].data, { user_id: 42, shop_names: ['店铺A'] })
})
test('test_patrol_delete_candidates_conditions', async (t) => {
setupWindow()
const calls: { url?: string; method?: string; params?: Record<string, unknown>; data?: unknown }[] = []
mockRequest(t, (config) => {
calls.push(config)
return okResponse({ id: 1, shop_name: 's1' })
})
await listPatrolDeleteCandidates()
await addPatrolDeleteCandidate('店铺A')
await deletePatrolDeleteCandidate(3)
await listPatrolDeleteConditions()
await addPatrolDeleteCondition('条件X')
await deletePatrolDeleteCondition(5)
assert.equal(calls[0].url, '/newApi/api/patrol-delete/candidates')
assert.deepEqual(calls[0].params, { user_id: 42 })
assert.equal(calls[1].url, '/newApi/api/patrol-delete/candidates')
assert.equal(calls[1].method, 'POST')
assert.deepEqual(calls[1].data, { user_id: 42, shop_name: '店铺A' })
assert.equal(calls[2].url, '/newApi/api/patrol-delete/candidates/3')
assert.equal(calls[2].method, 'DELETE')
assert.equal(calls[3].url, '/newApi/api/patrol-delete/conditions')
assert.deepEqual(calls[3].params, { user_id: 42 })
assert.equal(calls[4].url, '/newApi/api/patrol-delete/conditions')
assert.equal(calls[4].method, 'POST')
assert.deepEqual(calls[4].data, { user_id: 42, conditionText: '条件X' })
assert.equal(calls[5].url, '/newApi/api/patrol-delete/conditions/5')
assert.equal(calls[5].method, 'DELETE')
})
test('test_patrol_delete_create_submit', async (t) => {
setupWindow()
const calls: { url?: string; method?: string; data?: unknown }[] = []
mockRequest(t, (config) => {
calls.push(config)
return okResponse({ taskId: 1, items: [] })
})
const item = {
shopName: '店铺A',
matched: true,
countrySections: [{ country: 'US', rows: [{ status: 'ok', quantity: '1', deleteQuantity: '0', processStatus: 'done' }] }],
cartRatios: [{ country: 'US', ratio: '0.5' }],
}
await createPatrolDeleteTask([item])
assert.equal(calls[0].url, '/newApi/api/patrol-delete/tasks')
assert.equal(calls[0].method, 'POST')
assert.deepEqual(calls[0].data, { user_id: 42, items: [item], delete_conditions: [] })
const payload = { shops: [{ shopName: '店铺A', countrySections: item.countrySections, cartRatios: item.cartRatios, shopDone: true, chunkIndex: 0, chunkTotal: 1 }] }
await submitPatrolDeleteTaskResult(7, payload)
assert.equal(calls[1].url, '/newApi/api/patrol-delete/tasks/7/result')
assert.deepEqual(calls[1].data, payload)
})
test('test_patrol_delete_progress_dashboard_download', async (t) => {
setupWindow()
const calls: { url?: string; method?: string; data?: unknown; timeout?: number; params?: Record<string, unknown> }[] = []
mockRequest(t, (config) => {
calls.push(config)
return okResponse({ items: [], missingTaskIds: [] })
})
await getPatrolDeleteTaskProgressBatch([5, 3])
await getPatrolDeleteDashboard()
await getPatrolDeleteHistory()
await matchPatrolDeleteShops(['店铺A'])
await deletePatrolDeleteTask(7)
await deletePatrolDeleteHistory(9)
assert.equal(calls[0].url, '/newApi/api/patrol-delete/tasks/progress/batch')
assert.equal(calls[0].method, 'POST')
assert.deepEqual(calls[0].data, { taskIds: [3, 5], userId: 42 })
assert.equal(calls[0].timeout, 10000)
assert.equal(calls[1].url, '/newApi/api/patrol-delete/dashboard')
assert.deepEqual(calls[1].params, { user_id: 42 })
assert.equal(calls[2].url, '/newApi/api/patrol-delete/history')
assert.equal(calls[3].url, '/newApi/api/patrol-delete/match-shops')
assert.deepEqual(calls[3].data, { user_id: 42, shop_names: ['店铺A'] })
assert.equal(calls[4].url, '/newApi/api/patrol-delete/tasks/7')
assert.equal(calls[4].method, 'DELETE')
assert.equal(calls[5].url, '/newApi/api/patrol-delete/history/9')
assert.equal(calls[5].method, 'DELETE')
assert.equal(
getPatrolDeleteResultDownloadUrl(7),
'http://localhost/newApi/api/patrol-delete/results/7/download?user_id=42',
)
})
test('test_withdraw_patrol_export_compat', async (t) => {
// 2026-10-15 旧版界面退役:巡店删除的 15 个 API 函数随功能从 withdraw.ts 切掉,
// 本格只剩提款一组(原 test_withdraw_patrol_export_compat)。
test('test_withdraw_export_compat', async (t) => {
setupWindow()
const fromJavaModules = await import('../src/shared/api/java-modules.ts')
const fromWithdraw = await import('../src/shared/api/types/modules/withdraw.ts')
@@ -235,12 +141,6 @@ test('test_withdraw_patrol_export_compat', async (t) => {
'getWithdrawHistory', 'getWithdrawTaskProgressBatch', 'createWithdrawTask',
'submitWithdrawTaskResult', 'getWithdrawResultDownloadUrl',
'deleteWithdrawTask', 'deleteWithdrawHistory',
'listPatrolDeleteCandidates', 'addPatrolDeleteCandidate', 'deletePatrolDeleteCandidate',
'listPatrolDeleteConditions', 'addPatrolDeleteCondition', 'deletePatrolDeleteCondition',
'matchPatrolDeleteShops', 'getPatrolDeleteDashboard', 'getPatrolDeleteHistory',
'getPatrolDeleteTaskProgressBatch', 'createPatrolDeleteTask',
'submitPatrolDeleteTaskResult', 'getPatrolDeleteResultDownloadUrl',
'deletePatrolDeleteTask', 'deletePatrolDeleteHistory',
]
for (const name of names) {
assert.equal(fromJavaModules[name], fromWithdraw[name], `${name} 应为同一引用`)
+4 -3
View File
@@ -29,8 +29,9 @@ function mockRequest(
const okResponse = (data: unknown) => Promise.resolve({ data: { success: true, message: 'ok', data } })
// 2026-10-15 旧版界面退役:deleteBrand 与 patrolDelete 两模块随功能摘除(12→10)。
const LIGHT_MODULES: ProgressLightModule[] = [
'publish', 'deleteBrand', 'productRisk', 'shopMatch', 'patrolDelete',
'publish', 'productRisk', 'shopMatch',
'queryAsin', 'shopDataCrawl', 'withdraw', 'priceTrack', 'similarAsin',
'appearancePatent', 'collectData',
]
@@ -153,11 +154,11 @@ test('test_light_snapshot', async (t) => {
return okResponse({ items: [{ taskId: 1, status: 'RUNNING', fileReady: false }], missingTaskIds: [] })
})
await getModuleProgressLight('appearancePatent', [1], { force: true })
await getModuleProgressLight('deleteBrand', [2], { force: true })
await getModuleProgressLight('queryAsin', [2], { force: true })
assert.equal(calls[0].url, '/newApi/api/appearance-patent/tasks/progress/light')
assert.equal(calls[0].method, 'POST')
assert.deepEqual(calls[0].data, { taskIds: [1] })
assert.equal(calls[1].url, '/newApi/api/delete-brand/tasks/progress/light')
assert.equal(calls[1].url, '/newApi/api/query-asin/tasks/progress/light')
assert.deepEqual(calls[1].data, { taskIds: [2] })
})
@@ -7,7 +7,7 @@ import { join } from 'node:path'
* 任务卡片的「进度条接线」普查。
*
* 为什么要它:TaskItemView.progress 是可空字段,页面少写一行不会报错、不会红,
* 界面上就是安静地没有进度条。11 个任务页各写一处,漏哪一处全靠这条出声。
* 界面上就是安静地没有进度条。每个任务页各写一处,漏哪一处全靠这条出声。
*
* 分母不手抄:扫 src/pages/brand/components 下所有写了 `to*TaskView(...): TaskItemView`
* 适配器的页面,清单由文件系统给出;再把总数硬钉住——新增页面没接进度、或有人把
@@ -41,7 +41,9 @@ const pages = readdirSync(COMPONENTS).filter((name) => name.endsWith('.vue'))
const seen = pages.flatMap((file) => adaptersOf(file).map((a) => ({ file, ...a })))
test('被扫描的任务卡适配器数量必须硬钉(少扫或多扫都说明扫描面变了)', () => {
assert.equal(seen.length, 16, `扫到 ${seen.length} 个 to*TaskView 适配器:${seen.map((s) => `${s.file}#${s.name}`).join(', ')}`)
// 2026-10-15 旧版界面退役:BrandDeleteBrandTab 与 BrandPatrolDeleteTab 两页删除,
// 适配器 16→14(少扫或多扫都说明扫描面变了)。
assert.equal(seen.length, 14, `扫到 ${seen.length} 个 to*TaskView 适配器:${seen.map((s) => `${s.file}#${s.name}`).join(', ')}`)
})
test('每个任务卡适配器都必须给出进度读数,或明确给出 null', () => {
@@ -18,8 +18,8 @@ const root = resolve(here, '..')
const rel = (p: string) => relative(root, p).split(sep).join('/')
const SRC_FILES = listSourceFiles(resolve(root, 'src')).map(rel)
// 2026-10-15 旧版界面退役:BrandPatrolDeleteTab.vue(巡店删除)随功能删除,六页→五页。
const TABS = [
'BrandPatrolDeleteTab.vue',
'BrandPriceTrackTab.vue',
'BrandProductRiskTab.vue',
'BrandQueryAsinTab.vue',
@@ -40,8 +40,6 @@ const TABS = [
const NARROW_LEDGER: Record<string, number> = {
'src/pages/brand/components/BrandAppearancePatentTab.vue': 3,
'src/pages/brand/components/BrandCollectDataTab.vue': 2,
'src/pages/brand/components/BrandDeleteBrandTab.vue': 2,
'src/pages/brand/components/BrandPatrolDeleteTab.vue': 1,
'src/pages/brand/components/BrandPriceTrackTab.vue': 6,
'src/pages/brand/components/BrandProductRiskTab.vue': 2,
'src/pages/brand/components/BrandSimilarAsinTab.vue': 1,
@@ -177,7 +175,7 @@ test('全 src 窄集合只许减:逐文件台账 + 分母自证', () => {
}
})
test('六个 Tab 的每条等待函数都真的走骨架(按 AST 认函数,不靠签名切字符串)', () => {
test('五个 Tab 的每条等待函数都真的走骨架(按 AST 认函数,不靠签名切字符串)', () => {
const offenders: string[] = []
const seen: string[] = []
for (const tab of TABS) {