修改后台发起合同接口,对是租赁合同的请求进行判断

This commit is contained in:
unknown 2023-08-24 15:26:37 +08:00
parent d522bfe816
commit 95d5a0b6a1
2 changed files with 31 additions and 8 deletions

View File

@ -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']);

View File

@ -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){
}
}
// /**发送合同 */