diff --git a/app/adminapi/controller/CompanyController.php b/app/adminapi/controller/CompanyController.php index eece38ddb..0f250b7f1 100644 --- a/app/adminapi/controller/CompanyController.php +++ b/app/adminapi/controller/CompanyController.php @@ -138,6 +138,13 @@ class CompanyController extends BaseAdminController } else { $params['party_a'] = $this->adminInfo['company_id']; } + //判断是否是租赁合同 + //如果是租赁合同则必须传递租赁数量、租赁开始时间、租赁结束时间三个参数 + if($params['contract_type'] == 29) { + if(empty($params['num']) || empty($params['start_time']) || empty($params['end_time'])){ + return $this->fail('缺少必要参数'); + } + } $params['type'] = 1; $params['party_b'] = $params['id']; unset($params['id']); diff --git a/app/common/logic/contract/ContractLogic.php b/app/common/logic/contract/ContractLogic.php index d461f30ec..c0f732398 100644 --- a/app/common/logic/contract/ContractLogic.php +++ b/app/common/logic/contract/ContractLogic.php @@ -208,15 +208,31 @@ class ContractLogic extends BaseLogic return self::setError('甲方和乙方不能是同一个公司'); } } - $model->check_status = 1; - $model->update_time = time(); - $model->setAttrs($data); - $res = $model->save($data); - if($res){ - return ['code'=>1,'msg'=>'发起成功,等待平台风控部上传合同','data'=>['id'=>$model->id]]; - }else{ - return ['code'=>0,'msg'=>'发起失败,请稍后重试',]; + try { + $model->check_status = 1; + $model->update_time = time(); + $model->setAttrs($data); + $res = $model->save($data); + //如果是租赁合同,调用接口通知物流系统 + if($data['contract_type'] == 29){ + curl_post('http://logistics.lihaink.cn/api/setContract',[],[ + 'party_a' => $data['party_a'], + 'party_b' => $data['party_b'], + 'num' => $data['num'], + 'start_time' => strtotime($data['start_time']), + 'end_time' => strtotime($data['start_time']), + 'rent_type' => 1 + ]); + } + if($res){ + return ['code'=>1,'msg'=>'发起成功,等待平台风控部上传合同','data'=>['id'=>$model->id]]; + }else{ + return ['code'=>0,'msg'=>'发起失败,请稍后重试',]; + } + }catch(\Exception $e){ + } + } // /**发送合同 */