From 88a5980c525690ee1635a1dd4884ef7cfbf4642e Mon Sep 17 00:00:00 2001 From: zhanglingsheng Date: Wed, 20 Nov 2019 17:33:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BA=AB=E4=BB=BD=E8=AF=81=E8=AE=A4=E8=AF=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sdk/Controller/UserController.class.php | 28 ++++++++++++------- Data/update.sql | 8 ++++-- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/Application/Sdk/Controller/UserController.class.php b/Application/Sdk/Controller/UserController.class.php index 48cc9b91..e63bf46f 100644 --- a/Application/Sdk/Controller/UserController.class.php +++ b/Application/Sdk/Controller/UserController.class.php @@ -2115,10 +2115,23 @@ class UserController extends BaseController $data['age_status'] = 3; // 未成年 } } else { - // if(M('idcard', 'tab_')->where(['name' => $data['real_name'],'id_card' => $data['idcard']])->find()) { - // $data['age_status'] = is_adult($data['idcard']) ? 2 : 3; - // } else { + $model = M('idcard', 'tab_')->where(['name' => $data['real_name'],'id_card' => $data['idcard']])->find(); + if(!empty($model)) { + if($model['status'] == 1) { + $data['age_status'] = is_adult($data['idcard']) ? 2 : 3; + } elseif ($model['status'] == 0) { + $this -> set_message(1069, "fail", "用户数据不匹配"); + } + } else { + $re = age_verify($data['idcard'], $data['real_name']); + $arr['name'] = $data['real_name']; + $arr['id_card'] = $data['idcard']; + $arr['user_id'] = $user['user_id']; + $arr['status'] = ($re == 1 || $re == 2 ) ? 1 : 0; + $arr['ip'] = get_client_ip(); + $arr['create_time'] = time(); + M('idcard', 'tab_')->data($arr)->add(); switch ($re) { case - 1: @@ -2140,14 +2153,9 @@ class UserController extends BaseController default: } - // if($re == 1 || $re == 2) { - // $arr['name'] = $data['real_name']; - // $arr['id_card'] = $data['idcard']; - // M('idcard', 'tab_')->data($arr)->add(); - // } - // } - + } } + $return = M('User', 'tab_') -> where($map) -> save($data); if ($return === false) { $this -> set_message(1070, "fail", "用户数据更新失败"); diff --git a/Data/update.sql b/Data/update.sql index bdceed08..98f5bdbe 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -173,6 +173,10 @@ alter table `tab_giftbag` modify COLUMN `giftbag_version` tinyint(2) COMMENT ' CREATE TABLE `tab_idcard` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(80) NOT NULL COMMENT '姓名', - `id_card` varchar(20) DEFAULT NULL COMMENT '身份证号码', + `id_card` varchar(20) NOT NULL COMMENT '身份证号码', + `user_id` int(11) NOT NULL COMMENT '用户id', + `ip` varchar(40) DEFAULT NULL COMMENT 'ip地址', + `status` tinyint(2) DEFAULT NULL COMMENT '0 认证失败 1 认证成功', + `create_time` int(11) DEFAULT NULL COMMENT '创建时间', PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='正确身份证信息'; \ No newline at end of file +) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='身份证认证信息'; \ No newline at end of file