auto(bfc0cfa2c3a4): session end @ 2026-07-15T12:54:37 (+2f)
This commit is contained in:
1 parent
259580b240
commit
dc77c34988
2 files changed
+27
-5
No files matched your search
@@ -47,6 +47,9 @@ export async function lookupDataInterfaceIdByEnCode(enCode: string): Promise<str
|
||||
// 拉所有 dict_type 'interfaceType' 的 category, 逐个分页扫
|
||||
// 注: dict_type 通常叫 interfaceType, 但不同 app 可能 rename; 先尝试 'interfaceType' 否则用 list-by-id
|
||||
// 这里简化: 跑 4 个常见 category id (从 ts2 抓 baseline 时已知)
|
||||
// v0.21+ R15 fix (BS-新47): getDataInterfaceList webapi 已 unwrap .data, 返 {pagination,list} 直返
|
||||
// 旧 (R14 BS-新44): listR.data?.list — 全空因为 data 已经被 shim 解出
|
||||
// 新: listR.list — 直接拿 list
|
||||
const knownCategories = await collectDiCategories(c)
|
||||
for (const catId of knownCategories) {
|
||||
try {
|
||||
@@ -54,8 +57,8 @@ export async function lookupDataInterfaceIdByEnCode(enCode: string): Promise<str
|
||||
currentPage: 1,
|
||||
pageSize: 1000,
|
||||
category: catId,
|
||||
})) as { data?: { list?: Array<{ id?: string; enCode?: string }> } } | unknown
|
||||
const list = ((listR as { data?: { list?: Array<any> } }).data?.list) || []
|
||||
})) as { list?: Array<{ id?: string; enCode?: string }> } | unknown
|
||||
const list = (listR as { list?: Array<any> })?.list || []
|
||||
const found = list.find((d: any) => d.enCode === enCode)
|
||||
if (found?.id) return String(found.id)
|
||||
} catch {
|
||||
@@ -67,19 +70,35 @@ export async function lookupDataInterfaceIdByEnCode(enCode: string): Promise<str
|
||||
}
|
||||
|
||||
/**
|
||||
* 收集 DI category id 列表. R14 BS-新44 fix:
|
||||
* 收集 DI category id 列表. R14 BS-新44 fix + R15 BS-新47 扩展:
|
||||
* - 优先 dict_type 'interfaceType' 的 data items
|
||||
* - Fallback: dict_type list (all) — 从 enCode=interfaceType 节点拿 id, 再 GET DictionaryData list
|
||||
* - R15 BS-新47: 从 getDataInterfaceSelector() 顶层 category=0 节点拿 id (权威全平台)
|
||||
* - 兜底: 已知常用 category id 列表 (从 baseline 抓到的)
|
||||
*/
|
||||
async function collectDiCategories(c: JnpfClient): Promise<string[]> {
|
||||
const cats: string[] = []
|
||||
// 兜底常用 (从 R13 ts2 baseline 抓到的 interfaceType category id)
|
||||
const knownFallback = [
|
||||
'30be5ef4e3074dd89385ad6b4540c63d', // round 12 default
|
||||
'30be5ef4e3074dd89385ad6b4540c63d', // 默认
|
||||
'406725667942571077', // 实际 baseline 中观察到的
|
||||
'0',
|
||||
]
|
||||
|
||||
// 0) v0.21+ R15 BS-新47: 从 selector 顶层 (category=0) 拿所有 category id — 权威全平台
|
||||
try {
|
||||
const sel = (await getDataInterfaceSelector()) as unknown
|
||||
const walk = (nodes: unknown) => {
|
||||
for (const n of (Array.isArray(nodes) ? nodes : []) as any[]) {
|
||||
if (n?.category === '0' && n?.id && !cats.includes(String(n.id))) {
|
||||
cats.push(String(n.id))
|
||||
}
|
||||
if (n?.children) walk(n.children)
|
||||
}
|
||||
}
|
||||
walk(Array.isArray(sel) ? sel : (sel as { data?: unknown })?.data)
|
||||
} catch { /* keep cats empty */ }
|
||||
|
||||
// 1) 拉 dict_type list, 找 enCode=interfaceType 的 id
|
||||
try {
|
||||
const r = await c.get<{ data?: { list?: Array<{ id?: string; enCode?: string }> } } | unknown>(
|
||||
|
||||
@@ -245,7 +245,10 @@ async function runDiStepMachineCreate(
|
||||
pageSize: 1000,
|
||||
// 不带 category — 全平台扫 (Round 12 BS-新39 修复)
|
||||
})) as { data?: { list?: Array<any> } } | unknown
|
||||
const list = ((r as { data?: { list?: Array<any> } })?.data?.list) || []
|
||||
// v0.21+ R15 fix (BS-新47): getDataInterfaceList webapi 已 unwrap .data, 返 {pagination,list} 直返
|
||||
// 旧: r.data?.list — 全空, BS-47 全平台唯一性预校验失效 (但 BS-新39 + 跨 cat 仍生效, 旧版本 BS-47 hit 0)
|
||||
// 新: r.list — 直接拿 list
|
||||
const list = ((r as { list?: Array<any> })?.list) || []
|
||||
existingDIs = list.map((d: any) => ({
|
||||
fullName: d.fullName,
|
||||
enCode: d.enCode,
|
||||
|
||||
Reference in new issue
Block a user