From 8da20ed9adb496fc3346159a132bce94941ef630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Thu, 27 Jul 2023 15:52:32 +0800 Subject: [PATCH] Update --- app/Iot/Linkos/HttpClient.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/Iot/Linkos/HttpClient.php b/app/Iot/Linkos/HttpClient.php index 758fed8..7900a4e 100644 --- a/app/Iot/Linkos/HttpClient.php +++ b/app/Iot/Linkos/HttpClient.php @@ -68,6 +68,23 @@ class HttpClient ]); } + /** + * 获取设备最新属性数据 + */ + public function getDeviceStatus(string $deviceId, array $props): array + { + $result = $this->get('/api/deviceStatus/v1/getDeviceStatus', [ + 'deviceCode' => $deviceId, + 'prop' => implode(",", $props), + ]); + + if (data_get($result, 'success') !== true) { + throw new RuntimeException(data_get($result, 'msg', '出错啦!')); + } + + return $result['data']; + } + public function get(string $url, array $query = []): array { return $this->request('GET', $url, [