Merge pull request 'update' (#91) from zhangwei into master

Reviewed-on: http://git.excellentkk.cn/mkm/TaskSystem/pulls/91
This commit is contained in:
wei1990 2023-09-01 13:54:28 +08:00
commit a22f06d996

View File

@ -317,7 +317,7 @@ class VehicleController extends BaseApiController
if($vehicleContract['company_a_id'] != $this->userInfo['company_id']){
return $this->fail('数据不匹配');
}
$vehicleRentCars = VehicleRent::where('company_id',$vehicleContract['company_a_id'])->select()->toArray();
$vehicleRentCars = VehicleRent::where('company_id',$vehicleContract['company_a_id'])->where('status',0)->select()->toArray();
$data = [
'vehicleContract' => $vehicleContract->toArray(),
'vehicleRentCars' => $vehicleRentCars
@ -332,13 +332,13 @@ class VehicleController extends BaseApiController
if(empty($company)){
return $this->fail('数据错误');
}
if($company['company_type'] !=16 ){
if($company['company_type'] != 16){
return $this->fail('非镇街公司不能访问');
}
//获取小组服务公司申请信息
$vehicleContract = VehicleContract::where('company_a_id',$company['id'])->where('status','in','-1,0,1,2')->limit(2)->order('create_time desc')->select()->toArray();
$vehicleContract = VehicleContract::where('company_a_id',$company['id'])->where('status','in','-1,0,1,2')->limit(4)->order('create_time desc')->select()->toArray();
//获取车辆列表
$vehicleRentCars = VehicleRent::where('company_id',$company['id'])->select()->each(function($item){
$vehicleRentCars = VehicleRent::where('company_id',$company['id'])->where('status','in','0,1,2')->select()->each(function($item){
if($item['status'] == 2){
$item['rent_user'] = Company::field('company_name,master_name as user_name,master_phone as user_phone,province,city,area,street,village,brigade')->where('id',$item['rent_company_id'])->find()->append(['province_name', 'city_name', 'area_name', 'street_name', 'village_name','brigade_name']);
}
@ -346,11 +346,11 @@ class VehicleController extends BaseApiController
//获取该公司已签约的小组服务公司数量
$villageCompany = Contract::field('id')->where('party_a',$company['id'])->where('signing_timer',2)->count();
//系统车辆数量
$rentCar = VehicleRent::field('id')->where('company_id',$company['id'])->where('type',0)->count();
$rentCar = VehicleRent::field('id')->where('company_id',$company['id'])->where('status','<>', 3)->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('company_id',$company['id'])->where('type',1)->count();
$selfCar = VehicleRent::field('id')->where('company_id',$company['id'])->where('status','<>',3)->where('type',1)->count();
//可在租车辆
$doubleRentCar = $villageCompany - $rentCar - $applyCar - $selfCar;
//设置数据