From 95d5a0b6a11c0bb93e0ef21f97f5535cc906744b Mon Sep 17 00:00:00 2001 From: unknown <736250432@qq.com> Date: Thu, 24 Aug 2023 15:26:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8E=E5=8F=B0=E5=8F=91?= =?UTF-8?q?=E8=B5=B7=E5=90=88=E5=90=8C=E6=8E=A5=E5=8F=A3,=E5=AF=B9?= =?UTF-8?q?=E6=98=AF=E7=A7=9F=E8=B5=81=E5=90=88=E5=90=8C=E7=9A=84=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E8=BF=9B=E8=A1=8C=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/adminapi/controller/CompanyController.php | 7 ++++ app/common/logic/contract/ContractLogic.php | 32 ++++++++++++++----- 2 files changed, 31 insertions(+), 8 deletions(-) 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){ + } + } // /**发送合同 */