From 34ca64f93041cd247ddc4d10e308fc7f0fab8adc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=E5=85=88=E7=94=9F?= <1211120248@qq.com> Date: Thu, 9 Jul 2026 17:38:26 +0800 Subject: [PATCH] fix: require real monitoring camera data --- src/services/homeVideoApi.js | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/src/services/homeVideoApi.js b/src/services/homeVideoApi.js index 8b3410b..c20e8f9 100644 --- a/src/services/homeVideoApi.js +++ b/src/services/homeVideoApi.js @@ -14,11 +14,6 @@ const HONGYUAN_TOWN_NAMES = [ "麦洼乡", "色地镇", ] -const MONITORING_FALLBACK_ROWS = [ - { id: "fallback-qiongxi-pasture", name: "邛溪镇家庭生态牧场监控", number: "CAM-001", statusName: "预览点位" }, - { id: "fallback-wache-grassland", name: "瓦切镇草场监控", number: "CAM-002", statusName: "预览点位" }, -] - function joinBase(path) { if (/^https?:\/\//.test(path)) return path return `${JSY_API_BASE}${path.startsWith("/") ? path : `/${path}`}` @@ -143,18 +138,11 @@ function normalizeMonitoring(row, index, total, validTotal) { } export async function getHomeMonitorings(params = {}) { - try { - const data = await requestJson(joinBase("/api/home/monitorings"), { - params, - timeout: 18000, - }).then(unwrapResponse) - const rows = Array.isArray(data) ? data : data?.rows || data?.list || [] - const playableRows = rows.filter(isPlayableMonitoring) - if (playableRows.length) { - return playableRows.map((row, index) => normalizeMonitoring(row, index, rows.length, playableRows.length)) - } - } catch (error) { - console.warn("[homeVideo] fallback monitorings used", error) - } - return MONITORING_FALLBACK_ROWS.map((row, index) => normalizeMonitoring(row, index, MONITORING_FALLBACK_ROWS.length, 0)) + const data = await requestJson(joinBase("/api/home/monitorings"), { + params, + timeout: 18000, + }).then(unwrapResponse) + const rows = Array.isArray(data) ? data : data?.rows || data?.list || [] + const playableRows = rows.filter(isPlayableMonitoring) + return playableRows.map((row, index) => normalizeMonitoring(row, index, rows.length, playableRows.length)) }