From b8d626bbeae55330f06ae138c0a251d2380a75a7 Mon Sep 17 00:00:00 2001 From: Allen <934932687@qq.com> Date: Tue, 22 Oct 2019 16:28:19 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A016=E5=BC=80=E5=A4=B4?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E5=8F=B7=E9=AA=8C=E8=AF=81=EF=BC=8C162?= =?UTF-8?q?=E7=94=B5=E4=BF=A1=EF=BC=8C165=E7=A7=BB=E5=8A=A8=EF=BC=8C166/16?= =?UTF-8?q?7=E8=81=94=E9=80=9A=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- validation/validators.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validation/validators.go b/validation/validators.go index dc18b11e..4f166a68 100644 --- a/validation/validators.go +++ b/validation/validators.go @@ -632,7 +632,7 @@ func (b Base64) GetLimitValue() interface{} { } // just for chinese mobile phone number -var mobilePattern = regexp.MustCompile(`^((\+86)|(86))?(1(([35][0-9])|[8][0-9]|[7][01356789]|[4][579]))\d{8}$`) +var mobilePattern = regexp.MustCompile(`^((\+86)|(86))?(1(([35][0-9])|[8][0-9]|[7][01356789]|[6][2567]|[4][579]))\d{8}$`) // Mobile check struct type Mobile struct { From 241f10b4296af8dc4ccb984c253d7427166e84e5 Mon Sep 17 00:00:00 2001 From: Allen <934932687@qq.com> Date: Tue, 22 Oct 2019 16:58:05 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A016=E5=BC=80=E5=A4=B4?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E5=8F=B7=E9=AA=8C=E8=AF=81=EF=BC=8C162?= =?UTF-8?q?=E7=94=B5=E4=BF=A1=EF=BC=8C165=E7=A7=BB=E5=8A=A8=EF=BC=8C166/16?= =?UTF-8?q?7=E8=81=94=E9=80=9A=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- validation/validators.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validation/validators.go b/validation/validators.go index 4f166a68..ac00a72c 100644 --- a/validation/validators.go +++ b/validation/validators.go @@ -632,7 +632,7 @@ func (b Base64) GetLimitValue() interface{} { } // just for chinese mobile phone number -var mobilePattern = regexp.MustCompile(`^((\+86)|(86))?(1(([35][0-9])|[8][0-9]|[7][01356789]|[6][2567]|[4][579]))\d{8}$`) +var mobilePattern = regexp.MustCompile(`^((\+86)|(86))?(1(([35][0-9])|[8][0-9]|[7][01356789]|[4][579]|[6][2567]))\d{8}$`) // Mobile check struct type Mobile struct { From fb640f00755616438ba49be5a7844e1bc5a10ab4 Mon Sep 17 00:00:00 2001 From: Allen <934932687@qq.com> Date: Tue, 22 Oct 2019 17:07:22 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9B=B4=E6=96=B016=E5=BC=80=E5=A4=B4?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E5=8F=B7=E7=9A=84=E6=AD=A3=E5=88=99=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- validation/validation_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/validation/validation_test.go b/validation/validation_test.go index 3146766b..bae48d37 100644 --- a/validation/validation_test.go +++ b/validation/validation_test.go @@ -280,6 +280,18 @@ func TestMobile(t *testing.T) { if valid.Mobile("8617400008888", "mobile").Ok { t.Error("\"8617400008888\" is a valid mobile phone number should be false") } + if !valid.Mobile("16200008888", "mobile").Ok { + t.Error("\"16200008888\" is a valid mobile phone number should be true") + } + if !valid.Mobile("16500008888", "mobile").Ok { + t.Error("\"16500008888\" is a valid mobile phone number should be true") + } + if !valid.Mobile("16600008888", "mobile").Ok { + t.Error("\"16600008888\" is a valid mobile phone number should be true") + } + if !valid.Mobile("16700008888", "mobile").Ok { + t.Error("\"16700008888\" is a valid mobile phone number should be true") + } } func TestTel(t *testing.T) {