stanley-king 2 years ago
parent
commit
3e5308971f
3 changed files with 23 additions and 4 deletions
  1. 2 2
      helper/refill/RefillBase.php
  2. 14 1
      helper/refill/util.php
  3. 7 1
      test/refill/TestPartOptimization.php

+ 2 - 2
helper/refill/RefillBase.php

@@ -119,7 +119,7 @@ class RefillBase
     private function proc_notify($order_id, $success, $can_try, $chname, $input = [])
     private function proc_notify($order_id, $success, $can_try, $chname, $input = [])
     {
     {
         $mod_order = Model('vr_order');
         $mod_order = Model('vr_order');
-        $order_info = $mod_order->getOrderInfo(['order_id' => $order_id]);
+        $order_info = $mod_order->getOrderInfo(['order_id' => $order_id, 'add_time' => util::vr_order_part()]);
         $order_state = intval($order_info['order_state']);
         $order_state = intval($order_info['order_state']);
 
 
         if ($order_state == ORDER_STATE_PAY)
         if ($order_state == ORDER_STATE_PAY)
@@ -142,7 +142,7 @@ class RefillBase
         try
         try
         {
         {
             $tran = new trans_wapper($mod_order,'notify change order state trans');
             $tran = new trans_wapper($mod_order,'notify change order state trans');
-            $order_info = $mod_order->getOrderInfo(['order_id' => $order_id], '*', true, true);
+            $order_info = $mod_order->getOrderInfo(['order_id' => $order_id, 'add_time' => util::vr_order_part()], '*', true, true);
             $order_state = intval($order_info['order_state']);
             $order_state = intval($order_info['order_state']);
 
 
             if ($order_state != ORDER_STATE_SEND) {
             if ($order_state != ORDER_STATE_SEND) {

+ 14 - 1
helper/refill/util.php

@@ -735,7 +735,7 @@ class util
         }
         }
     }
     }
 
 
-    public function transfer_success_order($order_id, $manual_recharge_amount)
+    public static function transfer_success_order($order_id, $manual_recharge_amount)
     {
     {
         $mod_order = Model('vr_order');
         $mod_order = Model('vr_order');
         $mod_refill = Model('refill_order');
         $mod_refill = Model('refill_order');
@@ -784,4 +784,17 @@ class util
             return [false,"{$ex->getMessage()}"];
             return [false,"{$ex->getMessage()}"];
         }
         }
     }
     }
+
+    public static function vr_order_part()
+    {
+        $miner = function ($time) {
+            return strtotime(date('Y-m-d',$time)) - 86400 * 15;
+        };
+        $maxer = function ($time) {
+            return $time + 3600;
+        };
+        $now = time();
+
+        return [['egt', $miner($now)], ['elt', $maxer($now)], 'and'];
+    }
 }
 }

+ 7 - 1
test/refill/TestPartOptimization.php

@@ -12,6 +12,7 @@ define('BASE_ROOT_PATH', str_replace('/test/refill', '', dirname(__FILE__)));
 require_once(BASE_ROOT_PATH . '/global.php');
 require_once(BASE_ROOT_PATH . '/global.php');
 require_once(BASE_CORE_PATH . '/lrlz.php');
 require_once(BASE_CORE_PATH . '/lrlz.php');
 require_once(BASE_ROOT_PATH . '/fooder.php');
 require_once(BASE_ROOT_PATH . '/fooder.php');
+require_once(BASE_HELPER_PATH . '/refill/XYZRefillFactory.php');
 
 
 
 
 use PHPUnit\Framework\TestCase;
 use PHPUnit\Framework\TestCase;
@@ -20,6 +21,7 @@ class TestPartOptimization extends TestCase
     public static function setUpBeforeClass() : void
     public static function setUpBeforeClass() : void
     {
     {
         Base::run_util();
         Base::run_util();
+        refill\RefillFactory::instance();
     }
     }
 
 
     public function testDetailExist()
     public function testDetailExist()
@@ -28,5 +30,9 @@ class TestPartOptimization extends TestCase
         $ret = $refill_order->exist(10198, '10298620105', true);
         $ret = $refill_order->exist(10198, '10298620105', true);
     }
     }
 
 
-
+    public function testGetVrOrder()
+    {
+        $mod_order = Model('vr_order');
+        $order_info = $mod_order->getOrderInfo(['order_sn' => '3877620720404788469721','add_time' => refill\util::vr_order_part()]);
+    }
 }
 }