feat(jd-publish): 目标品牌建单+校验失败整单判死+改品牌原位重试(桌面协议 v3 服务端半边)
- 建单必填目标品牌(1–120 字符单行),走 /tasks/target-brand 独占路径,旧后端不会静默丢参数
- 激活与明细下发带 jdPublishProtocol,协议 <3 直接 409 要求升级客户端;明细 VO 下发 targetBrandName
- 预检失败回执(SOURCE/BRAND)必须带一条失败明细,整单判 FAILED 并落分类前缀;通用重试/继续对品牌失败任务拒绝
- 新增 /tasks/{taskId}/retry-brand:只允许无成功、无待确认记录的品牌失败任务改品牌后原位重试(世代+1、明细复位、回执直推本机队列)
- 兜底拉取按协议过滤带 targetBrandName 的 JD 上架任务,认领 CAS 带 resumeAttempt 防跨代误领
- 用户端:目标品牌必填输入、协议探测挡旧客户端、品牌失败弹窗与「修改品牌并重试」按钮
This commit is contained in:
@@ -228,8 +228,11 @@ export const API_ENDPOINTS = {
|
||||
},
|
||||
/** 京东商品上架:用户端建单/选品/面板;派发载荷由服务端下发,认领只由客户端和后端完成。 */
|
||||
jdPublish: {
|
||||
/** 建单(请求体 categoryId+productIds+priceRule,响应带 queuePayload 页面直推) */
|
||||
/** 后端兼容建单入口;新版页面用独占路径,避免旧后端忽略品牌参数。 */
|
||||
create: '/api/jd-publish/tasks',
|
||||
createWithTargetBrand: '/api/jd-publish/tasks/target-brand',
|
||||
/** 修改目标品牌后原位重试;沿用建单回执以直推本机队列。 */
|
||||
retryBrand: '/api/jd-publish/tasks/{taskId}/retry-brand',
|
||||
/** 用户端选品分页(AC-9 owner 过滤:只回归属当前用户的京东数据库商品行) */
|
||||
products: '/api/jd-publish/products',
|
||||
/** 任务面板总览(运行中/成功/失败计数统计卡) */
|
||||
|
||||
@@ -39,19 +39,28 @@ export function createJdPublishTask(
|
||||
categoryId: number | null,
|
||||
productIds: number[],
|
||||
priceRule: JdPublishPriceRule,
|
||||
targetBrandName: string,
|
||||
) {
|
||||
return unwrapJavaResponse(post<JavaApiResponse<JdPublishTaskVo>, Record<string, unknown>>(
|
||||
buildJavaUrl(API_ENDPOINTS.jdPublish.create),
|
||||
buildJavaUrl(API_ENDPOINTS.jdPublish.createWithTargetBrand),
|
||||
{
|
||||
userId: getCurrentUserId(),
|
||||
categoryId,
|
||||
productIds,
|
||||
// mode=none 时不带 value(后端 normalizePriceRule 对 none 忽略 value)
|
||||
priceRule: priceRule.mode === 'none' ? { mode: 'none' } : priceRule,
|
||||
targetBrandName,
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
export function retryJdPublishBrand(taskId: number, targetBrandName: string, resumeAttempt: number) {
|
||||
return unwrapJavaResponse(post<JavaApiResponse<JdPublishTaskVo>, { targetBrandName: string; resumeAttempt: number }>(
|
||||
buildJavaUrl(API_ENDPOINTS.jdPublish.retryBrand.replace('{taskId}', String(taskId))),
|
||||
{ targetBrandName, resumeAttempt },
|
||||
))
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// 选品分页(AC-9 owner 过滤):服务端只回归属当前用户的京东数据库商品行。
|
||||
// 形状照后管京东数据库列表行裁剪(选品面板只需要主字段,attr/detail 不下发)。
|
||||
|
||||
@@ -201,6 +201,8 @@ export interface PywebviewApi {
|
||||
error?: string;
|
||||
alreadyRunning?: boolean;
|
||||
}>;
|
||||
/** 京东发布独立协议:品牌单仅允许明确支持该协议的客户端创建或修改品牌重试。 */
|
||||
jd_publish_protocol?: () => Promise<number>;
|
||||
enqueue_json?: (
|
||||
data: unknown,
|
||||
) => Promise<{ success: boolean; queue_size?: number; error?: string; code?: string }>;
|
||||
|
||||
Reference in New Issue
Block a user