From c4ce86cf1081b3dd52fc05e66786eaf1875fd6f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Wed, 14 Sep 2022 13:49:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20#09090=20=E4=BC=98=E5=8C=96=E5=BF=AB?= =?UTF-8?q?=E5=9B=A2=E5=9B=A2=E5=95=86=E5=93=81=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/Test.php | 1 + .../Business/KuaiTuanTuan/KuaiTuanTuan.php | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index cc41613..f10167b 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -3,6 +3,7 @@ namespace App\Console\Commands; use App\Models\GoodsSku; +use App\Models\Log; use App\Models\Shop; use App\Services\Business\BusinessFactory; use App\Utils\DateTimeUtils; diff --git a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php index 034f86d..40c3675 100644 --- a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php +++ b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php @@ -5,7 +5,8 @@ namespace App\Services\Business\KuaiTuanTuan; use App\Models\BusinessGoodsSku; use App\Models\GoodsSku; use App\Services\Business\BusinessClient; -use Illuminate\Support\Facades\Log; +use App\Models\Log; +use App\Utils\DateTimeUtils; class KuaiTuanTuan extends BusinessClient { @@ -41,6 +42,18 @@ class KuaiTuanTuan extends BusinessClient public function downloadGoodsListAndBind($page = 1) { [$type, $appendParams] = Goods::downloadGoods($this->shop->owner_id, $page); + $log = Log::query() + ->where('target_field', 'pdd.ktt.goods.query.list') + ->where('target_id', $this->shop->id) + ->orderBy('id', 'desc') + ->first(); + if ($log) { + $lastGetTime = DateTimeUtils::getMicroTime($log->created_at); + // 毫秒时间戳,往前算3分钟 + $startTime = $lastGetTime - 30000; + $appendParams['update_time_start'] = $startTime; + $appendParams['update_time_end'] = DateTimeUtils::getMicroTime(); + } $res = $this->doRequest($type, $appendParams); $goods = $res['ktt_goods_query_list_response']['goods_list']; $this->bindGoods($goods);