This commit is contained in:
unknown 2023-08-31 09:32:38 +08:00
parent 2aad93f1bc
commit 60e263d26e
2 changed files with 27 additions and 10 deletions

View File

@ -36,8 +36,8 @@ class IndexController extends BaseApiController
public array $notNeedLogin = ['index', 'config', 'policy', 'decorate', 'notifyUrl','notifyProperty','notifyAuthentication','notifyVehicleContractUpdate','notifyVillageCarRent']; public array $notNeedLogin = ['index', 'config', 'policy', 'decorate', 'notifyUrl','notifyProperty','notifyAuthentication','notifyVehicleContractUpdate','notifyVillageCarRent'];
// private $domain = 'http://logistics.lihaink.cn'; private $domain = 'http://logistics.lihaink.cn';
private $domain = 'http://www.lst.local'; // private $domain = 'http://www.lst.local';
/** /**
* @notes 首页数据 * @notes 首页数据
@ -143,10 +143,10 @@ class IndexController extends BaseApiController
}else if($contract['signing_timer'] == 1) { }else if($contract['signing_timer'] == 1) {
//更改合同状态 //更改合同状态
VehicleContract::where('id',$id)->update(['signing_timer'=>2,'status'=>3]); VehicleContract::where('id',$id)->update(['signing_timer'=>2,'status'=>3]);
//判断是否是自有车辆
if($contract['type'] == 1){
//添加车辆到物流系统 //添加车辆到物流系统
$vehicle = json_decode($contract['cars_info'],true); $vehicle = json_decode($contract['cars_info'],true);
//判断是否是自有车辆
if($contract['type'] == 1){
$curl_res = curl_post($this->domain.'/api/addSelfCar',[],[ $curl_res = curl_post($this->domain.'/api/addSelfCar',[],[
'license'=>$vehicle['license'], 'license'=>$vehicle['license'],
'company_id' => $contract['company_a_id'], 'company_id' => $contract['company_a_id'],
@ -166,11 +166,29 @@ class IndexController extends BaseApiController
'create_time' => time(), 'create_time' => time(),
'type' => 1 'type' => 1
]); ]);
$car_id = $curl_res['data']['car_id'];
}else if($contract['type'] == 0){ }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' => '成功']); return json(['success' => true, 'msg' => '成功']);
} }
@ -199,7 +217,6 @@ class IndexController extends BaseApiController
} }
$vehicleRent = new VehicleRent(); $vehicleRent = new VehicleRent();
$vehicleRent -> saveAll($data); $vehicleRent -> saveAll($data);
} }
//返回 //返回
return $result ? $this->success('更新成功') : $this->fail('更新失败'); return $result ? $this->success('更新成功') : $this->fail('更新失败');

View File

@ -11,8 +11,8 @@ use think\facade\Db;
class VehicleController extends BaseApiController class VehicleController extends BaseApiController
{ {
// public string $url = 'http://logistics.lihaink.cn'; public string $url = 'http://logistics.lihaink.cn';
public string $url = 'http://www.lst.local'; // public string $url = 'http://www.lst.local';
//镇街公司想物流平台申请租赁车辆 //镇街公司想物流平台申请租赁车辆
public function setContractByTownCompany() public function setContractByTownCompany()
{ {