From 37dabba9a1447962a4aa31fccded419c74da9423 Mon Sep 17 00:00:00 2001 From: unknown <736250432@qq.com> Date: Wed, 18 Oct 2023 15:41:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E8=BD=A6=E8=BE=86=E7=A7=9F?= =?UTF-8?q?=E8=B5=81=E5=90=88=E5=90=8C=E8=AF=A6=E6=83=85=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contract/VehicleContractController.php | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/app/adminapi/controller/contract/VehicleContractController.php b/app/adminapi/controller/contract/VehicleContractController.php index b01d48259..6958551ef 100644 --- a/app/adminapi/controller/contract/VehicleContractController.php +++ b/app/adminapi/controller/contract/VehicleContractController.php @@ -273,14 +273,32 @@ class VehicleContractController extends BaseAdminController } if(!empty($cars)){ foreach ($cars as $k=>$v) { - if($data['type'] == 0 || $data['type'] == 2){ + if($data['type'] == 0){ $cars[$k]['type'] = 0; } if($data['type'] == 1){ - $cars[$k]['type'] = 1; + $rentInfo = VehicleRent::where('car_id',$v['id'])->findOrEmpty(); + if($rentInfo->isEmpty()){ + $cars[$k]['type'] = 0; + }else{ + $cars[$k]['type'] = $rentInfo['type']; + } + } + if($data['type'] == 2){ + $rentInfo = VehicleRent::where('car_id',$v['id'])->findOrEmpty(); + if($rentInfo->isEmpty()){ + $cars[$k]['type'] = 0; + }else{ + $cars[$k]['type'] = $rentInfo['type']; + } } if($data['type'] == 3){ - $cars[$k]['type'] = 2; + $rentInfo = VehicleRent::where('car_id',$v['id'])->findOrEmpty(); + if($rentInfo->isEmpty()){ + $cars[$k]['type'] = 2; + }else{ + $cars[$k]['type'] = $rentInfo['type']; + } } $cars[$k]['rent_time'] = $data['update_time']; }