!65 订单下载

Merge pull request !65 from develop
This commit is contained in:
赵世界 2022-08-24 10:10:32 +00:00 committed by Gitee
commit 450a252fc6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 25 additions and 10 deletions

View File

@ -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);
// }
}
}

View File

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