diff --git a/app/common.php b/app/common.php index d1ab4521b..dd8b601ee 100755 --- a/app/common.php +++ b/app/common.php @@ -476,4 +476,14 @@ function append($data, $append, $key = 'id', $appendKey = 'append') $v[$appendKey] = $tmp[$v[$key]] ?? []; } return $data; +} + +function curl_get($url){ + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + $output = curl_exec($ch); + curl_close($ch); + $result = json_decode($output,true); + return $result; } \ No newline at end of file diff --git a/app/common/logic/contract/ContractLogic.php b/app/common/logic/contract/ContractLogic.php index 4e1f7012c..d461f30ec 100644 --- a/app/common/logic/contract/ContractLogic.php +++ b/app/common/logic/contract/ContractLogic.php @@ -177,6 +177,14 @@ class ContractLogic extends BaseLogic return $data['status'] == 1 ? '已签约' : '未签约'; }) ->find(); + //如果是租赁合同则获取租赁的车辆信息 + if($data && $data['contract_type'] == 29){ + $url = 'http://logistics.lihaink.cn/api/getRentRecord?contract_id='.$params['id']; + $result = curl_get($url); + if($result['code'] == 1){ + $data['carsRentInfo'] = $result['data']; + } + } return $data; }