stanley-king 4 år sedan
förälder
incheckning
2ba81ea83d
1 ändrade filer med 30 tillägg och 0 borttagningar
  1. 30 0
      test/TestRedis.php

+ 30 - 0
test/TestRedis.php

@@ -1,6 +1,8 @@
 <?php declare(strict_types=0);
 
 use PHPUnit\Framework\TestCase;
+use statistics\stat_refill;
+
 define('APP_ID', 'test');
 define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
 require_once(BASE_ROOT_PATH . '/global.php');
@@ -245,7 +247,35 @@ class TestRedis extends TestCase
         }
     }
 
+    public function testCancelPayed()
+    {
+        $mod_refill = Model('refill_order');
+        $logic_vr_order = Logic("vr_order");
+
+        $cond = [
+            'refill_order.inner_status' => 0,
+            'vr_order.order_state' => ORDER_STATE_PAY,
+            'refill_order.order_time' => ['lt', time() - 300]
+        ];
+
+        $items = Model('')->table('refill_order,vr_order')
+            ->field('vr_order.order_state,vr_order.order_sn' )
+            ->join('inner')
+            ->on('refill_order.order_id=vr_order.order_id')
+            ->where($cond)
+            ->select();
+
+        foreach ($items as $item)
+        {
+            $order_sn = $item['order_sn'];
+            $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+            $logic_vr_order->changeOrderStateCancel($order_info, '', "充值失败");
+            $mod_refill->edit(['order_id' => $order_info['order_id']], ['commit_time' => time()]);
+        }
+    }
+
     ////docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRedis::testCancel)( .*)?$/" --test-suffix TestRedis.php /var/www/html/test
+    ////docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRedis::testCancelPayed)( .*)?$/" --test-suffix TestRedis.php /var/www/html/test
     public static function tearDownAfterClass() : void
     {