Browse Source

Merge branch 'oilsms' of 39.97.239.116:gyfl/xyzshop into oilsms

stanley-king 4 years ago
parent
commit
d5acde8379
2 changed files with 24 additions and 1 deletions
  1. 1 1
      helper/fcgi_server.php
  2. 23 0
      test/TestMemberCard.php

+ 1 - 1
helper/fcgi_server.php

@@ -106,7 +106,7 @@ class fcgi_server
                 Log::record("member_id=" . session_helper::memberid(),Log::DEBUG);
                 if(file_exists($file))
                 {
-                    $host = 'http://192.168.1.220:3333';
+                    $host = 'http://localhost:3333';
                     fcgi_header("Content-Type: text/html; charset=UTF-8");
                     fcgi_header("Access-Control-Allow-Credentials: true");
                     fcgi_header("Access-Control-Allow-Origin: {$host}");

+ 23 - 0
test/TestMemberCard.php

@@ -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