소스 검색

add balance

stanley-king 3 년 전
부모
커밋
5731d6f736
2개의 변경된 파일6개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 0
      helper/statistics/refill_balance.php
  2. 2 2
      test/TestRefillBalance.php

+ 4 - 0
helper/statistics/refill_balance.php

@@ -174,6 +174,10 @@ class refill_balance
 
         if($time_type == 'notify_time') {
             $order_start = $start - 3 * self::DaySecs;
+            if($order_start < 0) {
+                $order_start = 0;
+            }
+
             $cond["refill_order.notify_time&refill_order.notify_time"] = ['_multi' => true, ['egt', $start], ['lt', $end]];
             $cond["refill_order.order_time&refill_order.order_time"] = ['_multi' => true,   ['egt', $order_start], ['lt', $end]];
             $cond["vr_order.add_time&vr_order.add_time"] = ['_multi' => true,   ['egt', $order_start], ['lt', $end]];

+ 2 - 2
test/TestRefillBalance.php

@@ -3,7 +3,7 @@
 
 use PHPUnit\Framework\TestCase;
 
-define('APP_ID', 'test');
+define('APP_ID', 'balance');
 define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
 
 require_once(BASE_ROOT_PATH . '/global.php');
@@ -26,7 +26,7 @@ class TestRefillBalance extends TestCase
         $refill_balance->add_balance('system', 0, 0, strtotime('2021-12-01'),'order_time');
     }
 
-    //docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefillBalance::testInitBalance)( .*)?$/" --test-suffix TestRefillBalance.php /var/www/html/test
+    //docker-compose -d run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefillBalance::testInitBalance)( .*)?$/" --test-suffix TestRefillBalance.php /var/www/html/test
     public function testInitBalance()
     {
         $refill_balance = new statistics\refill_balance();