diff --git a/app/Console/Commands/KttOrderQuery.php b/app/Console/Commands/KttOrderQuery.php index 9ca4f0a..753e095 100644 --- a/app/Console/Commands/KttOrderQuery.php +++ b/app/Console/Commands/KttOrderQuery.php @@ -44,7 +44,7 @@ class KttOrderQuery extends Command $endTime = DateTimeUtils::getMicroTime(); $beginTime = $endTime - 60000; foreach ($shops as $shop) { - BusinessFactory::init()->make($shop->plat_id)->setShop($shop)->downloadOrdersAndSave($beginTime, $endTime); + BusinessFactory::init()->make($shop->plat_id)->setShop($shop)->downloadOrdersAndSave($beginTime, $endTime + 3000); } } } diff --git a/app/Console/Commands/Swoole.php b/app/Console/Commands/Swoole.php index 3d51945..8a8b7a6 100644 --- a/app/Console/Commands/Swoole.php +++ b/app/Console/Commands/Swoole.php @@ -40,6 +40,7 @@ class Swoole extends Command * Execute the console command. * * @return mixed + * @throws \Exception */ public function handle() { @@ -48,7 +49,7 @@ class Swoole extends Command $endTime = DateTimeUtils::getMicroTime(); $beginTime = $endTime - 3000; foreach ($shops as $shop) { - BusinessFactory::init()->make($shop->plat_id)->setShop($shop)->downloadOrdersAndSave($beginTime, $endTime, 'increment'); + BusinessFactory::init()->make($shop->plat_id)->setShop($shop)->downloadOrdersAndSave($beginTime, $endTime + 3000, 'increment'); } }); Event::wait(); diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index 38da580..18db415 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -4,6 +4,7 @@ namespace App\Console\Commands; use App\Events\StockUpdateEvent; use App\Models\BusinessGoodsSku; +use App\Models\BusinessOrder; use App\Models\GoodsSku; use App\Models\Log; use App\Models\Shop; @@ -46,45 +47,13 @@ class Test extends Command */ public function handle() { - $onSkuIds = [2823]; - event(new StockUpdateEvent($onSkuIds)); - exit(); $shop = Shop::query()->find(1); $business = BusinessFactory::init()->make($shop->plat_id); $business->setShop($shop); - var_dump($business->queryGroupStatus()); - exit(); - // 下架商品 -// GoodsSku::query()->where('status', '<>', 0)->update(['status' => 0]); -// $this->info('全部下架'); -// exit(); - // 1-7 11 - $shop = Shop::query()->find(1); - $business = BusinessFactory::init()->make($shop->plat_id); - $business->setShop($shop); - // 下载商品列表 -// $business->downloadGoodsListAndBind(); - - // 下载单个商品 -// $business->downloadGoods(1); - - // 库存修改 -// $business->incrQuantity(1); - - // 订单下载 - $beginTime = DateTimeUtils::getMicroTime('2022-08-30 19:17:03'); - $endTime = DateTimeUtils::getMicroTime('2022-08-30 19:19:03'); - $business->downloadOrdersAndSave($beginTime, $endTime); - -// $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); -// } + $order = BusinessOrder::query()->where('shop_id', 1)->where('participate_no', 6436)->first(); +// $res = $business->getOrderInfo($order->order_sn); + $endTime = DateTimeUtils::getMicroTime(); + $beginTime = $endTime - 3000; + $res = $business->getOrderInfo($beginTime, $endTime + 3000); } } diff --git a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php index 2ccccdd..fed5d03 100644 --- a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php +++ b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php @@ -104,6 +104,13 @@ class KuaiTuanTuan extends BusinessClient } } + public function getOrderInfo($orderSn) + { + [$type, $appendParams] = Order::getOrderInfo($orderSn); + + return $this->doRequest($type, $appendParams); + } + protected function getAccessTokenWithCode() { $type = 'pdd.pop.auth.token.create'; diff --git a/app/Services/Business/KuaiTuanTuan/Order.php b/app/Services/Business/KuaiTuanTuan/Order.php index 6fcdbc5..125e8ec 100644 --- a/app/Services/Business/KuaiTuanTuan/Order.php +++ b/app/Services/Business/KuaiTuanTuan/Order.php @@ -47,5 +47,15 @@ class Order return [$type, $appendParams]; } + + public static function getOrderInfo($orderSn) + { + $type = 'pdd.ktt.order.get'; + $appendParams = [ + 'order_sn' => $orderSn, + ]; + + return [$type, $appendParams]; + } }