From d27cb8006502c704e4a33bcc204a700b7850b6ef Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 30 Jan 2025 08:43:49 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91IoT=EF=BC=9A=E9=87=8D=E6=9E=84=E8=AE=BE=E5=A4=87=20ups?= =?UTF-8?q?tream=20=E4=B8=BA=20message=EF=BC=8C=E5=8C=85=E6=8B=AC=E4=B8=8A?= =?UTF-8?q?=E8=A1=8C=20+=20=E4=B8=8B=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/iot/device/device/index.ts | 23 +++++++++++++++---- .../device/detail/DeviceDetailsSimulator.vue | 6 ++--- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/api/iot/device/device/index.ts b/src/api/iot/device/device/index.ts index b135ac9f..0989a4c2 100644 --- a/src/api/iot/device/device/index.ts +++ b/src/api/iot/device/device/index.ts @@ -56,8 +56,16 @@ export enum DeviceStateEnum { OFFLINE = 2 // 离线 } -// IoT 模拟设备上报数据 Request VO -export interface IotDeviceSimulationReportReqVO { +// IoT 模拟设备上行数据 Request VO +export interface IotDeviceSimulationUpstreamReqVO { + id: number // 设备编号 + type: string // 消息类型 + identifier: string // 标识符 + data: any // 请求参数 +} + +// IoT 模拟设备下行数据 Request VO +export interface IotDeviceSimulationDownstreamReqVO { id: number // 设备编号 type: string // 消息类型 identifier: string // 标识符 @@ -121,9 +129,14 @@ export const DeviceApi = { return await request.download({ url: `/iot/device/get-import-template` }) }, - // 模拟设备上报 - simulationReportDevice: async (data: IotDeviceSimulationReportReqVO) => { - return await request.post({ url: `/iot/device/simulation-report`, data }) + // 模拟设备上行 + simulationDeviceUpstream: async (data: IotDeviceSimulationUpstreamReqVO) => { + return await request.post({ url: `/iot/device/simulation-upstream`, data }) + }, + + // 模拟设备下行 + simulationDeviceDownstream: async (data: IotDeviceSimulationDownstreamReqVO) => { + return await request.post({ url: `/iot/device/simulation-downstream`, data }) }, // 获取设备属性最新数据 diff --git a/src/views/iot/device/device/detail/DeviceDetailsSimulator.vue b/src/views/iot/device/device/detail/DeviceDetailsSimulator.vue index 9574b568..f4a42753 100644 --- a/src/views/iot/device/device/detail/DeviceDetailsSimulator.vue +++ b/src/views/iot/device/device/detail/DeviceDetailsSimulator.vue @@ -103,7 +103,7 @@ 发送 @@ -331,7 +331,7 @@ const handlePropertyReport = async () => { }) try { - await DeviceApi.simulationReportDevice({ + await DeviceApi.simulationDeviceUpstream({ id: props.device.id, type: 'property', identifier: 'report', @@ -375,7 +375,7 @@ const handlePropertyReport = async () => { /** 处理设备状态 */ const handleDeviceState = async (state: number) => { try { - await DeviceApi.simulationReportDevice({ + await DeviceApi.simulationDeviceUpstream({ id: props.device.id, type: 'state', identifier: 'report',