feat(jd): 普通账号在京东侧可见管理员店铺分类(2026-11-16 客户口径「管理员弄了多少店铺分类 普通账户都能看到」)——服务端新增 GET /api/jd-collect/groups 只读端点(复用 JdProductGroupService.list,requireOwnershipUserId fail-closed,与 categories 同形,无公司维度:分类是平台级全集);用户端「获取店铺数据」页加载即拉取,只读 chips 展示分类名+商品数(title 带明细),空态点名「管理员在京东数据库→店铺分类建」,拉取失败 warning 不阻塞采集主路(catch 棘轮 318→319 逐条点名);endpoints 冻结快照随带 dated 追加。判据:mvn -o test JdCollectGroupsEndpointTest 2/2;vue-tsc rc=0;node --test 定向 21/21;vitest mount 11/11(+2:chips 渲染带 count/空态提示);fast 闸门 overall=pass 四面绿;JdCollectTab.vue 791<800 棘轮线。商品上架侧落地时消费同一端点(欠账入 ops BACKLOG B113)
This commit is contained in:
@@ -9,10 +9,12 @@ import {
|
||||
deleteJdCollectTask,
|
||||
fetchJdCollectCategories,
|
||||
fetchJdCollectDashboard,
|
||||
fetchJdCollectGroups,
|
||||
fetchJdCollectHistory,
|
||||
fetchJdCollectTaskProgressBatch,
|
||||
interruptJdCollectTask,
|
||||
type JdCollectCategoryVo,
|
||||
type JdCollectGroupVo,
|
||||
type JdCollectHistoryItemVo,
|
||||
type JdListTab,
|
||||
} from '@/shared/api/types/modules/jd-collect'
|
||||
@@ -37,6 +39,9 @@ import JdCategoryCascader from './JdCategoryCascader.vue'
|
||||
* 卡片只显示已采集行数,不编造百分比;
|
||||
* 4. 失败/中断任务「重试/继续」走通用原位复位(铁律 26,保留已收分片与断点游标),
|
||||
* 复位后页面重新激活并推队列——同一份输入不再多出好几行结果。
|
||||
*
|
||||
* 2026-11-16 客户口径「管理员弄了多少店铺分类 普通账户都能看到」:左面板加只读「店铺分类」
|
||||
* 块(GET /api/jd-collect/groups,管理员在后管京东数据库维护);「商品上架」落地后消费同一端点。
|
||||
*/
|
||||
|
||||
/** 页面不再让用户填店铺名:店铺名称由客户端从京麦后台读,建单先按此占位记录。 */
|
||||
@@ -76,6 +81,21 @@ function uidForStorage() {
|
||||
return typeof window !== 'undefined' ? window.localStorage.getItem('uid') || '0' : '0'
|
||||
}
|
||||
|
||||
// ---- 店铺分类(管理员在后管「京东数据库」维护,本页只读展示;2026-11-16 客户口径
|
||||
// 「管理员弄了多少店铺分类 普通账户都能看到」——普通账号在「获取店铺数据」页就能看到
|
||||
// 分类全集与各组商品数。分类的增删改仍只在后管;「商品上架」落地后消费同一端点。)----
|
||||
const groupList = ref<JdCollectGroupVo[]>([])
|
||||
|
||||
async function loadGroups() {
|
||||
try {
|
||||
groupList.value = await fetchJdCollectGroups()
|
||||
} catch (err) {
|
||||
// 分类只是展示项:拉不到就保持空态文案,不把采集主路堵死(同 loadCategoryOptions 口径)。
|
||||
console.error('[jd-collect] 店铺分类拉取失败', err)
|
||||
ElMessage.warning('店铺分类加载失败,不影响采集')
|
||||
}
|
||||
}
|
||||
|
||||
// ---- 实时任务面板(与外观专利共用 useLiveTaskBoard 骨架;京东无结果文件,无下载层)----
|
||||
const board = useLiveTaskBoard<JdCollectHistoryItemVo>({
|
||||
scope: 'jd-collect',
|
||||
@@ -366,6 +386,7 @@ onMounted(async () => {
|
||||
board.loadDashboard().catch(() => undefined),
|
||||
board.loadHistory().catch(() => undefined),
|
||||
loadCategoryOptions(),
|
||||
loadGroups(),
|
||||
])
|
||||
board.seedRunningTasksFromHistory()
|
||||
board.seedPendingFileTasksFromHistory()
|
||||
@@ -420,6 +441,19 @@ onUnmounted(() => {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="category-block">
|
||||
<span class="category-label">店铺分类(管理员维护,只读)</span>
|
||||
<p v-if="groupList.length" class="group-chips">
|
||||
<span v-for="group in groupList" :key="group.id" class="group-chip"
|
||||
:title="`${group.name}:${group.productCount} 个商品`">
|
||||
{{ group.name }}({{ group.productCount }})
|
||||
</span>
|
||||
</p>
|
||||
<p v-else class="category-hint">
|
||||
后台还没建店铺分类;管理员在「京东数据库 → 店铺分类」里建的会显示在这里。
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<button class="collect-btn" type="button" :disabled="isRunning" @click="startCollect">
|
||||
{{ isRunning ? '获取中…' : (selectedCategories.length ? `获取选中类目数据` : '一键获取店铺数据') }}
|
||||
</button>
|
||||
@@ -671,6 +705,26 @@ onUnmounted(() => {
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
/* 店铺分类只读块(2026-11-16 客户口径):label 复用 category-label,chips 深色卡片同色系。 */
|
||||
.group-chips {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin: 8px 0 0;
|
||||
}
|
||||
|
||||
.group-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 4px 10px;
|
||||
border: 1px solid #3e4a62;
|
||||
border-radius: 6px;
|
||||
background: #232b3d;
|
||||
color: #c8d2e2;
|
||||
font-size: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.collect-btn:hover:not(:disabled) {
|
||||
filter: brightness(1.1);
|
||||
transform: translateY(-1px);
|
||||
|
||||
@@ -209,6 +209,8 @@ export const API_ENDPOINTS = {
|
||||
create: '/api/jd-collect/tasks',
|
||||
/** 采集类目下拉数据源(公共库已落库 category_path 全集,建单页多选面板用) */
|
||||
categories: '/api/jd-collect/categories',
|
||||
/** 店铺分类只读列表(管理员在后管京东数据库建的分类+组内商品数;2026-11-16 客户口径「普通账户都能看到」) */
|
||||
groups: '/api/jd-collect/groups',
|
||||
/** 激活(PENDING→RUNNING):推客户端队列**之前**必须调用,否则分片被拒、心跳要求客户端收手 */
|
||||
activate: '/api/jd-collect/tasks/{taskId}/activate',
|
||||
/** 采集进度(用户端「获取店铺数据」进度条数据源) */
|
||||
|
||||
@@ -80,6 +80,26 @@ export function fetchJdCollectCategories() {
|
||||
);
|
||||
}
|
||||
|
||||
/** 店铺分类行(GET /api/jd-collect/groups:管理员在后管京东数据库建的分类+组内商品数)。
|
||||
* 2026-11-16 客户口径「管理员弄了多少店铺分类 普通账户都能看到」:只读展示,分类的
|
||||
* 增删改仍只在后管;分组 2026-11-15 起全平台一份,无公司维度。 */
|
||||
export interface JdCollectGroupVo {
|
||||
id: number;
|
||||
name: string;
|
||||
sortOrder: number;
|
||||
productCount: number;
|
||||
}
|
||||
|
||||
/** 店铺分类只读列表(「获取店铺数据」页展示;「商品上架」落地后消费同一端点)。 */
|
||||
export function fetchJdCollectGroups() {
|
||||
return unwrapJavaResponse(
|
||||
get<JavaApiResponse<JdCollectGroupVo[]>>(
|
||||
buildJavaUrl(API_ENDPOINTS.jdCollect.groups),
|
||||
{ params: { user_id: getCurrentUserId() } },
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function createJdCollectTask(
|
||||
shopName: string,
|
||||
listTabs: JdListTab[],
|
||||
|
||||
Reference in New Issue
Block a user