Browse Source

add to lcoal

stanley-king 4 years ago
parent
commit
fb63270a9d
3 changed files with 37 additions and 21 deletions
  1. 4 2
      data/config/prod/refill.ini.php
  2. 5 5
      helper/refill/RefillFactory.php
  3. 28 14
      test/TestRefill.php

+ 4 - 2
data/config/prod/refill.ini.php

@@ -26,12 +26,14 @@ $bxtwt_phone = ['name' => 'bxtwt', 'store_id' => 10, 'card_type' => ['chinamobil
 
 
 $bjb_phone = ['name' => 'bjb', 'store_id' => 12, 'card_type' => ['chinaunicom', 'chinatelecom'],
-    'amount' => [30 => ['goods_id' => 6301, 'price' => 28.65],
+    'amount' => [10 => ['goods_id' => 6305, 'price' => 9.55],
+        20 => ['goods_id' => 6306, 'price' => 19.1],
+        30 => ['goods_id' => 6301, 'price' => 28.65],
         50 => ['goods_id' => 6302, 'price' => 47.75],
         100 => ['goods_id' => 6303, 'price' => 95.5],
         200 => ['goods_id' => 6304, 'price' => 191]],
     'refill_type' => 'api'];
 
 
-$phone_providers = ['beixt' => $beixt_phone, 'bxtwt' => $bxtwt_phone]; //'bjb' => $bjb_phone
+$phone_providers = ['beixt' => $beixt_phone, 'bxtwt' => $bxtwt_phone, 'bjb' => $bjb_phone];
 $config['phone_providers'] = $phone_providers;

+ 5 - 5
helper/refill/RefillFactory.php

@@ -263,13 +263,13 @@ class RefillFactory
                 return false;
             }
 
-            $times = intval($refill['commit_times']);
-            if ($times > 5) {
-                return false;
-            }
+//            $times = intval($refill['commit_times']);
+//            if ($times > 5) {
+//                return false;
+//            }
 
             $period = time() - $refill['order_time'];
-            if($period >= 600) {
+            if($period >= 10 * 60) {
                 return false;
             }
 

+ 28 - 14
test/TestRefill.php

@@ -17,7 +17,7 @@ require_once(BASE_HELPER_PATH . '/mtopcard/mtopcard.php');
 const LocalTest = 1;
 const NetTest = 2;
 
-const CurrentTest = LocalTest;
+const CurrentTest = NetTest;
 
 class TestRefill extends TestCase
 {
@@ -54,9 +54,12 @@ class TestRefill extends TestCase
     public function testBJBAddPhone()
     {
         $providers = new refill\bjb\RefillPhone([]);
-        for ($i = 15; $i > 0; --$i)
-        {
-            $resp = $providers->add(18500608333,4,30,['order_sn' => $this->make_sn()]);
+        for ($i = 3; $i > 0; --$i) {
+            $resp = $providers->add(13911129867,4,10,['order_sn' => $this->make_sn()]);
+            $resp = $providers->add(18500608333,4,10,['order_sn' => $this->make_sn()]);
+            $resp = $providers->add(18510683168,4,10,['order_sn' => $this->make_sn()]);
+            $resp = $providers->add(18513846008,4,10,['order_sn' => $this->make_sn()]);
+            $resp = $providers->add(18518237398,4,10,['order_sn' => $this->make_sn()]);
         }
     }
 
@@ -165,17 +168,28 @@ class TestRefill extends TestCase
 
     public function testAddPhoe()
     {
-        $url = $this->mReqHost . "/mobile/index.php";
-        $params = ['mchid' => 1,
-            'cardno' => '15120035568',
-            'amount' => "50",
-            "act"=>"refill",
-            "op"=>"add",
-            'order_sn' => "13281475",
-            'notifyurl'=> $this->mReqHost . "/mobile/beixt_notify.php"];
+        $phones = [13911129867,
+            18500608333,
+            18510683168,
+            18513846008,
+            18518237398];
 
-        $resp = $this->send_md5($url,$params);
-        Log::record($resp,Log::DEBUG);
+        for ($i = 0; $i < 3; $i++)
+        {
+            foreach ($phones as $phone) {
+                $url = $this->mReqHost . "/mobile/index.php";
+                $params = ['mchid' => 1,
+                    'cardno' => '15120035568',
+                    'amount' => "50",
+                    "act"=>"refill",
+                    "op"=>"add",
+                    'order_sn' => "13281475",
+                    'notifyurl'=> $this->mReqHost . "/mobile/beixt_notify.php"];
+
+                $resp = $this->send_md5($url,$params);
+                Log::record($resp,Log::DEBUG);
+            }
+        }
     }
 
     public function testGoods()