fix: 调整手机号的校验正则为宽松政策,变成只校验开头为1的11位数字, (#137)

This commit is contained in:
二丫讲梵 2022-12-16 17:05:38 +08:00 committed by GitHub
parent a5b68c19a6
commit 8959e4949f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -36,7 +36,7 @@ func init() {
}
func checkMobile(fl validator.FieldLevel) bool {
reg := `^1(3[0-2]|4[5-9]|5[0-35-9]|6[2-8]|7[1-9]|8[1-35-8]|9[89])\d{8}$`
reg := `1\d{10}`
rgx := regexp.MustCompile(reg)
return rgx.MatchString(fl.Field().String())
}

View File

@ -28,7 +28,7 @@ func InitValidate() {
}
func checkMobile(fl validator.FieldLevel) bool {
reg := `^1(3[0-2]|4[5-9]|5[0-35-9]|6[2-8]|7[1-9]|8[1-35-8]|9[89])\d{8}$`
reg := `1\d{10}`
rgx := regexp.MustCompile(reg)
return rgx.MatchString(fl.Field().String())
}