提供商城查询三轮车列表接口

This commit is contained in:
chenbo 2023-12-02 19:53:38 +08:00
parent 7783254f1a
commit 91e77b712c

View File

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