实名认证5.0

master
chenzhi 5 years ago
parent 5ba92f1e82
commit c08a01d7e8

@ -1190,15 +1190,15 @@ function age_verify($cardno, $name)
{ {
$date = age($cardno, $name); $date = age($cardno, $name);
if ($date['resp']['code'] == 0 && $date > 0) { if ($date['status'] == "01") {
$age = floor((time() - strtotime($date['data']['birthday'])) / (60 * 60 * 24 * 365)); $age = floor((time() - strtotime($date['data']['birthday'])) / (60 * 60 * 24 * 365));
if ($age > 17) { if ($age > 17) {
return 1; return 1;
} else { } else {
return 2; return 2;
} }
} elseif ($date['resp']['code'] != 0 && $date > 0) { } elseif ($date['status'] > 200) {
return 0; return -2;
} else { } else {
return $date; return $date;
} }
@ -1231,15 +1231,23 @@ function age($cardno, $name)
if (empty($output)) { if (empty($output)) {
return -1;//用完 return -1;//用完
} }
if (curl_getinfo($curl, CURLINFO_HTTP_CODE) == '200') {
$headersize = curl_getinfo($curl, CURLINFO_HEADER_SIZE); $r = json_decode($output, true);
$header = substr($output, 0, $headersize); if ($r['status'] == "02") return 0;
$body = substr($output, $headersize);
curl_close($curl); return $r;
return json_decode($body, true); // if (empty($output)) {
} else { // return -1;//用完
return -2;//失败 // }
} // if (curl_getinfo($curl, CURLINFO_HTTP_CODE) == '200') {
// $headersize = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
// $header = substr($output, 0, $headersize);
// $body = substr($output, $headersize);
// curl_close($curl);
// return json_decode($body, true);
// } else {
// return -2;//失败
// }
} }
/*短信发送验证限制条件 */ /*短信发送验证限制条件 */

@ -1033,13 +1033,12 @@ class UserController extends BaseController
} }
if ($re == 1) { if ($re == 1) {
$resdata['age_status'] = 2;//成年 $resdata = 2;//成年
} }
if ($re == 2) { if ($re == 2) {
$resdata['age_status'] = 3;//未成年 $resdata = 3;//未成年
} }
} }
// if ($re > 0) { // if ($re > 0) {
$model = D('User')->where($map)->save(array('real_name' => $_REQUEST['real_name'], 'idcard' => $_REQUEST['idcard'], 'age_status' => $resdata)); $model = D('User')->where($map)->save(array('real_name' => $_REQUEST['real_name'], 'idcard' => $_REQUEST['idcard'], 'age_status' => $resdata));
// } // }

Loading…
Cancel
Save