提交
This commit is contained in:
parent
94dcd14a3a
commit
80b2139788
@ -234,4 +234,41 @@ class AdminController extends BaseAdminController
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//**废除合同 */
|
||||
public function abolition()
|
||||
{
|
||||
$params = Request::param();
|
||||
$result = AdminLogic::detail($params);
|
||||
$find=Db::name('article')->where('id',2)->value('content');
|
||||
$data = [
|
||||
'name' => $result['name'] . '合同',
|
||||
'signatories' => [['fullName' => $result['name'], 'identityType' => 1, 'identityCard' => $result['id_card'], 'mobile' => $result['account'], 'noNeedVerify' => 1, 'signLevel' => 1]],
|
||||
'url' => $result['contract']['file'],
|
||||
'content'=>'<meta charset="utf-8">'.$find,
|
||||
];
|
||||
$res = app(JunziqianController::class)->html_contract($data,$result['contract']['id']);
|
||||
$data = array(
|
||||
"applyNo" => $res->data, //TODO *
|
||||
"fullName" => $result['name'], //TODO *
|
||||
"identityCard" => $result['id_card'], //TODO *
|
||||
"identityType" => 1, //TODO *
|
||||
);
|
||||
$res = app(JunziqianController::class)->SigningLink($data);
|
||||
$sms = [
|
||||
'mobile' => $result['phone'],
|
||||
'name' => $result['name'],
|
||||
'type' => '《' . $result['contract']['contract_type_name'] . '》',
|
||||
'code' => 'api/Hetong/url?id=' . $result['contract']['id'],
|
||||
'scene' => 'WQ'
|
||||
];
|
||||
$result = SmsLogic::contractUrl($sms);
|
||||
if (true === $result) {
|
||||
return $this->success('发送成功');
|
||||
} else {
|
||||
return $this->fail(SmsLogic::getError());
|
||||
}
|
||||
halt($res);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ class JunziqianController extends BaseApiController
|
||||
return $this->success('', (array)$response);
|
||||
}
|
||||
//签约
|
||||
public function Signing($data,$id)
|
||||
public function Signing($data, $id)
|
||||
{
|
||||
$requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
|
||||
//CURLFile 可以传url或filePath,但必须保证文件存在且有效,否则php不会报错,只会导致http请求返回null(并没有调到服务端)。
|
||||
@ -153,7 +153,7 @@ class JunziqianController extends BaseApiController
|
||||
$request->serverCa = 1; //是否需要服务端云证书
|
||||
$request->fileType = 1; //合同上传方式 url
|
||||
$request->url = $data['url'];
|
||||
$request->notifyUrl='https://worker-task.lihaink.cn/notify_url?id='.$id;
|
||||
$request->notifyUrl = 'https://worker-task.lihaink.cn/notify_url?id=' . $id;
|
||||
//发起PING请求
|
||||
// halt($request);
|
||||
$response = $requestUtils->doPost("/v2/sign/applySign", $request);
|
||||
@ -176,7 +176,7 @@ class JunziqianController extends BaseApiController
|
||||
{
|
||||
$requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
|
||||
//初始化请求参数
|
||||
$request=array(
|
||||
$request = array(
|
||||
"applyNo" => $data['applyNo'], //TODO +
|
||||
//"businessNo" => "0000XXXXXXXXX", //TODO +
|
||||
"fullName" => $data['fullName'], //TODO *
|
||||
@ -184,36 +184,57 @@ class JunziqianController extends BaseApiController
|
||||
"identityType" => 12, //TODO *
|
||||
"signNotifyType" => 1 //默认为1
|
||||
);
|
||||
$response=$requestUtils->doPost("/v2/sign/notify",$request);
|
||||
$response = $requestUtils->doPost("/v2/sign/notify", $request);
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function download_file($applyNo){
|
||||
//html模板
|
||||
public function html_contract($data,$id)
|
||||
{
|
||||
$requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
|
||||
//CURLFile 可以传url或filePath,但必须保证文件存在且有效,否则php不会报错,只会导致http请求返回null(并没有调到服务端)。
|
||||
//初始化合同参数
|
||||
$request = new ApplySignReq();
|
||||
$request->contractName = $data['name'];
|
||||
$request->signatories = $data['signatories']; //签约方
|
||||
$request->serverCa = 1; //是否需要服务端云证书
|
||||
$request->fileType = 3;
|
||||
$request->htmlContent = $data['content'];
|
||||
$request->notifyUrl = 'https://worker-task.lihaink.cn/notify_url?id=' . $id;
|
||||
|
||||
//发起PING请求
|
||||
$response = $requestUtils->doPost("/v2/sign/applySign", $request);
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function download_file($applyNo)
|
||||
{
|
||||
$requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
|
||||
//初始化请求参数
|
||||
$request=array(
|
||||
$request = array(
|
||||
"applyNo" => $applyNo, //TODO +
|
||||
);
|
||||
$response=$requestUtils->doPost("/v2/sign/linkFile",$request);
|
||||
if($response->success==true){
|
||||
$this->getDownload($response->data,root_path().'public/uploads/contract/'.$applyNo.'.pdf');
|
||||
Db::name('contract')->where('contract_no',$applyNo)->update(['contract_url'=>'/uploads/contract/'.$applyNo.'.pdf']);
|
||||
return $this->success('获取成功', ['url' => 'https://worker-task.lihaink.cn/uploads/contract/'.$applyNo.'.pdf']);
|
||||
}else{
|
||||
$response = $requestUtils->doPost("/v2/sign/linkFile", $request);
|
||||
if ($response->success == true) {
|
||||
$this->getDownload($response->data, root_path() . 'public/uploads/contract/' . $applyNo . '.pdf');
|
||||
Db::name('contract')->where('contract_no', $applyNo)->update(['contract_url' => '/uploads/contract/' . $applyNo . '.pdf']);
|
||||
return $this->success('获取成功', ['url' => 'https://worker-task.lihaink.cn/uploads/contract/' . $applyNo . '.pdf']);
|
||||
} else {
|
||||
return $this->fail('获取失败');
|
||||
}
|
||||
}
|
||||
|
||||
public function getDownload($url, $publicDir = '', $fileName = '', $type = 0) {
|
||||
public function getDownload($url, $publicDir = '', $fileName = '', $type = 0)
|
||||
{
|
||||
|
||||
//获取文件路径
|
||||
$newOneDir = substr($publicDir,0,strrpos($publicDir,"/"));
|
||||
$newOneDir = substr($publicDir, 0, strrpos($publicDir, "/"));
|
||||
if (trim($url) == '') {
|
||||
return false;
|
||||
}
|
||||
//检验访问url是否有效
|
||||
$array = get_headers($url,1);
|
||||
if(!preg_match('/200/',$array[0])){
|
||||
$array = get_headers($url, 1);
|
||||
if (!preg_match('/200/', $array[0])) {
|
||||
return false;
|
||||
}
|
||||
if (trim($publicDir) == '') {
|
||||
|
@ -37,6 +37,7 @@ class NoticeEnum
|
||||
const CHANGE_MOBILE_CAPTCHA = 103;
|
||||
const FIND_LOGIN_PASSWORD_CAPTCHA = 104;
|
||||
const WQ = 105;
|
||||
const FCHT = 106;
|
||||
|
||||
|
||||
/**
|
||||
@ -91,6 +92,7 @@ class NoticeEnum
|
||||
self::CHANGE_MOBILE_CAPTCHA => '变更手机验证码',
|
||||
self::FIND_LOGIN_PASSWORD_CAPTCHA => '找回登录密码验证码',
|
||||
self::WQ => '网签短信',
|
||||
self::FCHT => '废除合同',
|
||||
];
|
||||
|
||||
if ($flag) {
|
||||
@ -121,6 +123,8 @@ class NoticeEnum
|
||||
'ZHDLMM' => self::FIND_LOGIN_PASSWORD_CAPTCHA,
|
||||
|
||||
'WQ'=>self::WQ,
|
||||
|
||||
'FCHT'=>self::FCHT,
|
||||
];
|
||||
return $scene[$tag] ?? '';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user