Explorar o código

Merge branch 'master' of http://8.136.199.33:3000/hongze/hongze_cygx into cygx4.2.0

xingzai %!s(int64=3) %!d(string=hai) anos
pai
achega
9eee1edfd2
Modificáronse 3 ficheiros con 11 adicións e 4 borrados
  1. 1 1
      controllers/user.go
  2. 6 0
      utils/common.go
  3. 4 3
      utils/constants.go

+ 1 - 1
controllers/user.go

@@ -1109,7 +1109,7 @@ func (this *UserController) AddOutboundMobile() {
 		br.ErrMsg = "参数解析失败,Err:" + err.Error()
 		return
 	}
-	if !utils.ValidateFixedTelephoneFormatat(req.OutboundMobile) && !utils.ValidateMobileFormatat(req.OutboundMobile) {
+	if !utils.ValidateFixedTelephoneFormatatEasy(req.OutboundMobile) {
 		br.Msg = "号码格式有误,请重新填写!"
 		br.ErrMsg = "号码格式有误,请重新填写" + req.OutboundMobile
 		return

+ 6 - 0
utils/common.go

@@ -221,6 +221,12 @@ func ValidateFixedTelephoneFormatat(mobileNum string) bool {
 	return reg.MatchString(mobileNum)
 }
 
+//验证是否是固定电话宽松
+func ValidateFixedTelephoneFormatatEasy(mobileNum string) bool {
+	reg := regexp.MustCompile(RegularFixedTelephoneEasy)
+	return reg.MatchString(mobileNum)
+}
+
 //判断文件是否存在
 func FileIsExist(filePath string) bool {
 	_, err := os.Stat(filePath)

+ 4 - 3
utils/constants.go

@@ -27,9 +27,10 @@ const (
 
 //手机号,电子邮箱正则
 const (
-	RegularMobile         = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0-9])|(17[0-9])|(16[0-9])|(19[0-9]))\\d{8}$" //手机号码
-	RegularFixedTelephone = "^(\\(\\d{3,4}\\)|\\d{3,4}-|\\s)?\\d{7,14}$"                                              //手机号码
-	RegularEmail          = `\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*`                                             //匹配电子邮箱
+	RegularMobile             = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0-9])|(17[0-9])|(16[0-9])|(19[0-9]))\\d{8}$" //手机号码
+	RegularFixedTelephone     = "^(\\(\\d{3,4}\\)|\\d{3,4}-|\\s)?\\d{7,14}$"                                              //手机号码
+	RegularFixedTelephoneEasy = "^[0-9\\-]+$"                                                                             //手机号码
+	RegularEmail              = `\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*`                                             //匹配电子邮箱
 )
 
 //聚合短信