diff --git a/app/api/logic/VehicleLogic.php b/app/api/logic/VehicleLogic.php index f573ab0e..1435f12e 100644 --- a/app/api/logic/VehicleLogic.php +++ b/app/api/logic/VehicleLogic.php @@ -267,7 +267,9 @@ class VehicleLogic extends BaseLogic if(empty($car)){ return ['code'=>0,'msg'=>'车辆不存在']; } - $params['gps_imei'] = $car['gps_imei']; + //获取车辆在gps系统中的id + $gps_car_id = (new GpsLogic()) -> info($car['gps_imei']); + $params['gps_car_id'] = $gps_car_id['carId']; //获取车辆行驶历史信息 $result = (new GpsLogic()) -> history($params); //返回数据 diff --git a/app/common/logic/GpsLogic.php b/app/common/logic/GpsLogic.php index cb15db89..122862b2 100644 --- a/app/common/logic/GpsLogic.php +++ b/app/common/logic/GpsLogic.php @@ -67,14 +67,10 @@ class GpsLogic extends BaseLogic public function history($params):array { //获取token $token = $this->token(); - $result1 = curl_post($this->domain.'/car/getByImei.do',[],[ - 'token' => $token, - 'imei' => $params['gps_imei'], - ]); //发起请求 $result = curl_post($this->domain.'/position/queryHistory.do',[],[ 'token' => $token, - 'carId' => $result1['data']['carId'], + 'carId' => $params['gps_car_id'], 'startTime' => $params['start_time'], 'endTime' => $params['end_time'], 'filter' => true,