From df77185f6cbf78c84c0dccc32a881c02b7aa8274 Mon Sep 17 00:00:00 2001 From: unknown <736250432@qq.com> Date: Mon, 16 Oct 2023 13:34:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E5=9C=A8=E7=A7=9F=E8=BD=A6=E8=BE=86?= =?UTF-8?q?=E5=8F=96=E5=80=BC=E4=B8=BA=E8=B4=9F=E6=95=B0=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/VehicleController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/controller/VehicleController.php b/app/api/controller/VehicleController.php index 606ea14bd..a30a26e2f 100644 --- a/app/api/controller/VehicleController.php +++ b/app/api/controller/VehicleController.php @@ -30,7 +30,7 @@ class VehicleController extends BaseApiController //自有车辆数量 $selfCar = VehicleRent::field('id')->where('company_id',$this->userInfo['company_id'])->where('status','<>',3)->where('type',1)->count(); //可在租车辆 - $doubleRentCar = $villageCompany - $rentCar - $applyCar - $selfCar; + $doubleRentCar = max($villageCompany - $rentCar - $applyCar - $selfCar,0); if($params['num'] > $doubleRentCar ){ return $this->fail('数量超过可再租车辆数'); } @@ -395,7 +395,7 @@ class VehicleController extends BaseApiController //自有车辆数量 $selfCar = VehicleRent::field('id')->where('company_id',$company['id'])->where('status','<>',3)->where('type',1)->count(); //可在租车辆 - $doubleRentCar = $villageCompany - $rentCar - $applyCar - $selfCar; + $doubleRentCar = max($villageCompany - $rentCar - $applyCar - $selfCar,0); //设置数据 $data = [ 'apply' => $vehicleContract,