public function idCheck() { $jsoncode = file_get_contents("php://input"); $arr = array(); $arr = json_decode($jsoncode, true); if (!is_array($arr) || empty($arr) || empty($arr['real_name']) || empty($arr['idcard'])) { ajaxmsg("数据有误!", 0); } if ($arr['uid'] != $this->uid) { ajaxmsg("数据有误!", 0); } $id5_config = FS("Webconfig/id5"); if ($id5_config[enable] == 0) { //echo '实名验证授权没有开启!!!'; //echo "aaaa";die(); $this->saveid($arr['real_name'], $arr['idcard']); exit; } $data['real_name'] = text($arr['real_name']); $data['idcard'] = text($arr['idcard']); $data['up_time'] = time(); // /////////////////////// $data1['idcard'] = text($arr['idcard']); $data1['up_time'] = time(); $data1['uid'] = $this->uid; $data1['status'] = 0; $card = $data1['idcard']; $xuid = M('member_info')->getFieldByIdcard($data['idcard'], 'uid'); if ($xuid > 0 && $xuid != $this->uid) { ajaxmsg("此身份证号码已被人使用", 0); } // dump(11222);exit; $b = M('name_apply')->where("uid = {$this->uid}")->count('uid'); if ($b == 1) { M('name_apply')->where("uid ={$this->uid}")->save($data1); } else { M('name_apply')->add($data1); } // ////////////////////// // if($isimg!=1) ajaxmsg("请先上传身份证正面图片",0); // if($isimg2!=1) ajaxmsg("请先上传身份证反面图片",0); if (empty($data['real_name']) || empty($data['idcard'])) { ajaxmsg("请填写真实姓名和身份证号码", 0); } $c = M('member_info')->where("uid = {$this->uid}")->count('uid'); if ($c == 1) { $newid = M('member_info')->where("uid = {$this->uid}")->save($data); } else { $data['uid'] = $this->uid; $newid = M('member_info')->add($data); } function get_data($d) { preg_match_all('/<ROWS>(.*)<\\/ROWS>/isU', $d, $arr); $data = array(); $aa = array(); $cc = array(); foreach ($arr[1] as $k => $v) { preg_match_all('#<result_gmsfhm>(.*)</result_gmsfhm>#isU', $v, $ar[$k]); preg_match_all('#<gmsfhm>(.*)</gmsfhm>#isU', $v, $sfhm[$k]); preg_match_all('#<result_xm>(.*)</result_xm>#isU', $v, $br[$k]); preg_match_all('#<xm>(.*)</xm>#isU', $v, $xm[$k]); preg_match_all('#<xp>(.*)</xp>#isU', $v, $cr[$k]); $data[] = $ar[$k][1]; $aa[] = $br[$k][1]; $cc[] = $cr[$k][1]; $sfhm[] = $sfhm[1]; $xm[] = $xm[1]; } $resa['data'] = $data[0][0]; $resa['aa'] = $aa[0][0]; $resa['cc'] = $cc[0][0]; $resa['xm'] = $xm[0][0][0]; $resa['sfhm'] = $sfhm[0][0][0]; return $resa; } $res = ''; try { $client = new SoapClient(C("APP_ROOT") . "common/wsdl/NciicServices.wsdl"); $licenseCode = $id5_config['auth']; //file_get_contents(C("APP_ROOT")."common/wsdl/license.txt"); $condition = '<?xml version="1.0" encoding="UTF-8" ?> <ROWS> <INFO> <SBM>' . time() . '</SBM> </INFO> <ROW> <GMSFHM>公民身份号码</GMSFHM> <XM>姓名</XM> </ROW> <ROW FSD="100022" YWLX="身份证认证测试-错误" > <GMSFHM>' . trim($arr['idcard']) . '</GMSFHM> <XM>' . trim($arr['real_name']) . '</XM> </ROW> </ROWS>'; //330381198609262623 薛佩佩 $params = array('inLicense' => $licenseCode, 'inConditions' => $condition); $res = $client->nciicCheck($params); } catch (Exception $e) { echo $e->getMessage(); exit; } // ajaxmsg("aaaaaaaaaa",1); // echo $res->out; $shuju = get_data($res->out); // ajaxmsg("实名认证成功",1); if (@$shuju['data'] == '一致' && @$shuju['aa'] == '一致') { $time = time(); $temp = M('members_status')->where("uid={$this->uid}")->find(); if (is_array($temp)) { $cid['id_status'] = 1; $status = M('members_status')->where("uid={$this->uid}")->save($cid); } else { $dt['uid'] = $this->uid; $dt['id_status'] = 1; $status = M('members_status')->add($dt); } if ($status) { $data2['status'] = 1; $data2['deal_info'] = '会员中心实名认证成功'; $new = M("name_apply")->where("uid={$this->uid}")->save($data2); if ($new) { ajaxmsg('会员中心实名认证成功', 3); } } else { $data2['status'] = 0; $data2['deal_info'] = '会员中心实名认证失败'; $new = M("name_apply")->where("uid={$this->uid}")->save($data2); ajaxmsg("认证失败", 0); } // unlink($file); } else { ajaxmsg("实名认证失败", 0); $mm = M('members_status')->where("uid={$this->uid}")->setField('id_status', 3); if ($mm == 1) { ajaxmsg('待审核', 0); } else { $dt['uid'] = $this->uid; $dt['id_status'] = 3; M('members_status')->add($dt); ajaxmsg('等待审核', 0); } } }