dacli(BS-新12 v2): portal/bigscreen create 必查 r.id + 字符串响应解析 (jxcj 2026-07-01)
第 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 <[email protected]>
This commit is contained in:
1 parent
ac71192e9a
commit
5a99bff615
2 files changed
+21
No files matched your search
@@ -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 })
|
||||
})
|
||||
|
||||
@@ -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 })
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user