From f9efdef64d408d460c672014f8f8fd1c4b52cfa9 Mon Sep 17 00:00:00 2001 From: unknown <736250432@qq.com> Date: Wed, 23 Aug 2023 16:37:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E5=90=88=E5=90=8C?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E8=BD=A6=E8=BE=86=E7=A7=9F=E8=B5=81=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common.php | 10 ++++++++++ app/common/logic/contract/ContractLogic.php | 8 ++++++++ 2 files changed, 18 insertions(+) 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; }