Kaynağa Gözat

导入联系人校验手机号

hsun 1 yıl önce
ebeveyn
işleme
4b4664fccc
1 değiştirilmiş dosya ile 8 ekleme ve 1 silme
  1. 8 1
      controllers/company_user.go

+ 8 - 1
controllers/company_user.go

@@ -4033,7 +4033,7 @@ func (this *CompanyUserController) Import() {
 				}
 
 				//移除空格
-				mobileOne = utils.TrimStr(mobileOne)
+				mobileOne = strings.TrimSpace(mobileOne)
 				email = utils.TrimStr(email)
 
 				//这些字段都没有的话,系统认为excel到底了
@@ -4053,6 +4053,13 @@ func (this *CompanyUserController) Import() {
 					br.Msg = "导入数据中存在【国际区号】为空的联系人,请检查"
 					return
 				}
+				// 大陆区号校验手机号
+				if mobileOne != "" && (countryCode == "86" || countryCode == "086" || countryCode == "+86" || countryCode == "+086") {
+					if !utils.ValidateMobileFormatat(mobileOne) {
+						br.Msg = "导入数据中存在【大陆手机号】格式有误的联系人,请检查"
+						return
+					}
+				}
 
 				//如果手机号或者邮箱都没有填写的情况下
 				if mobileOne == "" && email == "" {