From 91e77b712c4cda70f0507c8a4192aac296e2c302 Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Sat, 2 Dec 2023 19:53:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BE=9B=E5=95=86=E5=9F=8E=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E4=B8=89=E8=BD=AE=E8=BD=A6=E5=88=97=E8=A1=A8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/IndexController.php | 30 +++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index ecd7ea1c5..74c897d8d 100755 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -38,7 +38,7 @@ use think\response\Json; */ class IndexController extends BaseApiController { - public array $notNeedLogin = ['index', 'config', 'policy', 'decorate', 'notifyUrl', 'notifyProperty', 'notifyAuthentication', 'notifyVehicleContractUpdate','townCarRent','systemCarRent', 'selfCarRent', 'cancelRent', 'buyCar']; + public array $notNeedLogin = ['index', 'config', 'policy', 'decorate', 'notifyUrl', 'notifyProperty', 'notifyAuthentication', 'notifyVehicleContractUpdate','townCarRent','systemCarRent', 'selfCarRent', 'cancelRent', 'buyCar', 'vehicleCarList']; /** * @notes 首页数据 @@ -820,4 +820,32 @@ class IndexController extends BaseApiController Db::name('company_authentication_fail_log')->insert(['company_id'=>$parmas['id'], 'log_type'=>3, 'fail_reason'=>$data['msg'], 'create_time'=>time()]); } } + + + public function vehicleCarList() + { + $param = $this->request->param(); + // 镇区域码为空,查区县的公司 + if (empty($param['streetCode'])) { + $companyList = Company::where('area', $param['areaCode'])->select()->toArray(); + } else { + $companyList = Company::where('street', $param['streetCode'])->select()->toArray(); + } + $companyIds = array_column($companyList, 'id'); + $carList = []; + // 查镇车辆列表 + $vehicleList = VehicleRent::whereIn('company_id', $companyIds)->where('status','in','0,1,2')->field('car_id as id,car_license as license')->select()->toArray(); + + // 查小组车辆列表 +// $buyCarRent = VehicleBuyRecord::whereIn('company_id', $companyIds)->where('status','<>',4)->findOrEmpty(); +// if($buyCarRent->isEmpty()){ +// $data = VehicleContract::whereIn('company_b_id', $companyIds)->where('type','<>',2)->order('id desc')->findOrEmpty(); +// }else { +// $data = $buyCarRent; +// } +// $list = $data->toArray(); +// $carsInfo = json_decode($list['cars_info'], true); +// $result = array_merge($vehicleList,$carsInfo); + return $this->success('获取成功', $vehicleList); + } }