This commit is contained in:
mkm 2023-08-31 19:01:31 +08:00
commit 4484cf9995

View File

@ -298,21 +298,23 @@ class VehicleController extends BaseApiController
}
})->toArray();
//获取该公司已签约的小组服务公司数量
$villageCompany = Contract::where('party_a',$company['id'])->where('signing_timer',2)->select();
$villageCompany = Contract::field('id')->where('party_a',$company['id'])->where('signing_timer',2)->count();
//系统车辆数量
$rentCar = VehicleRent::field('id')->where('type',0)->select();
//可租赁车辆
$canRentCar = VehicleRent::field('id')->where('type',0)->where('status',0)->select();
$rentCar = VehicleRent::field('id')->where('company_id',$company['id'])->where('type',0)->count();
//申请中的车辆
$applyCar = VehicleContract::field('num')->where('company_b_id',$company['id'])->where('status','in','-1,0,1,2,')->sum('num');
//自有车辆数量
$selfCar = VehicleRent::field('id')->where('type',1)->select();
$selfCar = VehicleRent::field('id')->where('company_id',$company['id'])->where('type',1)->count();
//可在租车辆
$doubleRentCar = $villageCompany - $rentCar - $applyCar - $selfCar;
//设置数据
$data = [
'apply' => $vehicleContract,
'car_list' => $vehicleRentCars,
'monitor_num' => $villageCompany->count(),
'rent_num' => $rentCar->count(),
'can_rent_num' => $canRentCar->count(),
'self_num' => $selfCar->count(),
'monitor_num' => $villageCompany,
'rent_num' => $rentCar,
'can_rent_num' => intval($doubleRentCar),
'self_num' => $selfCar,
];
//返回
return $this->success('请求成功',$data);