feat(jd-collect): 建单页按京麦店内分类多选采集
客户口径「类目不需要只要分类」「做成多选的」:采集建单页下线类目级联与平台分组, 换京麦「店内分类」快照多选(getShopCategoryList 2026-11-16 取证 9 个,见 ops docs/jd-collect-api-contract.md §2.6)。建单请求体/页面推送/兜底拉取三处同键 shopCategoryNames+shopCategoryIds(label+id 双键,行级填充形状未取证,客户端任一 命中即命中);categoryPaths 标 @Deprecated 仅历史行兼容。超长归一化文案泛化为 normalizeStringSelection;历史行 VO 带回双键供重试/继续同源。 删除建单页唯一消费方的死件:JdCategoryCascader.vue/jd-category-tree.ts/其测试 (后管另有在用副本,不受影响)。 判据:JdCollectTaskServiceTest 三例(双键归一化/空白归 null/51 个拒)+ JdTaskPullSpiImplTest 七键载荷透传;前端 jd-collect-tab/jd-shop-category/mount 三支(快照消费、双键同链、绊线:级联组件与分组接口不得回流建单页)。 可读棘轮:JdCollectTab.vue 804→786 行(同款返回按钮 CSS 合并、死 .download 类删除)。 客户端侧(app_client jd_base 行级过滤)同窗另一仓提交。
This commit is contained in:
@@ -40,40 +40,44 @@ test('endpoints 注册 jdCollect 端点组', () => {
|
||||
'endpoints.ts 缺 jdCollect 端点组(建单/心跳/回传三件)')
|
||||
})
|
||||
|
||||
/** 2026-11-16 用户口径「客户端前端也要同步加上京东类目」:建单页多选末级类目随链下发。
|
||||
* 三处同键契约(建单请求体 / 推送载荷 / 历史行带回)缺一处,客户端就按全店采集跑。 */
|
||||
test('endpoints 注册采集类目 categories 下拉端点', () => {
|
||||
/** 2026-11-16 建单页采集范围换成京麦「店内分类」多选(客户口径「类目不需要只要分类」
|
||||
* 「选京麦的内部分类去采集」+「做成多选的」)。三处同键契约(建单请求体 / 推送载荷 /
|
||||
* 历史行带回)缺一处,客户端就按全店采集跑。 */
|
||||
test('endpoints 注册采集类目 categories 端点(数据面保留)', () => {
|
||||
const endpoints = readIfExists(ENDPOINTS, 'endpoints.ts')
|
||||
assert.ok(endpoints.includes("categories: '/api/jd-collect/categories'"),
|
||||
'endpoints.ts jdCollect 组缺 categories(建单页类目多选面板的选项源)')
|
||||
'endpoints.ts jdCollect 组仍须登记 categories(冻结快照口径;建单页 UI 已下线,仅数据面保留)')
|
||||
})
|
||||
|
||||
/** 2026-11-16 客户口径「管理员弄了多少店铺分类 普通账户都能看到」:普通账号在
|
||||
* 「获取店铺数据」页就能看到管理员在后管京东数据库建的分类全集与各组商品数;
|
||||
* 本页只读——分类的增删改仍只在后管。「商品上架」落地后消费同一端点。 */
|
||||
test('endpoints 注册店铺分类 groups 只读端点,页面加载并只读展示', () => {
|
||||
/** 2026-11-16 口径修订:客户参照系是京麦后台的「店内分类」,平台分组 chips 从本页下线
|
||||
* (分组数据面归后管京东数据库与商品上架,端点与 fetch 函数保留)。 */
|
||||
test('分类多选来自京麦店内分类快照,平台分组从本页下线', () => {
|
||||
const endpoints = readIfExists(ENDPOINTS, 'endpoints.ts')
|
||||
assert.ok(endpoints.includes("groups: '/api/jd-collect/groups'"),
|
||||
'endpoints.ts jdCollect 组缺 groups(店铺分类只读列表的选项源)')
|
||||
'endpoints.ts jdCollect 组仍须登记 groups(冻结快照口径;建单页 UI 已下线,仅数据面保留)')
|
||||
|
||||
const api = readIfExists(
|
||||
join(process.cwd(), 'src', 'shared', 'api', 'types', 'modules', 'jd-collect.ts'),
|
||||
'jd-collect.ts',
|
||||
)
|
||||
assert.ok(api.includes('export function fetchJdCollectGroups'),
|
||||
'jd-collect.ts 缺 fetchJdCollectGroups(页面取分类列表的发送口)')
|
||||
'jd-collect.ts 保留 fetchJdCollectGroups(上架/数据面消费,非建单页)')
|
||||
|
||||
const page = readIfExists(
|
||||
join(process.cwd(), 'src', 'pages', 'jd', 'JdCollectTab.vue'),
|
||||
'JdCollectTab.vue',
|
||||
)
|
||||
assert.ok(page.includes('fetchJdCollectGroups'),
|
||||
'JdCollectTab.vue 必须调 fetchJdCollectGroups(普通账号在这里看到管理员建的分类)')
|
||||
assert.ok(page.includes('自定义分类</span>'),
|
||||
'JdCollectTab.vue 必须以「自定义分类」展示分类块')
|
||||
assert.ok(page.includes('JD_SHOP_CATEGORY_SNAPSHOT'),
|
||||
'JdCollectTab.vue 必须消费京麦店内分类快照(jd-shop-category.ts)作采集分类多选选项')
|
||||
assert.ok(page.includes('采集分类(可选,多选)'),
|
||||
'JdCollectTab.vue 必须以「采集分类(可选,多选)」展示分类块')
|
||||
assert.ok(!page.includes('JdCategoryCascader'),
|
||||
'JdCollectTab.vue 不得再引用类目级联(2026-11-16 客户口径「类目不需要」)')
|
||||
assert.ok(!page.includes('fetchJdCollectGroups'),
|
||||
'JdCollectTab.vue 不得再消费平台分组接口(两套「分类」并存必混)')
|
||||
})
|
||||
|
||||
test('建单请求体与推送载荷都带 categoryPaths', () => {
|
||||
test('建单请求体与推送载荷都带店内分类双键', () => {
|
||||
const api = readIfExists(
|
||||
join(process.cwd(), 'src', 'shared', 'api', 'types', 'modules', 'jd-collect.ts'),
|
||||
'jd-collect.ts',
|
||||
@@ -82,20 +86,20 @@ test('建单请求体与推送载荷都带 categoryPaths', () => {
|
||||
const apiEnd = api.indexOf('export interface JdCollectDashboardVo')
|
||||
assert.ok(apiStart > 0 && apiEnd > apiStart, 'jd-collect.ts 缺 createJdCollectTask')
|
||||
const apiBody = api.slice(apiStart, apiEnd)
|
||||
assert.ok(apiBody.includes('categoryPaths'),
|
||||
'createJdCollectTask 请求体必须带 categoryPaths(空数组=全店采集)')
|
||||
assert.ok(apiBody.includes('shopCategoryNames') && apiBody.includes('shopCategoryIds'),
|
||||
'createJdCollectTask 请求体必须带店内分类双键(label+id 同发:行级填充形状未取证,任一键命中即命中)')
|
||||
|
||||
const page = readIfExists(
|
||||
join(process.cwd(), 'src', 'pages', 'jd', 'JdCollectTab.vue'),
|
||||
'JdCollectTab.vue',
|
||||
)
|
||||
assert.ok(page.includes('maxProducts: 0, categoryPaths }'),
|
||||
'推送载荷 data 必须带 categoryPaths(与后端 JdTaskPullSpiImplTest 键集断言同键)')
|
||||
assert.ok(page.includes('createJdCollectTask(shop, tabs, 0, categories)'),
|
||||
'startCollect 建单必须把选中的类目传给 createJdCollectTask')
|
||||
assert.ok(page.includes('maxProducts: 0, shopCategoryNames, shopCategoryIds }'),
|
||||
'推送载荷 data 必须带店内分类双键(与后端 JdTaskPullSpiImplTest 键集断言同键)')
|
||||
assert.ok(page.includes('createJdCollectTask(shop, tabs, 0, [], shopNames, shopIds)'),
|
||||
'startCollect 建单必须把选中的分类(names+ids)传给 createJdCollectTask')
|
||||
})
|
||||
|
||||
test('重试/继续从历史行同源带回 categoryPaths', () => {
|
||||
test('重试/继续从历史行同源带回店内分类双键', () => {
|
||||
const page = readIfExists(
|
||||
join(process.cwd(), 'src', 'pages', 'jd', 'JdCollectTab.vue'),
|
||||
'JdCollectTab.vue',
|
||||
@@ -103,8 +107,8 @@ test('重试/继续从历史行同源带回 categoryPaths', () => {
|
||||
const startAt = page.indexOf('async function retryTaskRecord')
|
||||
assert.ok(startAt > 0, 'JdCollectTab.vue 缺 retryTaskRecord')
|
||||
const body = page.slice(startAt, page.indexOf('/** 手动刷新'))
|
||||
assert.ok(body.includes('item?.categoryPaths ?? []'),
|
||||
'重试/继续重建推送载荷必须从历史行带回 categoryPaths(后端 history VO 同源字段),缺了客户端会按全店采集跑')
|
||||
assert.ok(body.includes('item?.shopCategoryNames ?? []') && body.includes('item?.shopCategoryIds ?? []'),
|
||||
'重试/继续重建推送载荷必须从历史行带回店内分类双键(后端 history VO 同源字段),缺了客户端会按全店采集跑')
|
||||
})
|
||||
|
||||
/** 2026-11-14 真机实录:建单请求体写成 `user_id` 时后端回一句「user_id 不合法」直接拒,
|
||||
|
||||
Reference in New Issue
Block a user