diff --git a/app/adminapi/logic/vehicle/VehicleLogic.php b/app/adminapi/logic/vehicle/VehicleLogic.php index 3465a1a2..a7f6957a 100644 --- a/app/adminapi/logic/vehicle/VehicleLogic.php +++ b/app/adminapi/logic/vehicle/VehicleLogic.php @@ -103,6 +103,13 @@ class VehicleLogic extends BaseLogic $gpsCarHistoryData[$k]['lat'] = $v['latc']; } } + if(empty($gpsCarHistoryData)){ + //获取车辆状态 + $carStatus = (new GpsLogic()) -> status($gpsCarInfo['data']['carId']); + if($carStatus && $gpsCarHistory['code']==1){ + $gpsCarHistoryData[] = ['lat'=>$carStatus['data']['carStatus']['latc'],'lon'=>$carStatus['data']['carStatus']['lonc']]; + } + } $data['track_info'] = $gpsCarHistory&&$gpsCarHistory['code']==1 ? $gpsCarHistoryData : []; //获取车辆使用情况 $travel = (new GpsLogic()) -> mileage($gpsCarInfo['data']['carId'],date('Y-m-d H:i:s',(time() - 604800)),date('Y-m-d').' 23:59:59');