|
@@ -3871,28 +3871,21 @@ func VerifyMobileFormat(mobileNum string) bool {
|
3871
|
3871
|
func IsIdCard(id string) (res bool) {
|
3872
|
3872
|
id = strings.ToUpper(id)
|
3873
|
3873
|
if len(id) != 15 && len(id) != 18 {
|
3874
|
|
- fmt.Println("11111")
|
3875
|
3874
|
return false
|
3876
|
3875
|
}
|
3877
|
3876
|
r := regexp.MustCompile("(\\d{15})|(\\d{17}([0-9]|X))")
|
3878
|
3877
|
if !r.MatchString(id) {
|
3879
|
|
- fmt.Println("2222222")
|
3880
|
|
-
|
3881
|
3878
|
return false
|
3882
|
3879
|
}
|
3883
|
3880
|
if len(id) == 15 {
|
3884
|
3881
|
tm2, _ := time.Parse("01/02/2006", string([]byte(id)[8:10])+"/"+string([]byte(id)[10:12])+"/"+"19"+string([]byte(id)[6:8]))
|
3885
|
3882
|
if tm2.Unix() <= 0 {
|
3886
|
|
- fmt.Println("33333333")
|
3887
|
|
-
|
3888
|
3883
|
return false
|
3889
|
3884
|
}
|
3890
|
3885
|
return true
|
3891
|
3886
|
} else {
|
3892
|
3887
|
tm2, _ := time.Parse("01/02/2006", string([]byte(id)[10:12])+"/"+string([]byte(id)[12:14])+"/"+string([]byte(id)[6:10]))
|
3893
|
3888
|
if tm2.Unix() <= 0 {
|
3894
|
|
- fmt.Println("fdfgdgfdgfd")
|
3895
|
|
-
|
3896
|
3889
|
return false
|
3897
|
3890
|
}
|
3898
|
3891
|
|
|
@@ -3901,17 +3894,12 @@ func IsIdCard(id string) (res bool) {
|
3901
|
3894
|
arr_ch := []string{",", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"}
|
3902
|
3895
|
sign := 0
|
3903
|
3896
|
for k, v := range arr_int {
|
3904
|
|
-
|
3905
|
3897
|
int_temp, _ := strconv.Atoi(string([]byte(id)[k : k+1]))
|
3906
|
|
-
|
3907
|
3898
|
sign += int_temp * v
|
3908
|
|
-
|
3909
|
3899
|
}
|
3910
|
3900
|
n := sign % 11
|
3911
|
3901
|
val_num := arr_ch[n]
|
3912
|
3902
|
if val_num != string([]byte(id)[17:18]) {
|
3913
|
|
- fmt.Println("555555555555")
|
3914
|
|
-
|
3915
|
3903
|
return false
|
3916
|
3904
|
}
|
3917
|
3905
|
return true
|