|
@@ -460,6 +460,29 @@ class TestMemberCard extends TestCase
|
|
|
return 3;
|
|
|
}
|
|
|
}
|
|
|
+ public function testCheckMobileChannel(){
|
|
|
+ $mobile = 17801048874;
|
|
|
+ return $this->check_mobile_channel($mobile);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private function check_mobile_channel($mobile){
|
|
|
+ if(strlen($mobile) !== 11){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ $isChinaMobile = "/^134[0-8]\d{7}$|^(?:13[5-9]|147|15[0-27-9]|17[28]|18[2-478]19[578])\d{8}$/";
|
|
|
+ $isChinaUnicom = "/^(?:13[0-2]|145|15[56]|166|17[156]|18[56]|196)\d{8}$/";
|
|
|
+ $isChinaTelecom = "/^(?:133|149|153|177|173|18[019]|19[0139])\d{8}$/";
|
|
|
+ if(preg_match($isChinaMobile, $mobile)){
|
|
|
+ return 3;
|
|
|
+ }else if(preg_match($isChinaUnicom, $mobile)){
|
|
|
+ return 1;
|
|
|
+ }else if(preg_match($isChinaTelecom, $mobile)){
|
|
|
+ return 2;
|
|
|
+ }else{
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* @param $order
|