auto(284e8d004cbb): session end @ 2026-07-01T15:19:13 (+3f)
This commit is contained in:
1 parent
c6f72f825d
commit
61b96d2ed1
3 files changed
+37
-42
No files matched your search
@@ -1,21 +1,15 @@
|
||||
/**
|
||||
* commands/bigscreen/info.ts — 大屏详情
|
||||
*
|
||||
* JNPF 大屏无 /{id} 端点 (404 实测), 走 list 查
|
||||
* v0.14+ BS-新30: 改端点 (旧 /extend/BigData 错, 用 /api/blade-visual/visual/detail)
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { JnpfClient } from '../../core/client.ts'
|
||||
import { installAiHelpHook } from '../../core/help.ts'
|
||||
import { log, printJson } from '../../core/log.ts'
|
||||
import { getDetail } from '../../webapi/bigscreen.ts'
|
||||
import { enhanceFromBackend, formatErrorLine } from '../_error_codes.ts'
|
||||
|
||||
interface BigscreenItem {
|
||||
id?: string
|
||||
fullName?: string
|
||||
enCode?: string
|
||||
category?: string
|
||||
}
|
||||
|
||||
interface InfoOpts {
|
||||
id: string
|
||||
json?: boolean
|
||||
@@ -23,36 +17,31 @@ interface InfoOpts {
|
||||
|
||||
export function buildBigscreenInfoCommand(): Command {
|
||||
const cmd = new Command('info')
|
||||
.description('查看大屏详情 (JNPF 大屏无 /{id} 端点, 走 list 查)')
|
||||
.description('查看大屏详情')
|
||||
.requiredOption('--id <id>', '大屏 id')
|
||||
.option('--json', '原始 JSON 输出', false)
|
||||
.action(async (opts: InfoOpts) => {
|
||||
const c = await JnpfClient.fromToken()
|
||||
// 大屏是 list 端点, 无 /{id}, 直接 list 找
|
||||
const r = await c.get<{ list: BigscreenItem[] }>('/extend/BigData', { pageSize: 100 })
|
||||
if (r.code !== 200) {
|
||||
const enhanced = enhanceFromBackend(r.msg || '', 'bigscreen', { entity: 'bigscreen' })
|
||||
log.error(` ${formatErrorLine(enhanced, { step: 0, stepName: '后端API' })}`)
|
||||
process.exit(1)
|
||||
}
|
||||
const found = (r.data?.list || []).find((d) => d.id === opts.id)
|
||||
if (!found) {
|
||||
const enhanced = enhanceFromBackend('list 中未找到, id 不存在', 'id', { entity: 'bigscreen' })
|
||||
await JnpfClient.fromToken()
|
||||
// v0.14+ 用 /detail 端点 (旧版走 list 查, 效率低)
|
||||
const r = (await getDetail(opts.id)) as { code?: number; msg?: string; data?: Record<string, unknown> }
|
||||
if (r.code !== 200 || !r.data) {
|
||||
const enhanced = enhanceFromBackend(r.msg || '未找到大屏', 'bigscreen', { entity: 'bigscreen' })
|
||||
log.error(` ${formatErrorLine(enhanced, { step: 0, stepName: '后端API' })}`)
|
||||
process.exit(1)
|
||||
}
|
||||
const found = r.data
|
||||
log.info(`大屏 id=${opts.id} 名称=${found.fullName} 编码=${found.enCode}`)
|
||||
console.log(`category: ${found.category || '-'}`)
|
||||
if (opts.json) printJson(found)
|
||||
})
|
||||
installAiHelpHook(cmd, {
|
||||
purpose: '查看大屏详情 (JNPF 大屏无 /{id} 端点, 走 list 查)',
|
||||
purpose: '查看大屏详情',
|
||||
required: { '--id': '大屏 id' },
|
||||
example: 'dacli bigscreen info --id=835246813026985082',
|
||||
source: {
|
||||
web: 'web/apps/jnpf-web-apps-main/src/views/extend/bigData/Form.vue',
|
||||
api: 'GET /api/extend/BigData (JNPF 无 /{id} 端点)',
|
||||
ref: 'doc/v0.8-endpoints.md §1.4',
|
||||
web: 'jnpf-visualdata/VisualController.java (detail) + web/dataV.ts (Selector)',
|
||||
api: 'GET /api/blade-visual/visual/detail',
|
||||
ref: 'dacli/docs/cmd-review/v0.14-webapi-rollout-plan.md §2.1',
|
||||
},
|
||||
})
|
||||
return cmd
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
/**
|
||||
* commands/bigscreen/list.ts — 大屏列表
|
||||
*
|
||||
* API: GET /api/extend/BigData
|
||||
* v0.14+ BS-新30 (2026-07-01): 修错端点 + webapi 化
|
||||
* 旧: GET /api/extend/BigData (JNPF 大数据测试端点, 返 120000 假数据 — BS-新12 silent fail)
|
||||
* 新: GET /api/blade-visual/visual/list (真大屏端点, jnpf-visualdata microservice)
|
||||
*
|
||||
* 镜像: web/.../api/onlineDev/dataV.ts (Selector) + jnpf-visualdata/.../VisualController.java (list)
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { JnpfClient } from '../../core/client.ts'
|
||||
import { installAiHelpHook } from '../../core/help.ts'
|
||||
import { log, printJson } from '../../core/log.ts'
|
||||
import { getList } from '../../webapi/bigscreen.ts'
|
||||
|
||||
interface ListOpts {
|
||||
keyword?: string
|
||||
@@ -19,21 +24,19 @@ export function buildBigscreenListCommand(): Command {
|
||||
.option('--keyword <k>', '按名称/编码模糊搜索')
|
||||
.option('--json', '原始 JSON 输出', false)
|
||||
.action(async (opts: ListOpts) => {
|
||||
const c = await JnpfClient.fromToken()
|
||||
const r = await c.get<{ list: Record<string, unknown>[] }>(
|
||||
'/extend/BigData',
|
||||
{ keyword: opts.keyword },
|
||||
)
|
||||
await JnpfClient.fromToken() // 初始化 token
|
||||
// v0.14+ webapi 透传 (走 /api/blade-visual/visual/list, 真大屏端点)
|
||||
const r = (await getList({ keyword: opts.keyword })) as { code?: number; msg?: string; data?: { records?: Record<string, unknown>[]; total?: number } }
|
||||
if (r.code !== 200) {
|
||||
log.error(`bigscreen list 失败 (code=${r.code}): ${r.msg}`)
|
||||
process.exit(1)
|
||||
}
|
||||
const list = r.data?.list || []
|
||||
const list = r.data?.records || []
|
||||
if (opts.json) {
|
||||
printJson(r.data)
|
||||
return
|
||||
}
|
||||
log.info(`共 ${list.length} 张大屏`)
|
||||
log.info(`共 ${list.length} 张大屏 (total=${r.data?.total || 0})`)
|
||||
console.log('ID FULL_NAME ENCODE CATEGORY')
|
||||
console.log('-'.repeat(90))
|
||||
for (const d of list) {
|
||||
@@ -49,9 +52,9 @@ export function buildBigscreenListCommand(): Command {
|
||||
optional: { '--keyword': '按名称/编码模糊搜索' },
|
||||
example: 'dacli bigscreen list\ndacli bigscreen list --keyword=销售',
|
||||
source: {
|
||||
web: 'web/apps/jnpf-web-apps-main/src/views/extend/bigData/index.vue',
|
||||
api: 'GET /api/extend/BigData',
|
||||
ref: 'doc/v0.8-endpoints.md §1.4',
|
||||
web: 'web/.../api/onlineDev/dataV.ts (Selector) + jnpf-visualdata/VisualController.java (list)',
|
||||
api: 'GET /api/blade-visual/visual/list',
|
||||
ref: 'dacli/docs/cmd-review/v0.14-webapi-rollout-plan.md §2.1',
|
||||
},
|
||||
})
|
||||
return cmd
|
||||
|
||||
Reference in new issue
Block a user