From 862210f8d3f979b2f30fa7560511e4d8787aacc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E5=89=8D=E6=98=8E?= <909355014@qq.com> Date: Sat, 24 Sep 2022 19:50:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BA=AB=E4=BB=BD=E8=AF=81=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E8=A7=84=E5=88=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/utils/tools.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/utils/tools.py b/apps/utils/tools.py index 71a8a5c6..8dace665 100755 --- a/apps/utils/tools.py +++ b/apps/utils/tools.py @@ -116,9 +116,10 @@ def check_id_number(idcard): idcard = str(idcard) idcard = idcard.strip() idcard_list = list(idcard) + # 地区校验 - # if not area[(idcard)[0:2]]: - # return False, Errors[4] + if str(idcard[0:2]) not in area: + return False, Errors[3] # 15位身份号码检测 if len(idcard) == 15: @@ -132,7 +133,7 @@ def check_id_number(idcard): if re.match(ereg, idcard): return True, '' else: - return False, Errors[2] + return False, Errors[1] # 18位身份号码检测 elif len(idcard) == 18: # 出生日期的合法性检查 @@ -163,11 +164,11 @@ def check_id_number(idcard): if M == idcard_list[17]: # 检测ID的校验位 return True, '' else: - return False, Errors[3] + return False, Errors[2] else: - return False, Errors[2] + return False, Errors[1] else: - return False, Errors[1] + return False, Errors[0] def check_phone_e(phone):