| xqd
@@ -112,7 +112,7 @@ class DeviceServer
|
|
|
DeviceInfo::insert($create);
|
|
|
}
|
|
|
}
|
|
|
- $this->refreshDevice($val['IotId']);
|
|
|
+// $this->refreshDevice($val['IotId']);
|
|
|
}
|
|
|
return true;
|
|
|
}
|
| xqd
@@ -133,6 +133,7 @@ class DeviceServer
|
|
|
}
|
|
|
$ali = new AliYunIotServer($conf['appKey'], $conf['appSecret']);
|
|
|
$deviceProperty = $ali->getDeviceProperty($iot_id);
|
|
|
+ dd($deviceProperty);
|
|
|
Log::info("设备数据刷新[1]:" . json_encode($deviceProperty));
|
|
|
if (isset($deviceProperty['Success']) && $deviceProperty['Success']) {
|
|
|
$data = [];
|
| xqd
@@ -146,36 +147,10 @@ class DeviceServer
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ dd($data);
|
|
|
if (empty($data)) {
|
|
|
return ['data' => ['ErrorMessage' => '未获取到设备属性'], 'code' => 3];
|
|
|
}
|
|
|
- //修复
|
|
|
-// if ($data['deliver_lock_switch'] == 1) {
|
|
|
-// return ['data' => ['ErrorMessage' => '当前设备已开启,请等待'], 'code' => '2'];
|
|
|
-// }
|
|
|
- /* if (isset($data['location'])) {
|
|
|
- $location = json_decode($data['location'], true);
|
|
|
- $data['device_latitude'] = $location['latitude'];
|
|
|
- $data['device_longitude'] = $location['longitude'];
|
|
|
- unset($data['location']);
|
|
|
- }*/
|
|
|
- /*if ($data['rest_capacity'] == 0) {
|
|
|
- $data['status'] = DeviceInfo::MAX;
|
|
|
- } else {
|
|
|
- $data['status'] = DeviceInfo::WELL;
|
|
|
- }*/
|
|
|
- $insert['device_item'] = $data['device_tem'];
|
|
|
- $insert['imei'] = $data['imei'];
|
|
|
- if ($data['device_tem'] >= 80) {
|
|
|
- $id = DeviceInfo::where('iot_id', $iot_id)->first(['id'])->id;
|
|
|
-// Log::info("设备温度【{$id}】:{$data['device_tem']}" );
|
|
|
-// WaringMessage::temWaring($id);
|
|
|
- }
|
|
|
-
|
|
|
- $res = DeviceInfo::where('iot_id', $iot_id)->update($insert);
|
|
|
- if (!$res) {
|
|
|
- Log::info('设备数据刷新[2]:' . json_encode($data));
|
|
|
- }
|
|
|
return ['data' => $data, 'code' => '0'];
|
|
|
} else {
|
|
|
return ['data' => $deviceProperty, 'code' => 1];
|
| xqd
@@ -199,7 +174,6 @@ class DeviceServer
|
|
|
}
|
|
|
$ali = new AliYunIotServer($conf['appKey'], $conf['appSecret']);
|
|
|
$deviceProperty = $ali->getDeviceProperty($iot_id);
|
|
|
-// dd($deviceProperty);
|
|
|
if (isset($deviceProperty['Success']) && $deviceProperty['Success']) {
|
|
|
$data = [];
|
|
|
foreach ($deviceProperty['Data']['List']['PropertyStatusInfo'] as $index => $item) {
|