|
|
|
@ -1177,11 +1177,21 @@ function think_psw_md5($str, $key = 'ThinkUCenter')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//对年龄的审核
|
|
|
|
|
function age_verify($cardno, $name)
|
|
|
|
|
function age_verify($cardno, $name, $user_id = '')
|
|
|
|
|
{
|
|
|
|
|
$date = age($cardno, $name);
|
|
|
|
|
$info = '';
|
|
|
|
|
$date = age($cardno, $name, $info);
|
|
|
|
|
|
|
|
|
|
$arr['name'] = $name;
|
|
|
|
|
$arr['id_card'] = $cardno;
|
|
|
|
|
$arr['user_id'] = $user_id;
|
|
|
|
|
$arr['ip'] = get_client_ip();
|
|
|
|
|
$arr['create_time'] = time();
|
|
|
|
|
$arr['info'] = $info;
|
|
|
|
|
|
|
|
|
|
if ($date['status'] == '01') {
|
|
|
|
|
$arr['status'] = 1;
|
|
|
|
|
M('idcard_log', 'tab_')->data($arr)->add();
|
|
|
|
|
$age = floor((time() - strtotime($date['birthday'])) / (60 * 60 * 24 * 365));
|
|
|
|
|
if ($age > 17) {
|
|
|
|
|
return 1;
|
|
|
|
@ -1189,47 +1199,55 @@ function age_verify($cardno, $name)
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
} elseif (isset($date['status']) && $date['status'] != '01') {
|
|
|
|
|
$arr['status'] = 0;
|
|
|
|
|
M('idcard_log', 'tab_')->data($arr)->add();
|
|
|
|
|
return 0;
|
|
|
|
|
} elseif(!isset($date['status']) && $date == 0) {
|
|
|
|
|
$arr['status'] = 0;
|
|
|
|
|
M('idcard_log', 'tab_')->data($arr)->add();
|
|
|
|
|
return 0;
|
|
|
|
|
} else {
|
|
|
|
|
$arr['status'] = -1;
|
|
|
|
|
M('idcard_log', 'tab_')->data($arr)->add();
|
|
|
|
|
return $date;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//根据配置向接口发送身份证号和姓名进行验证
|
|
|
|
|
function age($cardno, $name)
|
|
|
|
|
function age($cardno, $name, &$info)
|
|
|
|
|
{
|
|
|
|
|
$host = "https://idcardcert.market.alicloudapi.com";
|
|
|
|
|
$path = "/idCardCert";
|
|
|
|
|
$method = "GET";
|
|
|
|
|
$appcode = "244181f0846541a19e24df409736d3b9";
|
|
|
|
|
$headers = array();
|
|
|
|
|
array_push($headers, "Authorization:APPCODE " . $appcode);
|
|
|
|
|
$querys = "idCard={$cardno}&name={$name}";
|
|
|
|
|
$bodys = "";
|
|
|
|
|
$url = $host . $path . "?" . $querys;
|
|
|
|
|
|
|
|
|
|
$curl = curl_init();
|
|
|
|
|
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
|
|
|
|
|
curl_setopt($curl, CURLOPT_URL, $url);
|
|
|
|
|
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
|
|
|
|
curl_setopt($curl, CURLOPT_FAILONERROR, false);
|
|
|
|
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
|
|
|
|
curl_setopt($curl, CURLOPT_HEADER, false);
|
|
|
|
|
//curl_setopt($curl, CURLOPT_HEADER, true); 如不输出json, 请打开这行代码,打印调试头部状态码。
|
|
|
|
|
//状态码: 200 正常;400 URL无效;401 appCode错误; 403 次数用完; 500 API网管错误
|
|
|
|
|
if (1 == strpos("$".$host, "https://"))
|
|
|
|
|
{
|
|
|
|
|
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
|
|
|
|
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
|
|
|
|
|
}
|
|
|
|
|
$output = curl_exec($curl);
|
|
|
|
|
if (empty($output)) {
|
|
|
|
|
return -1;//用完
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$r = json_decode($output, true);
|
|
|
|
|
if ($r['status'] == "02") return 0;
|
|
|
|
|
|
|
|
|
|
$host = "https://idcardcert.market.alicloudapi.com";
|
|
|
|
|
$path = "/idCardCert";
|
|
|
|
|
$method = "GET";
|
|
|
|
|
$appcode = "244181f0846541a19e24df409736d3b9";
|
|
|
|
|
$headers = array();
|
|
|
|
|
array_push($headers, "Authorization:APPCODE " . $appcode);
|
|
|
|
|
$querys = "idCard={$cardno}&name={$name}";
|
|
|
|
|
$bodys = "";
|
|
|
|
|
$url = $host . $path . "?" . $querys;
|
|
|
|
|
|
|
|
|
|
$curl = curl_init();
|
|
|
|
|
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
|
|
|
|
|
curl_setopt($curl, CURLOPT_URL, $url);
|
|
|
|
|
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
|
|
|
|
curl_setopt($curl, CURLOPT_FAILONERROR, false);
|
|
|
|
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
|
|
|
|
curl_setopt($curl, CURLOPT_HEADER, false);
|
|
|
|
|
//curl_setopt($curl, CURLOPT_HEADER, true); 码。
|
|
|
|
|
//状态码: 200 正常;400 URL无效;401 appCode错如不输出json, 请打开这行代码,打印调试头部状态误; 403 次数用完; 500 API网管错误
|
|
|
|
|
if (1 == strpos("$".$host, "https://"))
|
|
|
|
|
{
|
|
|
|
|
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
|
|
|
|
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
|
|
|
|
|
}
|
|
|
|
|
$output = curl_exec($curl);
|
|
|
|
|
$info = $output;
|
|
|
|
|
if (empty($output)) {
|
|
|
|
|
return -1;//用完
|
|
|
|
|
}
|
|
|
|
|
$r = json_decode($output, true);
|
|
|
|
|
if ($r['status'] == "02") return 0;
|
|
|
|
|
|
|
|
|
|
return $r;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|