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); + } }