//个人认证使用芝麻认证
public function zhima(){
vendor(\'alipay.alipayapp.AopSdk\');
$alipay_config = C(\'alipay_config\');
$aop = new \AopClient ();
$aop->gatewayUrl = \'https://openapi.alipay.com/gateway.do\';
$aop->appId = $alipay_config[\'app_id\'];
$aop->rsaPrivateKey = $alipay_config[\'private_key\'];
$aop->alipayrsaPublicKey = $alipay_config[\'public_key\'];
$aop->apiVersion = \'1.0\';
$aop->signType = \'RSA2\';
$aop->postCharset=\'UTF-8\';
$aop->format=\'json\';
$request = new \ZhimaCustomerCertificationInitializeRequest ();
$uid = $this->userid;
$transaction_id = date(\'Ymd\') . $uid . uniqid();
$cert_name = $_POST[\'cert_name\'];
$cert_no = $_POST[\'cert_no\'];
$request->setBizContent("{" .
"\"transaction_id\":\"$transaction_id\"," .
"\"product_code\":\"w1010100000000002978\"," .
"\"biz_code\":\"FACE\"," .
"\"identity_param\":\"{\\\"identity_type\\\":\\\"CERT_INFO\\\",\\\"cert_type\\\":\\\"IDENTITY_CARD\\\",\\\"cert_name\\\":\\\"$cert_name\\\",\\\"cert_no\\\":\\\"$cert_no\\\"}\"," .
"\"ext_biz_param\":\"{}\"" .
" }");
$result = $aop->execute ( $request);
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
$resultCode = $result->$responseNode->code;
if(!empty($resultCode)&&$resultCode == 10000){
$res[\'biz_no\'] = $result->$responseNode->biz_no;
$res[\'status\'] = \'1\';
$this->ajaxReturn($res);
} else {
$res[\'status\'] = \'0\';
$this->ajaxReturn($res);
}
}
//芝麻认证查询
public function zhimaquery(){
vendor(\'alipay.alipayapp.AopSdk\');
$alipay_config = C(\'alipay_config\');
$aop = new \AopClient ();
$aop->gatewayUrl = \'https://openapi.alipay.com/gateway.do\';
$aop->appId = $alipay_config[\'app_id\'];
$aop->rsaPrivateKey = $alipay_config[\'private_key\'];
$aop->alipayrsaPublicKey = $alipay_config[\'public_key\'];
$aop->apiVersion = \'1.0\';
$aop->signType = \'RSA2\';
$aop->postCharset=\'UTF-8\';
$aop->format=\'json\';
$biz_no = $_POST[\'biz_no\'];
$request = new \ZhimaCustomerCertificationQueryRequest ();
$request->setBizContent("{" .
"\"biz_no\":\"$biz_no\"" .
" }");
$result = $aop->execute ( $request);
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
$resultCode = $result->$responseNode->code;
if(!empty($resultCode)&&$resultCode == 10000){
$res[\'passed\'] = $result->$responseNode->passed;
$res[\'status\'] = \'1\';
$this->ajaxReturn($res);
} else {
$res[\'passed\'] = \'false\';
$res[\'status\'] = \'0\';
$this->ajaxReturn($res);
}
}
//开始认证
public function zhimaiden(){
vendor(\'alipay.alipayapp.AopSdk\');
$alipay_config = C(\'alipay_config\');
$aop = new \AopClient ();
$aop->gatewayUrl = \'https://openapi.alipay.com/gateway.do\';
$aop->appId = $alipay_config[\'app_id\'];
$aop->rsaPrivateKey = $alipay_config[\'private_key\'];
$aop->alipayrsaPublicKey = $alipay_config[\'public_key\'];
$aop->apiVersion = \'1.0\';
$aop->signType = \'RSA2\';
$aop->postCharset=\'UTF-8\';
$aop->format=\'json\';
$biz_no = $_POST[\'biz_no\'];
$request = new \ZhimaCustomerCertificationCertifyRequest ();
$request->setBizContent("{" .
"\"biz_no\":\"$biz_no\"" .
" }");
$request->setReturnUrl("alipays://www.taobao.com"); //认证回调接口?
$test = $aop->pageExecute($request,"GET");
$test = base64_encode($test);
if($test){
//转成二维码
$src = U("iden/zhimaqrcode", array("url" =>$test));
$res[\'data\'] = $src;
$res[\'status\'] = \'1\';
$this->ajaxReturn($res);
}else{
$res[\'status\'] = \'0\';
$this->ajaxReturn($res);
}
}
public function zhimaqrcode(){
Vendor(\'WxpayAPI.example.qrcode\');
$qrcode = new \QRcode();
$test = base64_decode($_GET[\'url\']);
$qrcode->png($test,false);
}
相关文章:
- 支付宝 支付demo调试 2022-12-23
- 支付宝支付demo(亲测) 2022-12-23
- 支付宝:绑定信用卡账单可提升芝麻分 2021-11-13
- 今日即将更新芝麻分!来看看支付宝芝麻分500以上用户的福利! 2021-07-19
- 微信APP支付,支付宝APP支付demo 2021-11-15
- 为什么你的支付宝芝麻信用分就是不涨? 2022-01-17
- 用canvas写仿支付宝中的芝麻信用分的效果 2021-12-20
- 支付宝接口demo 2021-12-17