浏览代码

Merge branch 'fix_bug_2021-11-09-17-20' of hongze/hongze_cygx into master

hongze 3 年之前
父节点
当前提交
55f9fb82be
共有 3 个文件被更改,包括 11 次插入4 次删除
  1. 1 1
      controllers/user.go
  2. 6 0
      utils/common.go
  3. 4 3
      utils/constants.go

+ 1 - 1
controllers/user.go

@@ -1106,7 +1106,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+)*`                                             //匹配电子邮箱
 )
 
 //聚合短信