update
This commit is contained in:
parent
29d0715d80
commit
c3546dd83e
@ -265,21 +265,24 @@ class VehicleContractController extends BaseAdminController
|
||||
if($data->isEmpty()){
|
||||
return $this->fail('未查找到数据');
|
||||
}
|
||||
$cars = json_decode($data['cars_info'],true);
|
||||
//判断合同类型
|
||||
if($data['type'] == 0 && $data['contract_logistic_id'] != 0){
|
||||
//获取平台车辆
|
||||
if(!empty($data['contract_logistic_id']) && $data['type'] == 0){
|
||||
$carList = curl_get(env('project.logistic_domain').'/api/getAvailableVehicles');
|
||||
$data['car_list'] = $carList&&$carList['code']==1 ? $carList['data'] : [];
|
||||
}
|
||||
$data['cars_info'] = json_decode($data['cars_info'],true);
|
||||
$cars = $data['cars_info'];
|
||||
if(!empty($cars)){
|
||||
foreach ($cars as $k=>$v) {
|
||||
$rent_info = VehicleRent::where('car_id',$v['id'])->findOrEmpty();
|
||||
if(!$rent_info->isEmpty()){
|
||||
$cars[$k]['type'] = $rent_info['type'];
|
||||
$cars[$k]['rent_time'] = !empty($rent_info['rent_time']) ? $rent_info['rent_time'] : $rent_info['create_time'];
|
||||
if($data['type'] == 0 || $data['type'] == 2){
|
||||
$cars[$k]['type'] = 0;
|
||||
}
|
||||
if($data['type'] == 1){
|
||||
$cars[$k]['type'] = 1;
|
||||
}
|
||||
if($data['type'] == 3){
|
||||
$cars[$k]['type'] = 2;
|
||||
}
|
||||
$cars[$k]['rent_time'] = $data['update_time'];
|
||||
}
|
||||
}
|
||||
$data['cars_info'] = $cars;
|
||||
|
Loading…
x
Reference in New Issue
Block a user