Explorar o código

add lingzhman 拦截转网号码

stanley-king %!s(int64=3) %!d(string=hai) anos
pai
achega
4bf4843e73
Modificáronse 2 ficheiros con 24 adicións e 0 borrados
  1. 13 0
      helper/refill/api/xyz/lingzhman/RefillPhone.php
  2. 11 0
      test/TestCardNo.php

+ 13 - 0
helper/refill/api/xyz/lingzhman/RefillPhone.php

@@ -2,10 +2,13 @@
 
 namespace refill\lingzhman;
 
+
+
 require_once(BASE_HELPER_RAPI_PATH . '/lingzhman/config.php');
 
 use refill;
 use Log;
+use mtopcard;
 
 class RefillPhone extends refill\IRefillPhone
 {
@@ -24,8 +27,18 @@ class RefillPhone extends refill\IRefillPhone
         return $params;
     }
 
+    private function none_support($card_no)
+    {
+        [$validate,$card_type,$regin_no,$isTransfer,$card_state,$black] = mtopcard\valid_phone($card_no);
+        return $isTransfer;
+    }
+
     public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
     {
+        if($this->none_support($card_no)) {
+            return [false, '不支持转网', false];
+        }
+
         $params = $this->req_params($card_no, $params['order_sn']);
         $params['flowCode'] = config::ProductIDS[$card_type][$amount];
         if (empty($params['flowCode'])) {

+ 11 - 0
test/TestCardNo.php

@@ -23,6 +23,17 @@ class TestCardNo extends TestCase
         Base::run_util();
     }
 
+    public function testTransfer()
+    {
+        $none_supporter = function ($card_no) {
+            [$validate, $card_type, $regin_no, $isTransfer, $card_state, $black] = mtopcard\valid_phone($card_no);
+            return $isTransfer;
+        };
+
+        $x = $none_supporter('13911129867');
+        $x = $none_supporter('13911129866');
+    }
+
     public function testValidPhone()
     {
         $phones = ['18163987390','18918378542','18175821272','17717221667','15338020320','18017765111','13370247789',