feat(collect-routing): 前端按服务端开关分流「启动」到本地客户端或后台

- 新增 GET /api/collect-routing 封装与类型,两个工具页进页各读一次
- 外观专利页恢复本地推送链路(取队列载荷 → guard → activate → enqueue_json),
  开关关闭时退回「提交后台执行」;按钮与提示文案随开关切换
- 相似ASIN 开关关闭时只建单不推队列,等 Linux 后台认领
- queue-payload / activate 端点与 DTO 从 943cf2d62^ 原样恢复
- catch 棘轮 blocks 301→303:新增两支都有用户可见出口,silent 未变
This commit is contained in:
2026-10-29 20:35:25 +08:00
parent 39c01ada44
commit 4d38781005
9 changed files with 283 additions and 11 deletions
@@ -6,6 +6,8 @@ import {
getAppearancePatentDashboard,
getAppearancePatentHistory,
getAppearancePatentTaskProgressBatch,
getAppearancePatentQueuePayload,
activateAppearancePatentTask,
deleteAppearancePatentTask,
deleteAppearancePatentHistory,
getAppearancePatentResultDownloadUrl,
@@ -92,6 +94,31 @@ test('test_appearance_patent_delete_task_history', async (t) => {
assert.deepEqual(calls[1].params, { user_id: 42 })
})
test('test_appearance_patent_queue_payload_url', async (t) => {
setupWindow()
let captured: { url?: string; method?: string; params?: Record<string, unknown> } = {}
mockRequest(t, (config) => {
captured = config
return okResponse({ groups: [] })
})
await getAppearancePatentQueuePayload(7)
assert.equal(captured.url, '/newApi/api/appearance-patent/tasks/7/queue-payload')
assert.equal(captured.method, 'GET')
assert.deepEqual(captured.params, { user_id: 42 })
})
test('test_appearance_patent_activate', async (t) => {
setupWindow()
let captured: { url?: string; method?: string } = {}
mockRequest(t, (config) => {
captured = config
return okResponse(null)
})
await activateAppearancePatentTask(7)
assert.equal(captured.url, '/newApi/api/appearance-patent/tasks/7/activate?user_id=42')
assert.equal(captured.method, 'POST')
})
test('test_appearance_patent_download_url', async (t) => {
setupWindow()
const url = getAppearancePatentResultDownloadUrl(7)
@@ -105,6 +132,7 @@ test('test_appearance_patent_export_compat', async (t) => {
const names = [
'parseAppearancePatent',
'getAppearancePatentDashboard', 'getAppearancePatentHistory', 'getAppearancePatentTaskProgressBatch',
'getAppearancePatentQueuePayload', 'activateAppearancePatentTask',
'deleteAppearancePatentTask', 'deleteAppearancePatentHistory',
'getAppearancePatentResultDownloadUrl',
]