This commit is contained in:
2024-10-15 17:19:23 +08:00
parent 8f903b457f
commit c76451788c
42 changed files with 1600 additions and 237 deletions

View File

@@ -105,7 +105,7 @@ func validDate(fl validator.FieldLevel) bool {
// 自定义身份证校验
func validIDCard(fl validator.FieldLevel) bool {
id := fl.Field().String()
validIDPattern := `^\d{15}$|^\d{18}$|^\d{17}(\d|X|x)$` // 匹配15位或18位身份证
validIDPattern := `^\d{17}(\d|X|x)$` // 匹配18位身份证号码
matched, _ := regexp.MatchString(validIDPattern, id)
return matched
}