修复购买合同车辆数量异常

This commit is contained in:
unknown 2023-10-18 09:37:11 +08:00
parent 45624625f4
commit 414f6435ca
2 changed files with 6 additions and 6 deletions

View File

@ -486,11 +486,6 @@ class IndexController extends BaseApiController
if($vehicleBuyRecord['status'] == 2){
//获取租赁车辆信息
$rentCarsInfo = VehicleRent::where('car_id',$cars_ids[0])->findOrEmpty();
//获取镇街公司信息
$zjCompany = Company::where('id',$rentCarsInfo['company_id'])->findOrEmpty();
//判断购买车辆中是否包含镇街公司租赁的车辆
$car_ids = array_column(json_decode($vehicleBuyRecord['cars_info'],true),'id');
$zjRentCars = VehicleRent::field('car_id as id,car_license as license')->where('company_id',$zjCompany['id'])->where('car_id','in',$car_ids)->where('status',0)->where('type',0)->select();
if($rentCarsInfo['type'] == 0){
//修改租赁车俩状态
VehicleRent::where('id',$rentCarsInfo['id'])->update(['status'=>0,'rent_company_id'=>0,'rent_contract_id'=>0,'rent_time'=>0]);
@ -505,6 +500,11 @@ class IndexController extends BaseApiController
curl_post(env('project.logistic_domain').'/api/Vehicle/delRentUseInfo', [], [
'car_id' => $cars_ids[0]
]);
//获取镇街公司信息
$zjCompany = Company::where('id',$rentCarsInfo['company_id'])->findOrEmpty();
//判断购买车辆中是否包含镇街公司租赁的车辆
$car_ids = array_column(json_decode($vehicleBuyRecord['cars_info'],true),'id');
$zjRentCars = VehicleRent::field('car_id as id,car_license as license')->where('company_id',$zjCompany['id'])->where('car_id','in',$car_ids)->where('status',0)->where('type',0)->select();
//发送镇公司与平台公司的解约合同
$curl_result = curl_post(env('project.logistic_domain').'/api/signContract',[],[
'num' => count($zjRentCars),

View File

@ -779,7 +779,7 @@ class VehicleController extends BaseApiController
'company_email' => $xzCompany['master_email'],
'cars_info' => json_encode($cars),
'num' => count($cars),
'status' => 1,
'status' => 2,
'contract_id' => $res->id,
'create_time' => time()
]);