Merge pull request 'master' (#16) from master into dev
Reviewed-on: #16
This commit is contained in:
commit
e4cffb8455
@ -12,15 +12,24 @@ class VehicleContractController extends BaseAdminController
|
||||
//风控中心上传合同
|
||||
public function uploadContract() {
|
||||
//获取参数
|
||||
$params = $this->request->post(['id','file']);
|
||||
$params = $this->request->post(['id','file','cars']);
|
||||
if(empty($params['id']) || empty($params['file'])){
|
||||
return $this->fail('缺少必要参数');
|
||||
}
|
||||
//获取合同信息
|
||||
$vehicle_contract = VehicleContract::where('id',$params['id'])->find();
|
||||
if(empty($vehicle_contract)){
|
||||
$vehicle_contract = VehicleContract::where('id',$params['id'])->findOrEmpty();
|
||||
if($vehicle_contract->isEmpty()){
|
||||
return $this->fail('合同信息错误');
|
||||
}
|
||||
if($vehicle_contract['type']==0 && $vehicle_contract['contract_logistic_id'] != 0){
|
||||
if(empty($params['cars'])){
|
||||
return $this->fail('缺少必要参数cars');
|
||||
}
|
||||
$cars = json_decode($params['cars'],true);
|
||||
if(empty($cars)){
|
||||
return $this->fail('参数cars无效');
|
||||
}
|
||||
}
|
||||
if($vehicle_contract['status'] != 0){
|
||||
return $this->fail('合同状态错误');
|
||||
}
|
||||
@ -29,13 +38,14 @@ class VehicleContractController extends BaseAdminController
|
||||
//判断合同类型
|
||||
if(!empty($vehicle_contract['contract_logistic_id'])){
|
||||
//更新物流系统
|
||||
curl_post(env('project.logistic_domain').'/api/updateContract',[],[
|
||||
curl_post(env('project.logistic_domain').'/api/contractUpdate',[],[
|
||||
'id' => $vehicle_contract['contract_logistic_id'],
|
||||
'file' => $params['file'],
|
||||
'status' => 1
|
||||
'status' => 1,
|
||||
'cars_info' => $params['cars']
|
||||
]);
|
||||
}
|
||||
VehicleContract::where('id', $params['id'])->update(['file' => $params['file'],'status'=>1]);
|
||||
VehicleContract::where('id', $params['id'])->update(['file' => $params['file'],'cars_info' => $params['cars'],'status'=>1]);
|
||||
}catch (\Exception $e){
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
@ -131,8 +141,8 @@ class VehicleContractController extends BaseAdminController
|
||||
return $this->fail('缺少必要参数');
|
||||
}
|
||||
//获取数据
|
||||
$contract = VehicleContract::where('id',$params['id'])->find();
|
||||
if(empty($contract)){
|
||||
$contract = VehicleContract::where('id',$params['id'])->findOrEmpty();
|
||||
if($contract->isEmpty()){
|
||||
return $this->fail('数据不存在');
|
||||
}
|
||||
if($contract['status'] != 1){
|
||||
@ -162,8 +172,8 @@ class VehicleContractController extends BaseAdminController
|
||||
|
||||
public function sendSms($id,$title) {
|
||||
//获取合同数据
|
||||
$contract = VehicleContract::where('id',$id)->find();
|
||||
if ($contract && !$contract->isEmpty() && $contract['file'] != '') {
|
||||
$contract = VehicleContract::where('id',$id)->findOrEmpty();
|
||||
if (!$contract->isEmpty() && $contract['file'] != '') {
|
||||
//发送短信
|
||||
$data = [
|
||||
//甲方
|
||||
@ -227,8 +237,18 @@ class VehicleContractController extends BaseAdminController
|
||||
if(empty($id)){
|
||||
$this->fail('参数错误');
|
||||
}
|
||||
$data = VehicleContract::where('id',$id)->find();
|
||||
$data['cars_info'] = json_decode($data['cars_info'],true);
|
||||
$data = VehicleContract::where('id',$id)->findOrEmpty();
|
||||
if($data->isEmpty()){
|
||||
return $this->fail('未查找到数据');
|
||||
}
|
||||
//判断合同类型
|
||||
if($data['type'] == 0 && $data['contract_logistic_id'] != 0){
|
||||
//获取平台车辆
|
||||
$carList = curl_get(env('project.logistic_domain').'/api/getAvailableVehicles');
|
||||
$data['car_list'] = $carList&&$carList['code']==1 ? $carList['data'] : [];
|
||||
}else{
|
||||
$data['cars_info'] = json_decode($data['cars_info'],true);
|
||||
}
|
||||
return $this->success('success',$data->toArray());
|
||||
}
|
||||
}
|
@ -33,6 +33,15 @@ class VehicleController extends BaseApiController
|
||||
if($params['num'] > $doubleRentCar ){
|
||||
return $this->fail('数量超过可再租车辆数');
|
||||
}
|
||||
//判断物流车辆
|
||||
$checkNum = curl_post(env('project.logistic_domain').'/api/checkCarNum',[],['num'=>$params['num']]);
|
||||
if($checkNum == null){
|
||||
return $this->fail('检查车辆数量错误');
|
||||
}
|
||||
if($checkNum['code'] == 0){
|
||||
return $this->fail($checkNum['msg']);
|
||||
}
|
||||
dump($checkNum);die;
|
||||
//查找乙方公司信息
|
||||
$party_b = Company::field('id,company_name,organization_code,master_name,master_phone,master_email,company_type')->where('id',$this->userInfo['company_id'])->find();
|
||||
if(empty($party_b)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user