Sfoglia il codice sorgente

test refilstat reload and stat reload del_timeount 3600

xiaoyu 3 anni fa
parent
commit
f770ab6b21
2 ha cambiato i file con 49 aggiunte e 31 eliminazioni
  1. 1 1
      admin/control/merchant.php
  2. 48 30
      test/TestRefillStats.php

+ 1 - 1
admin/control/merchant.php

@@ -1060,7 +1060,7 @@ class merchantControl extends SystemControl
         ];
         $manager = new task\manager();
 
-        $task = $manager->add_task('order_stat_reload',$cond,0,600);
+        $task = $manager->add_task('order_stat_reload',$cond,0,3600);
         if ($task->completed() && $task->success()) {
             showMessage('操作成功');
         } else {

+ 48 - 30
test/TestRefillStats.php

@@ -1,30 +1,48 @@
-<?php
-
-
-use PHPUnit\Framework\TestCase;
-
-define('APP_ID', 'test');
-define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
-
-require_once(BASE_ROOT_PATH . '/global.php');
-require_once(BASE_CORE_PATH . '/lrlz.php');
-require_once(BASE_ROOT_PATH . '/fooder.php');
-
-require_once(BASE_HELPER_PATH . '/stat_helper.php');
-
-class TestRefillStats extends TestCase
-{
-    public static function setUpBeforeClass(): void
-    {
-        Base::run_util();
-    }
-
-    public function  testLatestDay()
-    {
-        $refill = new statistics\stat_refill();
-        $refill->run();
-    }
-}
-
-//docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefillStats::testLatestDay)( .*)?$/" --test-suffix TestRefillStats.php /var/www/html/test
-
+<?php
+
+
+use PHPUnit\Framework\TestCase;
+
+define('APP_ID', 'test');
+define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
+
+require_once(BASE_ROOT_PATH . '/global.php');
+require_once(BASE_CORE_PATH . '/lrlz.php');
+require_once(BASE_ROOT_PATH . '/fooder.php');
+
+require_once(BASE_HELPER_PATH . '/stat_helper.php');
+
+class TestRefillStats extends TestCase
+{
+    public static function setUpBeforeClass(): void
+    {
+        Base::run_util();
+    }
+
+    public function  testLatestDay()
+    {
+        $refill = new statistics\stat_refill();
+        $refill->run();
+    }
+
+    public function testReload()
+    {
+        $refill = new statistics\stat_refill();
+        $task_id = 8;
+        $mod_task = Model('task');
+        $item = $mod_task->where(['task_id' => $task_id])->find();
+        $condition = unserialize($item['params']);
+        $type = $condition['type'];
+        $time_stamp = $condition['time_stamp'];
+        $cid = $condition['cid'];
+        $order_time_type = $condition['order_time_type'];
+        if ($type == 'merchant') {
+            $refill->merchant_stat($time_stamp, $cid, $order_time_type);
+        } elseif ($type == 'provider') {
+            $refill->provider_stat($time_stamp, $cid, $order_time_type);
+        }
+    }
+}
+
+//docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefillStats::testLatestDay)( .*)?$/" --test-suffix TestRefillStats.php /var/www/html/test
+