Pārlūkot izejas kodu

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

sunxbiao 8 mēneši atpakaļ
vecāks
revīzija
234e489ed1
1 mainītis faili ar 7 papildinājumiem un 3 dzēšanām
  1. 7 3
      app/controller/api/store/product/DaTaoKe.php

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

@@ -17,6 +17,7 @@ use app\utils\TimeUtil;
17 17
 use http\Exception;
18 18
 use think\facade\Db;
19 19
 use think\facade\Log;
20
+use think\Request;
20 21
 use function GuzzleHttp\Promise\iter_for;
21 22
 
22 23
 /**
@@ -216,7 +217,7 @@ class DaTaoKe
216 217
 
217 218
 
218 219
     //订单查询接口(20分钟一个时间段)
219
-    public function getOrder()
220
+    public function getOrder(Request $request)
220 221
     {
221 222
         // // 立即返回响应,断开客户端连接
222 223
         // header('Content-Length: 0');
@@ -238,6 +239,7 @@ class DaTaoKe
238 239
         // 从这里开始,客户端已经断开,脚本可以长时间运行
239 240
         ignore_user_abort(true); // 忽略用户中断
240 241
         set_time_limit(0); // 取消时间限制
242
+        $scene = $request->get('scene', 1);
241 243
 
242 244
         try {
243 245
             $url = 'https://openapi.dataoke.com/api/tb-service/get-order-details';
@@ -248,8 +250,10 @@ class DaTaoKe
248 250
             $orders = array_merge($orders, $recentOrders);
249 251
 
250 252
             // 场景2:分批次查询历史订单(避免时间范围过大) 平时只需要开场景1 场景二主要目的是 指定时间内(比如10天内) 有漏掉的订单,可以开启执行一次;注意执行一次后再给关闭,防止资源浪费
251
-            // $refundOrders = $this->queryOrdersByBatch($url);
252
-            // $orders = array_merge($orders, $refundOrders);
253
+            if ($scene == 2) {
254
+                $refundOrders = $this->queryOrdersByBatch($url);
255
+                $orders = array_merge($orders, $refundOrders);
256
+            }
253 257
 
254 258
             if ($orders) {
255 259
                 // 去重处理