From c2375772cf982ff41ab46002c9d6f35a5b620e3c 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, 24 Aug 2022 18:09:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20#10000=20=E8=AE=A2=E5=8D=95=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/Test.php | 29 ++++++++++++++----- .../Business/KuaiTuanTuan/KuaiTuanTuan.php | 6 ++-- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index af4286c..348af78 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -2,6 +2,7 @@ namespace App\Console\Commands; +use App\Models\GoodsSku; use App\Models\Shop; use App\Services\Business\BusinessFactory; use App\Utils\DateTimeUtils; @@ -40,9 +41,14 @@ class Test extends Command */ public function handle() { - $shop = Shop::query()->find(2); - $business = BusinessFactory::init()->make($shop->plat_id); - $business->setShop($shop); + // 下架商品 +// GoodsSku::where('status', '<>', 0)->update(['status' => 0]); +// $this->info('全部下架'); +// exit(); + // 1-7 11 +// $shop = Shop::query()->find(11); +// $business = BusinessFactory::init()->make($shop->plat_id); +// $business->setShop($shop); // 下载商品列表 // $business->downloadGoodsListAndBind(); @@ -53,10 +59,19 @@ class Test extends Command // $business->incrQuantity(1); // 订单下载 - $beginTime = DateTimeUtils::getMicroTime('2022-08-22 18:16:18'); - $endTime = DateTimeUtils::getMicroTime('2022-08-22 18:16:20'); - $business->downloadOrdersAndSave($beginTime, $endTime); +// $beginTime = DateTimeUtils::getMicroTime('2022-08-23 00:00:00'); +// $endTime = DateTimeUtils::getMicroTime('2022-08-24 00:00:00'); +// $business->downloadOrdersAndSave($beginTime, $endTime); - $this->info('执行测试成功'); +// $shops = Shop::query()->where('status', 1)->get(); +// $that = $this; +// foreach ($shops as $shop) { +// $business = BusinessFactory::init()->make($shop->plat_id); +// $business->setShop($shop); +// $beginTime = DateTimeUtils::getMicroTime('2022-08-10 00:00:00'); +// $endTime = DateTimeUtils::getMicroTime('2022-08-11 00:00:00'); +// $business->downloadOrdersAndSave($beginTime, $endTime); +// $that->info($shop->name); +// } } } diff --git a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php index ab7ff27..8b11707 100644 --- a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php +++ b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php @@ -61,7 +61,7 @@ class KuaiTuanTuan extends BusinessClient } /** - * 下载没有发起售后,未取消的订单 + * 下载订单 * * @param $beginTime * @param $endTime @@ -81,8 +81,8 @@ class KuaiTuanTuan extends BusinessClient $res = $this->doRequest($type, $appendParams); $this->saveOrders($res[$responseName]['order_list']); $pageNum = ceil($res[$responseName]['total_count'] / $appendParams['page_size']); - if ($pageNum > $page && 10 >= $page) { - $this->downloadOrdersAndSave($beginTime, $endTime, $page + 1); + if ($pageNum > $page && 30 >= $page) { + $this->downloadOrdersAndSave($beginTime, $endTime, $downloadType, $page + 1); } }