|
@@ -437,7 +437,7 @@ class ScreenService extends Service
|
|
|
'province' => '',
|
|
|
'city' => '',
|
|
|
'district' => '',
|
|
|
- 'location' => '',
|
|
|
+ 'location' => [],
|
|
|
'temperature' => [],
|
|
|
'humidity' => []
|
|
|
];
|
|
@@ -460,12 +460,21 @@ class ScreenService extends Service
|
|
|
}
|
|
|
|
|
|
//gps定位
|
|
|
- $return_gps = SystemlService::getLastData($gps);
|
|
|
+ $time = strtotime('-30 min',time());
|
|
|
+ $time = $time * 1000;
|
|
|
+ $model = SystemL::whereIn('device_no', $gps)
|
|
|
+ ->select('value','time','device_no','data_point_name')
|
|
|
+ ->orderBy('id','desc');
|
|
|
+ $model->where('time','>=',$time);
|
|
|
+ $return_gps = $model->get()->toArray();
|
|
|
if(! empty($return_gps)){
|
|
|
$first_position = "";
|
|
|
+ $location = [];
|
|
|
foreach ($return_gps as $value){
|
|
|
- if(! empty ($first_postition)) continue;
|
|
|
- $first_position = $value['value'];
|
|
|
+ if(empty ($first_postition)) {
|
|
|
+ $first_position = $value['value'];
|
|
|
+ }
|
|
|
+ $location[] = $value['value'];
|
|
|
}
|
|
|
$url = 'https://restapi.amap.com/v3/geocode/regeo?location='.$first_position.'&key='.SystemL::GaoDeMapKey;
|
|
|
try{
|
|
@@ -477,7 +486,7 @@ class ScreenService extends Service
|
|
|
'province' => $position['province'] ?? '',
|
|
|
'city' => $position['city'] ?? '',
|
|
|
'district' => $position['district'] ?? '',
|
|
|
- 'location' => $first_position
|
|
|
+ 'location' => $location
|
|
|
];
|
|
|
}
|
|
|
}catch (\Exception $exception){
|