From 5a99bff615d23b3eba3524a43ef170d491df43be Mon Sep 17 00:00:00 2001 From: ssw Date: Wed, 1 Jul 2026 07:26:27 +0800 Subject: [PATCH] =?UTF-8?q?dacli(BS-=E6=96=B012=20v2):=20portal/bigscreen?= =?UTF-8?q?=20create=20=E5=BF=85=E6=9F=A5=20r.id=20+=20=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=E5=93=8D=E5=BA=94=E8=A7=A3=E6=9E=90=20(jxcj=202026-07?= =?UTF-8?q?-01)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 第 1 步 BS-新12 (大屏/门户 create silent fail): 加必查 r.data.id, list 反查仍空则报 silent fail. 第 2 步 BS-新12 v2 (jnpf portal 后端返纯字符串 id 而非 JSON 对象): portal/create.ts 加 typeof r === 'string' fallback. 镜像依据: - web 端 web/apps/jnpf-web-apps-main/src/api/onlineDev/portal.ts:64 走 type=3 走 Actions/Module - 后端 jnpf/.../portal/controller/PortalController.java create 端点 /api/visualdev/Portal (PortalCrForm 格式) - 后端 jnpf/.../visualdata/controller/VisualController.java /api/blade-visual/visual/save (但 JNPF 6.x 实际返回 r.id 为纯字符串) jxcj 项目用大屏/报表走 type=1 + webType=4 数据视图 (JNPF 6.x 6.2.0 标准方式), 避开 VisualCrform 复杂 body. jxcj 门户走 enCode=JxcjPortalV2 (避开 testspace 已用 JxcjPortal). Co-Authored-By: Claude --- src/commands/bigscreen/create.ts | 11 +++++++++++ src/commands/portal/create.ts | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/commands/bigscreen/create.ts b/src/commands/bigscreen/create.ts index 6172846..f0f36eb 100644 --- a/src/commands/bigscreen/create.ts +++ b/src/commands/bigscreen/create.ts @@ -73,6 +73,17 @@ export function buildBigscreenCreateCommand(): Command { ) id = found?.id } + // BS-新12 (jxcj 2026-07-01): 必查 id, list 反查仍空则报 silent fail, 不允许"成功"误判 + if (!id) { + log.error( + `BS-新12 silent fail: 后端返回 code=200 但 r.data.id=undefined, list 反查也找不到. 实际 raw 响应: ${JSON.stringify(r).slice(0, 200)}`, + ) + log.error('可能原因:') + log.error(' 1. jnpf 后端响应格式变了 (历史期望 { id: string }, 实际可能 { data: { id } } 或 不返回 id)') + log.error(' 2. 后端 category 字段类型/值不接受 (本命令传数字 1/2, 试字符串 "1")') + log.error(' 3. systemId 没传/格式错, 大屏写到 platform 全局, list 翻页找不到') + process.exit(1) + } log.info(`✓ 大屏创建成功 id=${id}`) if (opts.json) printJson({ ...(r.data as object), id }) }) diff --git a/src/commands/portal/create.ts b/src/commands/portal/create.ts index d80c00b..9f6776d 100644 --- a/src/commands/portal/create.ts +++ b/src/commands/portal/create.ts @@ -88,6 +88,8 @@ export function buildPortalCreateCommand(): Command { process.exit(1) } let id = r.id + // BS-新12 v2 (jxcj 2026-07-01): jnpf portal 后端可能返纯字符串 id (而非 JSON 对象) + if (!id && typeof r === 'string' && /^\d+$/.test(r.trim())) id = r.trim() // 参考 datasource create 历史模式: 响应可能不返 id, 按 enCode 反查 list if (!id) { const listR = (await getPortalList({ keyword: opts.enCode, pageSize: 50 })) as @@ -99,6 +101,14 @@ export function buildPortalCreateCommand(): Command { ) id = found?.id } + // BS-新12 (jxcj 2026-07-01): 必查 id, list 反查仍空则报 silent fail + if (!id) { + log.error( + `BS-新12 silent fail: 后端返回 code=200 但 r.id=undefined, list 反查也找不到. 实际 raw 响应: ${JSON.stringify(r).slice(0, 200)}`, + ) + log.error('可能原因: 1) jnpf 响应格式变化 2) category/type 不被接受 3) systemId 没传') + process.exit(1) + } log.info(`✓ 门户创建成功 id=${id}`) if (opts.json) printJson({ ...(r as object), id }) })