Explorar o código

第三方-淘宝客-更换接入应用

sunxbiao hai 8 meses
pai
achega
1df12d24f9
Modificáronse 1 ficheiros con 7 adicións e 7 borrados
  1. 7 7
      app/controller/api/store/product/DaTaoKe.php

+ 7 - 7
app/controller/api/store/product/DaTaoKe.php

@@ -244,12 +244,12 @@ class DaTaoKe
244 244
             $orders = [];
245 245
 
246 246
             // 场景1:实时同步最近20分钟内有更新的订单
247
-            // $recentOrders = $this->queryRecentOrders($url);
248
-            // $orders = array_merge($orders, $recentOrders);
247
+            $recentOrders = $this->queryRecentOrders($url);
248
+            $orders = array_merge($orders, $recentOrders);
249 249
 
250
-            // 场景2:分批次查询历史订单(避免时间范围过大)
251
-            $refundOrders = $this->queryOrdersByBatch($url);
252
-            $orders = array_merge($orders, $refundOrders);
250
+            // 场景2:分批次查询历史订单(避免时间范围过大) 平时只需要开场景1 场景二主要目的是 指定时间内(比如10天内) 有漏掉的订单,可以开启执行一次;注意执行一次后再给关闭,防止资源浪费
251
+            // $refundOrders = $this->queryOrdersByBatch($url);
252
+            // $orders = array_merge($orders, $refundOrders);
253 253
 
254 254
             if ($orders) {
255 255
                 // 去重处理
@@ -365,7 +365,7 @@ class DaTaoKe
365 365
 
366 366
         // 定义查询的时间段 大促期间 只能查20分钟的
367 367
         $batchIntervals = TimeUtil::generateTimeIntervals(
368
-            date("Y-m-d H:i:00", strtotime("-1 days")), // 开始时间:10天前
368
+            date("Y-m-d H:i:00", strtotime("-10 days")), // 开始时间:10天前
369 369
             date("Y-m-d H:i:00"),   // 结束时间 当前
370 370
             20
371 371
         );
@@ -375,7 +375,7 @@ class DaTaoKe
375 375
             $allRefundOrders = array_merge($allRefundOrders, $orders);
376 376
 
377 377
             // 添加延迟,避免请求过于频繁
378
-            // usleep(5000); // 0.5秒延迟
378
+            usleep(5000); // 注意 这是微妙
379 379
         }
380 380
 
381 381
         Log::info("分批查询退款订单完成". json_encode([