stanley-king 1 年之前
父节点
当前提交
9c2b09a2aa
共有 3 个文件被更改,包括 45 次插入7 次删除
  1. 1 0
      helper/stat_helper.php
  2. 33 0
      helper/statistics/order_reader.php
  3. 11 7
      test/TestRefund.php

+ 1 - 0
helper/stat_helper.php

@@ -13,6 +13,7 @@ require_once (BASE_ROOT_PATH . '/helper/statistics/statorder.php');
 require_once (BASE_ROOT_PATH . '/helper/statistics/statcall.php');
 require_once (BASE_ROOT_PATH . '/helper/statistics/behavior.php');
 require_once (BASE_ROOT_PATH . '/helper/statistics/stat_refill.php');
+require_once (BASE_ROOT_PATH . '/helper/statistics/order_reader.php');
 require_once(BASE_ROOT_PATH . '/helper/brand_helper.php');
 require_once(BASE_ROOT_PATH . '/helper/category_helper.php');
 

+ 33 - 0
helper/statistics/order_reader.php

@@ -0,0 +1,33 @@
+<?php
+
+class order_reader
+{
+    public function refill_vr_reader($cond,$order='order_id asc')
+    {
+        $result = Model('')->table('refill_order,vr_order')
+            ->field('min(refill_order.order_id),max(vr_order.order_id')
+            ->join('inner')
+            ->on('refill_order.order_id=vr_order.order_id')
+            ->where($cond)
+            ->select();
+
+        while (true)
+        {
+            $items = Model('')->table('refill_order,vr_order')
+                ->field('*')
+                ->join('inner')
+                ->on('refill_order.order_id=vr_order.order_id')
+                ->where($cond)
+                ->select();
+
+            if(empty($items)) {
+                break;
+            }
+
+            foreach ($items as $item) {
+                yield $item;
+            }
+        }
+    }
+
+}

+ 11 - 7
test/TestRefund.php

@@ -163,13 +163,6 @@ class TestRefund extends TestCase
                 }
             }
         }
-
-
-
-//        $provider = $getProvider('by_online');
-//
-//        $order_sn = '0054340738786801278285';
-//        [$succ, $resp] = $provider->query(['order_sn' => $order_sn, 'official_sn' => '1123053062415685']);
     }
 
     private function getOrders()
@@ -195,4 +188,15 @@ class TestRefund extends TestCase
         $order_sn = '4208060738889205049790';
         [$succ, $resp] = $provider->query(['order_sn' => $order_sn, 'official_sn' => '1123053162488749']);
     }
+
+    public function testOrderReader()
+    {
+        $reader = new order_reader();
+        $cond['refill_order.order_time'] = [['egt', strtotime('2023-05-01')], ['lt', strtotime('2023-06-01')], 'and'];
+        $cond['vr_order.add_time'] = [['egt', strtotime('2023-05-01')], ['lt', strtotime('2023-06-03')], 'and'];
+        $cond['inner_status'] = 0;
+
+        $gen = $reader->refill_vr_reader($cond);
+
+    }
 }