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);