stanley-king 11 months atrás
parent
commit
4fe6407dd9
2 changed files with 13 additions and 10 deletions
  1. 2 2
      helper/mtopcard/mtopcard.php
  2. 11 8
      test/TestCardNo.php

+ 2 - 2
helper/mtopcard/mtopcard.php

@@ -262,7 +262,7 @@ function simple_card_type($cardno)
         return SinopecCard;
     } elseif (preg_match('/^[79][0-9]{15}$/', $cardno, $matches)) {
         return PetroChinaCard;
-    } elseif (preg_match('/^134[0-8]\d{7}$|^(?:13[5-9]|15[012789]|17[28]|18[23478]|19[578])\d{8}$/', $cardno, $matches)) {
+    } elseif (preg_match('/^134[0-8]\d{7}$|^(?:13[5-9]|14[7]|15[012789]|17[28]|18[23478]|19[578])\d{8}$/', $cardno, $matches)) {
         return ChinaMobileCard;
     } elseif (preg_match('/^(?:13[0-2]|15[56]|166|17[156]|18[56]|196)\d{8}$/', $cardno, $matches)) {
         return ChinaUnicomCard;
@@ -289,7 +289,7 @@ function card_type($cardno,&$regin_no)
     elseif(preg_match('/^1\d{10}$/',$cardno,$matches))
     {
         $regin_no = -1;
-        if (preg_match('/^134[0-8]\d{7}$|^(?:13[5-9]|15[012789]|17[28]|18[23478]|19[578])\d{8}$/', $cardno, $matches)) {
+        if (preg_match('/^134[0-8]\d{7}$|^(?:13[5-9]|14[7]|15[012789]|17[28]|18[23478]|19[578])\d{8}$/', $cardno, $matches)) {
             return ChinaMobileCard;
         }
         elseif (preg_match('/^(?:13[0-2]|15[56]|166|17[156]|18[56]|196)\d{8}$/', $cardno, $matches)) {

+ 11 - 8
test/TestCardNo.php

@@ -23,11 +23,21 @@ class TestCardNo extends TestCase
 
     public function testQueryCardInfo()
     {
+        $query = new mtopcard\open_query();
+        [$succ,$ret] = $query->validate('14761582181');
+    }
+
+    public function testCardType()
+    {
+        $card_type = mtopcard\card_type(14761582181,$region);
+    }
+
+    public function testQueryCardInfos()
+    {
         for ($i = 0; $i < 2000; $i++) {
             $query = new mtopcard\open_query();
             [$succ,$ret] = $query->validate('13911129867');
             Log::record("$i succ=$succ",Log::DEBUG);
-//            sleep(1);
         }
 
         $x = 1 <=> 2;
@@ -96,13 +106,6 @@ class TestCardNo extends TestCase
         }
     }
 
-    public function testCardType()
-    {
-        $card_no = 15970039005;
-        $card_type = mtopcard\card_type($card_no,$region);
-
-    }
-
     public function testLoop_order()
     {
         $ins = Cache::getInstance('cacheredis');