This commit is contained in:
unknown 2023-09-01 16:14:22 +08:00
parent 205ba5e352
commit 8ecba72ac9
2 changed files with 18 additions and 2 deletions

View File

@ -105,8 +105,8 @@ class VehicleLogic extends BaseLogic
}
}
//获取车辆使用情况
$data['travel_info'] = [];
$travel = (new GpsLogic()) -> mileage($gpsCarInfo['data']['carId'],date('Y-m-d H:i:s',(time() - 604800)),date('Y-m-d').' 23:59:59');
$data['travel_info'] = $travel['data'];
if($data['status'] == 2){
//获取租赁信息
$rentInfo = VehicleRent::where('car_id',$data['id'])->find();

View File

@ -73,4 +73,20 @@ class VehicleLogic extends BaseLogic
return ['code'=>0,'msg'=>$result['msg']];
}
}
public static function getCarMileage($params):array {
$car = Vehicle::field('gps_imei')->where('id',$params['car_id'])->find();
if(!$car){
return ['code'=>0,'msg'=>'车辆不存在'];
}
//获取车辆在gps系统中的id
$gps_car_id = (new GpsLogic()) -> info($car['gps_imei']);
//获取车辆当前位置
$res = (new GpsLogic()) -> mileage($gps_car_id['data']['carId'],$params['start_time'],$params['end_time']);
if($res['code'] == 1){
return ['code'=>1,'msg'=>'请求成功','data'=>$res['data']];
}else{
return ['code'=>0,'msg'=>$res['msg']];
}
}
}