refactor(fulfillment): 移除飞飞/乐玩通道,仅保留 affiliate_dash
新单只路由 affiliate_dash(未命中走 manual_dispatch);历史飞飞/乐玩任务保留只读 stub,避免订单重同步失败。同步清理 cloudtentacles 调度、Admin 写路径与相关 env。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import test from 'node:test'
|
||||
|
||||
import { normalizeScheduledJobsConfig } from './config-service.js'
|
||||
|
||||
test('normalizeScheduledJobsConfig 将旧版 cloudtentacles 阈值迁移为默认账号配置', () => {
|
||||
test('normalizeScheduledJobsConfig drops retired cloudtentacles_health jobs', () => {
|
||||
const config = normalizeScheduledJobsConfig({
|
||||
enabled: true,
|
||||
jobs: [
|
||||
@@ -11,97 +11,34 @@ test('normalizeScheduledJobsConfig 将旧版 cloudtentacles 阈值迁移为默
|
||||
id: 'cloudtentacles-health',
|
||||
type: 'cloudtentacles_health',
|
||||
enabled: true,
|
||||
intervalSeconds: 18000,
|
||||
cooldownSeconds: 1800,
|
||||
config: {
|
||||
assetThreshold: 100,
|
||||
},
|
||||
intervalSeconds: 300,
|
||||
config: { assetThreshold: 100 },
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
assert.deepEqual(config.jobs[0], {
|
||||
id: 'cloudtentacles-health',
|
||||
type: 'cloudtentacles_health',
|
||||
enabled: true,
|
||||
intervalSeconds: 18000,
|
||||
cooldownSeconds: 1800,
|
||||
config: {
|
||||
assetThreshold: 100,
|
||||
accounts: [
|
||||
{
|
||||
sourceKey: 'default',
|
||||
label: '',
|
||||
enabled: true,
|
||||
assetThreshold: 100,
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
test('normalizeScheduledJobsConfig 支持多账号去重并保留 0 阈值', () => {
|
||||
const config = normalizeScheduledJobsConfig({
|
||||
jobs: [
|
||||
{
|
||||
id: 'cloudtentacles-health',
|
||||
type: 'cloudtentacles_health',
|
||||
id: 'work-order-timeout',
|
||||
type: 'work_order_timeout',
|
||||
enabled: true,
|
||||
intervalSeconds: 30,
|
||||
cooldownSeconds: 10,
|
||||
config: {
|
||||
assetThreshold: 500,
|
||||
accounts: [
|
||||
{
|
||||
sourceKey: 'default',
|
||||
label: '默认账号',
|
||||
enabled: true,
|
||||
assetThreshold: 0,
|
||||
},
|
||||
{
|
||||
sourceKey: 'default',
|
||||
label: '重复账号',
|
||||
enabled: false,
|
||||
assetThreshold: 999,
|
||||
},
|
||||
{
|
||||
sourceKey: 'account2',
|
||||
enabled: false,
|
||||
threshold: 200,
|
||||
},
|
||||
],
|
||||
},
|
||||
intervalSeconds: 60,
|
||||
config: { scanLimit: 50 },
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
assert.deepEqual(config.jobs[0].config.accounts, [
|
||||
{
|
||||
sourceKey: 'default',
|
||||
label: '默认账号',
|
||||
enabled: true,
|
||||
assetThreshold: 0,
|
||||
},
|
||||
{
|
||||
sourceKey: 'account2',
|
||||
label: '',
|
||||
enabled: false,
|
||||
assetThreshold: 200,
|
||||
},
|
||||
])
|
||||
assert.equal(config.jobs[0].intervalSeconds, 60)
|
||||
assert.equal(config.jobs[0].cooldownSeconds, 60)
|
||||
assert.equal(
|
||||
config.jobs.some((item) => item.type === 'cloudtentacles_health'),
|
||||
false,
|
||||
)
|
||||
assert.equal(
|
||||
config.jobs.some((item) => item.id === 'work-order-timeout'),
|
||||
true,
|
||||
)
|
||||
})
|
||||
|
||||
test('normalizeScheduledJobsConfig 自动补齐数据保留清理任务', () => {
|
||||
test('normalizeScheduledJobsConfig ensures default jobs exist', () => {
|
||||
const config = normalizeScheduledJobsConfig({ enabled: true, jobs: [] })
|
||||
const retentionJob = config.jobs.find((job) => job.type === 'data_retention')
|
||||
|
||||
assert.deepEqual(retentionJob, {
|
||||
id: 'data-retention',
|
||||
type: 'data_retention',
|
||||
enabled: true,
|
||||
intervalSeconds: 86400,
|
||||
config: {},
|
||||
})
|
||||
const ids = config.jobs.map((item) => item.id)
|
||||
assert.ok(ids.includes('work-order-timeout'))
|
||||
assert.ok(ids.includes('deposit-unfreeze'))
|
||||
assert.ok(ids.includes('data-retention'))
|
||||
assert.ok(ids.includes('pdd_order_sync'))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user