|
@@ -81,20 +81,42 @@ class ESignContractServer
|
|
|
|
|
|
|
|
$signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], $paramStr, $requestType, $apiaddr);
|
|
$signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], $paramStr, $requestType, $apiaddr);
|
|
|
//获取文件上传地址
|
|
//获取文件上传地址
|
|
|
- EsignLogHelper::printMsg($signAndBuildSignAndJsonHeader);
|
|
|
|
|
|
|
+// EsignLogHelper::printMsg($signAndBuildSignAndJsonHeader);
|
|
|
$response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, $paramStr);
|
|
$response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, $paramStr);
|
|
|
- EsignLogHelper::printMsg($response->getStatus());
|
|
|
|
|
- EsignLogHelper::printMsg($response->getBody());
|
|
|
|
|
|
|
+// EsignLogHelper::printMsg($response->getStatus());
|
|
|
|
|
+// EsignLogHelper::printMsg($response->getBody());
|
|
|
$fileUploadUrl=json_decode($response->getBody())->data->fileUploadUrl;
|
|
$fileUploadUrl=json_decode($response->getBody())->data->fileUploadUrl;
|
|
|
$fileId=json_decode($response->getBody())->data->fileId;
|
|
$fileId=json_decode($response->getBody())->data->fileId;
|
|
|
//文件流put上传
|
|
//文件流put上传
|
|
|
$response=EsignHttpHelper::upLoadFileHttp($fileUploadUrl,$filePath,"application/pdf");
|
|
$response=EsignHttpHelper::upLoadFileHttp($fileUploadUrl,$filePath,"application/pdf");
|
|
|
- EsignLogHelper::printMsg($response->getStatus());
|
|
|
|
|
- EsignLogHelper::printMsg($response->getBody());
|
|
|
|
|
|
|
+// EsignLogHelper::printMsg($response->getStatus());
|
|
|
|
|
+// EsignLogHelper::printMsg($response->getBody());
|
|
|
|
|
|
|
|
return $fileId;
|
|
return $fileId;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取文件状态
|
|
|
|
|
+ * @param $fileId
|
|
|
|
|
+ * @return int|mixed
|
|
|
|
|
+ */
|
|
|
|
|
+ function getFileStatus($fileId)
|
|
|
|
|
+ {
|
|
|
|
|
+ $config=$this->config;
|
|
|
|
|
+ $apiaddr="/v3/files/{$fileId}";
|
|
|
|
|
+ $requestType = HttpEmun::GET;
|
|
|
|
|
+ //生成签名验签+json体的header
|
|
|
|
|
+ $signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], "", $requestType, $apiaddr);
|
|
|
|
|
+ //发起接口请求
|
|
|
|
|
+ $response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, "");
|
|
|
|
|
+ $ret=json_decode($response->getBody(),true);
|
|
|
|
|
+ if(isset($ret['code']) && $ret['code']==0){
|
|
|
|
|
+ return $ret['data']['fileStatus'];
|
|
|
|
|
+ }else{
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 获取签署文件对应关键字坐标
|
|
* 获取签署文件对应关键字坐标
|
|
|
* @param $fileId
|
|
* @param $fileId
|
|
@@ -114,10 +136,10 @@ class ESignContractServer
|
|
|
|
|
|
|
|
$signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], $paramStr, $requestType, $apiaddr);
|
|
$signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], $paramStr, $requestType, $apiaddr);
|
|
|
//获取文件上传地址
|
|
//获取文件上传地址
|
|
|
- EsignLogHelper::printMsg($signAndBuildSignAndJsonHeader);
|
|
|
|
|
|
|
+// EsignLogHelper::printMsg($signAndBuildSignAndJsonHeader);
|
|
|
$response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, $paramStr);
|
|
$response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, $paramStr);
|
|
|
- EsignLogHelper::printMsg($response->getStatus());
|
|
|
|
|
- EsignLogHelper::printMsg($response->getBody());
|
|
|
|
|
|
|
+// EsignLogHelper::printMsg($response->getStatus());
|
|
|
|
|
+// EsignLogHelper::printMsg($response->getBody());
|
|
|
$ret=json_decode($response->getBody(),true);
|
|
$ret=json_decode($response->getBody(),true);
|
|
|
if(isset($ret['code']) && $ret['code']==0){
|
|
if(isset($ret['code']) && $ret['code']==0){
|
|
|
return ['code'=>'1','msg'=>'ok','data'=>$ret['data']['keywordPositions']];
|
|
return ['code'=>'1','msg'=>'ok','data'=>$ret['data']['keywordPositions']];
|
|
@@ -136,9 +158,11 @@ class ESignContractServer
|
|
|
foreach ($signData as $k=>$v){
|
|
foreach ($signData as $k=>$v){
|
|
|
$keywords[]=$v['keyword'];
|
|
$keywords[]=$v['keyword'];
|
|
|
}
|
|
}
|
|
|
- //获取对应关键字定位
|
|
|
|
|
|
|
|
|
|
|
|
+ //获取对应关键字定位
|
|
|
|
|
+//dd(111);
|
|
|
$positionRet=ESignContractServer::creatServer()->getKeywordPositions($fileId,$keywords);
|
|
$positionRet=ESignContractServer::creatServer()->getKeywordPositions($fileId,$keywords);
|
|
|
|
|
+ dd($positionRet);
|
|
|
if(empty($positionRet['code'])){
|
|
if(empty($positionRet['code'])){
|
|
|
return ['code'=>0,'msg'=>'签署区域定位失败'];
|
|
return ['code'=>0,'msg'=>'签署区域定位失败'];
|
|
|
}else{
|
|
}else{
|
|
@@ -243,7 +267,6 @@ class ESignContractServer
|
|
|
if(empty($signers)){
|
|
if(empty($signers)){
|
|
|
return ['code'=>0,'msg'=>'暂无可执行电签印章'];
|
|
return ['code'=>0,'msg'=>'暂无可执行电签印章'];
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
$flowId= $this->createByFile($fileId,$file_name.'.pdf',$file_name,$signers);
|
|
$flowId= $this->createByFile($fileId,$file_name.'.pdf',$file_name,$signers);
|
|
|
|
|
|
|
|
if($flowId){
|
|
if($flowId){
|
|
@@ -288,10 +311,10 @@ class ESignContractServer
|
|
|
|
|
|
|
|
$signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], $paramStr, $requestType, $apiaddr);
|
|
$signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], $paramStr, $requestType, $apiaddr);
|
|
|
|
|
|
|
|
- EsignLogHelper::printMsg($signAndBuildSignAndJsonHeader);
|
|
|
|
|
|
|
+// EsignLogHelper::printMsg($signAndBuildSignAndJsonHeader);
|
|
|
$response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, $paramStr);
|
|
$response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, $paramStr);
|
|
|
- EsignLogHelper::printMsg($response->getStatus());
|
|
|
|
|
- EsignLogHelper::printMsg($response->getBody());
|
|
|
|
|
|
|
+// EsignLogHelper::printMsg($response->getStatus());
|
|
|
|
|
+// EsignLogHelper::printMsg($response->getBody());
|
|
|
|
|
|
|
|
$signFlowId = false;
|
|
$signFlowId = false;
|
|
|
if($response->getStatus() == 200){
|
|
if($response->getStatus() == 200){
|