获取实名信息
This commit is contained in:
65
app/realname/controller/Publicget.php
Normal file
65
app/realname/controller/Publicget.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace app\realname\controller;
|
||||
|
||||
use Jdcloud\Credentials\Credentials;
|
||||
use Jdcloud\Result;
|
||||
use Jdcloud\Cloudauth\CloudauthClient;
|
||||
use app\api\model\User;
|
||||
|
||||
class Publicget
|
||||
{
|
||||
private function getCred(){
|
||||
$ak = "JDC_A3B38E573D7404F976472FB42F52";
|
||||
$sk = "C9BAE98F49B42DA2DC02868A75AA3AD8";
|
||||
$cred = new Credentials($ak, $sk);
|
||||
return $cred;
|
||||
}
|
||||
|
||||
public function getResult() {
|
||||
|
||||
|
||||
$id_code = $_GET['id_code'];
|
||||
|
||||
$user = new User;
|
||||
$user_one_info = $user->getNewOne(['id_code'=>$id_code]);
|
||||
|
||||
|
||||
|
||||
$client = new CloudauthClient([
|
||||
'credentials' => $this->getCred(),
|
||||
'version' => 'latest',
|
||||
'scheme' => 'http'
|
||||
]);
|
||||
|
||||
try{
|
||||
$res = $client->GetAliveResult([
|
||||
'token' => $user_one_info['certify_id'],
|
||||
]);
|
||||
if ($res['result']['h5Result'] == 'ok' && $res['result']['smResult'] == 'ok' && $res['result']['rxResult'] == 'ok') {
|
||||
|
||||
|
||||
$update_one = [
|
||||
'is_verify' => 1
|
||||
];
|
||||
$user->updateOne(['Id'=>$user_one_info['Id']],$update_one);
|
||||
|
||||
echo '<h1>实名认证成功</h1></br>';
|
||||
|
||||
echo "页面将在5秒后自动跳转...</br>";
|
||||
|
||||
echo "<a href='https://www.juip.com/User/Index' />如果没有跳转,请点这里跳转</a>";
|
||||
|
||||
header("Refresh: 5; url=https://www.juip.com/User/Index");
|
||||
die;
|
||||
} else {
|
||||
echo '<h1>'.$res['result']['desc'].'</h1></br>';
|
||||
}
|
||||
}catch (\Jdcloud\Exception\JdcloudException $e) {
|
||||
print("ERROR");
|
||||
var_dump($e->getMessage());
|
||||
$this->assertFalse(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user