diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index 4fa43a370..bdd66f33b 100755 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -36,8 +36,8 @@ class IndexController extends BaseApiController public array $notNeedLogin = ['index', 'config', 'policy', 'decorate', 'notifyUrl','notifyProperty','notifyAuthentication','notifyVehicleContractUpdate','notifyVillageCarRent']; -// private $domain = 'http://logistics.lihaink.cn'; - private $domain = 'http://www.lst.local'; + private $domain = 'http://logistics.lihaink.cn'; +// private $domain = 'http://www.lst.local'; /** * @notes 首页数据 @@ -143,10 +143,10 @@ class IndexController extends BaseApiController }else if($contract['signing_timer'] == 1) { //更改合同状态 VehicleContract::where('id',$id)->update(['signing_timer'=>2,'status'=>3]); + //添加车辆到物流系统 + $vehicle = json_decode($contract['cars_info'],true); //判断是否是自有车辆 if($contract['type'] == 1){ - //添加车辆到物流系统 - $vehicle = json_decode($contract['cars_info'],true); $curl_res = curl_post($this->domain.'/api/addSelfCar',[],[ 'license'=>$vehicle['license'], 'company_id' => $contract['company_a_id'], @@ -166,11 +166,29 @@ class IndexController extends BaseApiController 'create_time' => time(), 'type' => 1 ]); + $car_id = $curl_res['data']['car_id']; }else if($contract['type'] == 0){ - + //添加车辆到物流系统 + VehicleRent::where('car_id',$vehicle['id'])->update([ + 'status' => 2, + 'rent_time' => time(), + 'rent_company_id' => $contract['company_b_id'], + ]); + $car_id = $vehicle['id']; } - - + $party_b = Company::where('id',$contract['company_b_id'])->find(); + //通知物流系统跟新 + curl_post($this->domain.'/api/updateVehicleRent',[],[ + 'car_id' => $car_id, + 'use_user_id' => $party_b['user_id'], + 'use_user_name' => $party_b['master_name'], + 'use_user_phone' => $party_b['master_phone'] + ]); + CompanyProperty::create([ + 'company_id' => $contract['company_b_id'], + 'object_id' => $car_id, + 'type' => 1 + ]); } return json(['success' => true, 'msg' => '成功']); } @@ -199,7 +217,6 @@ class IndexController extends BaseApiController } $vehicleRent = new VehicleRent(); $vehicleRent -> saveAll($data); - } //返回 return $result ? $this->success('更新成功') : $this->fail('更新失败'); diff --git a/app/api/controller/VehicleController.php b/app/api/controller/VehicleController.php index d605d6a73..c679d34b5 100644 --- a/app/api/controller/VehicleController.php +++ b/app/api/controller/VehicleController.php @@ -11,8 +11,8 @@ use think\facade\Db; class VehicleController extends BaseApiController { -// public string $url = 'http://logistics.lihaink.cn'; - public string $url = 'http://www.lst.local'; + public string $url = 'http://logistics.lihaink.cn'; +// public string $url = 'http://www.lst.local'; //镇街公司想物流平台申请租赁车辆 public function setContractByTownCompany() {