stanley-king 1 年之前
父节点
当前提交
0cef92c0f5
共有 1 个文件被更改,包括 32 次插入0 次删除
  1. 32 0
      test/TestCommand.php

+ 32 - 0
test/TestCommand.php

@@ -120,4 +120,36 @@ class TestCommand extends TestCase
     {
         QueueClient::push("QueryRefund", ['order_id' => 8987841]);
     }
+
+    public function testQueryAllRefund()
+    {
+        $mod = Model();
+
+        $start = 0;
+        $inter = 0;
+        while (true)
+        {
+            $cond = ['inner_status' => 0,
+                'order_state' => ORDER_STATE_SUCCESS,
+                'vr_order.order_id' => ['gt', $start],
+                'store_id' => 33
+            ];
+
+            $items = $mod->table('refill_order,vr_order')
+                ->field('refill_order.order_id')
+                ->where($cond)
+                ->join('inner')->on('refill_order.order_id=vr_order.order_id')
+                ->limit("$start,100")
+                ->select();
+            if(empty($items)) break;
+
+            $inter += 1;
+
+            foreach ($items as $item) {
+                $order_id = intval($item['order_id']);
+                $start = $order_id;
+                QueueClient::async_push("QueryRefund", ['order_id' => $order_id],$inter);
+            }
+        }
+    }
 }