• 支付宝芝麻认证,demo,


    //个人认证使用芝麻认证
    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 himaCustomerCertificationInitializeRequest ();
    $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 himaCustomerCertificationQueryRequest ();
    $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 himaCustomerCertificationCertifyRequest ();
    $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);
    }
  • 相关阅读:
    梯度提升树(GBDT)原理小结
    scikit-learn Adaboost类库使用小结
    集成学习之Adaboost算法原理小结
    集成学习原理小结
    支持向量机高斯核调参小结
    scikit-learn 支持向量机算法库使用小结
    支持向量机原理(五)线性支持回归
    支持向量机原理(四)SMO算法原理
    支持向量机原理(三)线性不可分支持向量机与核函数
    支持向量机原理(二) 线性支持向量机的软间隔最大化模型
  • 原文地址:https://www.cnblogs.com/jackduan/p/7193966.html
Copyright © 2020-2023  润新知