php对应芝麻信用点滴

来源:互联网 发布:linux互斥锁原理 编辑:程序博客网 时间:2024/04/28 01:46

由于项目需要对接芝麻信用,来验证用户身份的真实性

从注册,签约,应用创建,一切按照官方文档即可

上传自己生成的公钥后,复制芝麻公钥

注意,这个芝麻公钥只是简单的复制到剪贴板,没有公钥格式的

我们相关把格式给加上去,如下:


之后官方的demo代码才可以用,公钥加载坑了我整个半天的时间~~~

另外,还有一个lotusphp和thinkphp有一个C函数冲突的问题,把lotusphp的C函数,随便改个名就好了,搜索了一下,貌似都没有用上~~~


最后上代码:

private function getTransactionId() {    // 推荐生成方式是:30位,(其中17位时间值(精确到毫秒):    // yyyyMMddHHmmssSSS)加上(13位自增数字:1234567890123)    $strId = $this->microtime_str();    $maxId = $this->getMaxid();    $strId .= sprintf("%013d", $maxId);    return $strId;  }  public function zhimaCreditIvsDetailGet($truename, $certno, $phone = ''){    $client = new \ZmopClient($this->gatewayUrl,$this->appId,$this->charset,$this->privateKeyFile,$this->zmPublicKeyFile);    $request = new \ZhimaCreditIvsDetailGetRequest();    $request->setChannel("api");    $request->setPlatform("zmop");    // 必要参数    $request->setProductCode("w1010100000000000103");    // 必要参数             $request->setTransactionId( $this->getTransactionId() );    // 业务参数    $request->setCertNo( $certno );            $request->setCertType("100");            $request->setName( $truename );    if ( strlen($phone) > 0 ) {      $request->setMobile( $phone );      }                 // $request->setEmail("jnlxhy@alitest.com");//             // $request->setBankCard("20110602436748024138");//             // $request->setAddress("杭州市西湖区天目山路266号");//             // $request->setIp("101.247.161.1");//             // $request->setMac("44-45-53-54-00-00");//             // $request->setWifimac("00-00-00-00-00-00-00-E0");//             // $request->setImei("868331011992179");//             // $request->setImsi("460030091733165");//    $response = $client->execute($request);    echo json_encode($response);  }}


0 1
原创粉丝点击