<?php
namespace app\home\controller;
use app\common\logic\UserAddressLogic;
use app\common\logic\GoodsActivityLogic;
use app\common\logic\CouponLogic;
use app\common\logic\IntegralLogic;
use app\common\logic\CartLogic;
use app\common\logic\OrderLogic;
use app\common\logic\PickupLogic;
use app\common\model\SpecGoodsPrice;
use app\common\model\Goods;
use think\Db;
header("Content-type:text/html;charset=utf-8");
//e签宝
class Eqb extends Base {
private $redirectUrl =''; //签属结束后跳转页
private $notifyUrl =''; //签属回调页
private $eSignAppId =''; //app id
private $eSignAppSecret=''; // app key
private $eSignHost ='https://smlopenapi.esign.cn'; //模拟环境
private $eSignUpload ='https://esignoss.esign.cn'; //文件流
// private $eSignUpload ='https://oss.esign.cn'; //模拟环境
// private $eSignHost ='https://openapi.esign.cn'; //正式环境
/**
* 初始化函数
*/
public function _initialize()
{
}
//消息回调通知
public function notifyurl(){
$data = file_get_contents('php://input');
file_put_contents('eqb.txt',$data,FILE_APPEND);//追加写入消息日志
$json = json_decode($data,true);
if($json['action']=='SIGN_MISSON_COMPLETE' && $json['signResult']==2){
//签署完成
$mobile = $json['operator']['psnAccount']['accountMobile'];
$user = M('users')->where(['mobile'=>$mobile])->save(['eqb_status'=>1]);
}
// $json = [
// "action" => "SIGN_MISSON_COMPLETE",
// "timestamp" => 1718267179875,
// "signFlowId" => "46b0609529ad458e8a3eec361e3f87f7",
// "customBizNum" => "1718267148",
// "signOrder" => 1,
// "operateTime" => 1718267179000,
// "signResult" => 2,
// "resultDescription" => "签署完成",
// "operator" => [
// "psnId" => "030abcd9221f478e8446600054ed1772",
// "psnAccount" => [
// "accountMobile" => "15241508811"
// ]
// ]
// ];
// echo 12;die;
}
//印章回调通知
public function notifyyinzhang(){
$data = file_get_contents('php://input');
file_put_contents('eqbyinzhang.txt',$data,FILE_APPEND);//追加写入消息日志
// echo 12;die;
}
//展示页面测试
public function show(){
return $this->fetch('index/eqb');
}
//上传本地文件
public function upload($filePath='',$fileName=''){
$url = '/v3/files/file-upload-url';
$host = $this->eSignHost.'/v3/files/file-upload-url';
// $filePath = "./esign/平台用户合作协议(青抖云).pdf";
// 文件Content-MD5值 4wobwYcP/xHBzdaIx4hiuQ==
$fileContentMD5 = $this->getFileContentMD5($filePath);
// echo $fileContentMD5;die;
$content_type = "application/pdf";
$data = [
'contentMd5'=>$fileContentMD5,
'contentType'=>$content_type,
'convertToPDF'=>false,
'fileName'=>$fileName,
'fileSize'=>filesize($filePath)
];
$json = json_encode($data,JSON_UNESCAPED_UNICODE);
$headers = $this->buildSignedHeaders($this->eSignAppId,$this->eSignAppSecret,'POST', $json, 'application/json; charset
thinkphp快速对接e签宝平台
最新推荐文章于 2024-09-17 22:57:34 发布