From 5bfda437a6e54b0d5e8339192741cab2754586a9 Mon Sep 17 00:00:00 2001 From: yangsy Date: Fri, 12 Dec 2025 10:44:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=B5=81=E5=AA=92?= =?UTF-8?q?=E4=BD=93/=E4=BF=A1=E4=BB=A4=E6=9C=8D=E5=8A=A1=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E5=8D=A1=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/model/biz/nvr/index.ts | 1 + src/apis/model/biz/nvr/media-server-status.ts | 5 ++ src/apis/request/biz/other/index.ts | 1 + .../biz/other/ndm-service-available.ts | 25 +++++++ .../device/device-card/ndm-server/index.ts | 3 +- .../device-card/ndm-server/server-alive.vue | 65 +++++++++++++++++++ .../ndm-server/server-current-diag.vue | 5 +- 7 files changed, 102 insertions(+), 3 deletions(-) create mode 100644 src/apis/model/biz/nvr/media-server-status.ts create mode 100644 src/apis/request/biz/other/ndm-service-available.ts create mode 100644 src/components/device/device-card/ndm-server/server-alive.vue diff --git a/src/apis/model/biz/nvr/index.ts b/src/apis/model/biz/nvr/index.ts index 5db1448..7ff1a1f 100644 --- a/src/apis/model/biz/nvr/index.ts +++ b/src/apis/model/biz/nvr/index.ts @@ -1,3 +1,4 @@ export * from './client-channel'; +export * from './media-server-status'; export * from './record-info'; export * from './record-item'; diff --git a/src/apis/model/biz/nvr/media-server-status.ts b/src/apis/model/biz/nvr/media-server-status.ts new file mode 100644 index 0000000..a6fc764 --- /dev/null +++ b/src/apis/model/biz/nvr/media-server-status.ts @@ -0,0 +1,5 @@ +export interface MediaServerStatus { + id: string; + ip: string; + online: boolean; +} diff --git a/src/apis/request/biz/other/index.ts b/src/apis/request/biz/other/index.ts index 7ac828d..0d4f721 100644 --- a/src/apis/request/biz/other/index.ts +++ b/src/apis/request/biz/other/index.ts @@ -1,2 +1,3 @@ export * from './ndm-security-box'; +export * from './ndm-service-available'; export * from './ndm-switch'; diff --git a/src/apis/request/biz/other/ndm-service-available.ts b/src/apis/request/biz/other/ndm-service-available.ts new file mode 100644 index 0000000..75191d1 --- /dev/null +++ b/src/apis/request/biz/other/ndm-service-available.ts @@ -0,0 +1,25 @@ +import { ndmClient, userClient, type MediaServerStatus, type Station } from '@/apis'; + +export const isMediaServerAliveApi = async (options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { + const { stationCode, signal } = options ?? {}; + const client = stationCode ? ndmClient : userClient; + const prefix = stationCode ? `/${stationCode}` : ''; + const endpoint = `${prefix}/api/ndm/ndmServiceAvailable/mediaServer/isAlive`; + const resp = await client.get(endpoint, { signal }); + const [err, data] = resp; + if (err) throw err; + if (!data) throw new Error(`${data}`); + return data; +}; + +export const isSipServerAliveApi = async (options?: { stationCode?: Station['code']; signal?: AbortSignal }) => { + const { stationCode, signal } = options ?? {}; + const client = stationCode ? ndmClient : userClient; + const prefix = stationCode ? `/${stationCode}` : ''; + const endpoint = `${prefix}/api/ndm/ndmServiceAvailable/sipServer/isAlive`; + const resp = await client.get(endpoint, { signal }); + const [err, data] = resp; + if (err) throw err; + if (data === null) throw new Error(`${data}`); + return data; +}; diff --git a/src/components/device/device-card/ndm-server/index.ts b/src/components/device/device-card/ndm-server/index.ts index 5ac4563..67c2711 100644 --- a/src/components/device/device-card/ndm-server/index.ts +++ b/src/components/device/device-card/ndm-server/index.ts @@ -1,6 +1,7 @@ +import ServerAlive from './server-alive.vue'; import ServerCard from './server-card.vue'; import ServerCurrentDiag from './server-current-diag.vue'; import ServerHistoryDiag from './server-history-diag.vue'; import ServerUpdate from './server-update.vue'; -export { ServerCard, ServerCurrentDiag, ServerHistoryDiag, ServerUpdate }; +export { ServerAlive, ServerCard, ServerCurrentDiag, ServerHistoryDiag, ServerUpdate }; diff --git a/src/components/device/device-card/ndm-server/server-alive.vue b/src/components/device/device-card/ndm-server/server-alive.vue new file mode 100644 index 0000000..0840f39 --- /dev/null +++ b/src/components/device/device-card/ndm-server/server-alive.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/src/components/device/device-card/ndm-server/server-current-diag.vue b/src/components/device/device-card/ndm-server/server-current-diag.vue index 0767d56..4b80806 100644 --- a/src/components/device/device-card/ndm-server/server-current-diag.vue +++ b/src/components/device/device-card/ndm-server/server-current-diag.vue @@ -1,6 +1,6 @@