feat: #10000 快团团订单获取优化

This commit is contained in:
赵世界 2023-04-04 19:06:15 +08:00
parent 81e10c3a5a
commit 8f060c2da5
5 changed files with 26 additions and 39 deletions

View File

@ -44,7 +44,7 @@ class KttOrderQuery extends Command
$endTime = DateTimeUtils::getMicroTime(); $endTime = DateTimeUtils::getMicroTime();
$beginTime = $endTime - 60000; $beginTime = $endTime - 60000;
foreach ($shops as $shop) { 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);
} }
} }
} }

View File

@ -40,6 +40,7 @@ class Swoole extends Command
* Execute the console command. * Execute the console command.
* *
* @return mixed * @return mixed
* @throws \Exception
*/ */
public function handle() public function handle()
{ {
@ -48,7 +49,7 @@ class Swoole extends Command
$endTime = DateTimeUtils::getMicroTime(); $endTime = DateTimeUtils::getMicroTime();
$beginTime = $endTime - 3000; $beginTime = $endTime - 3000;
foreach ($shops as $shop) { 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(); Event::wait();

View File

@ -4,6 +4,7 @@ namespace App\Console\Commands;
use App\Events\StockUpdateEvent; use App\Events\StockUpdateEvent;
use App\Models\BusinessGoodsSku; use App\Models\BusinessGoodsSku;
use App\Models\BusinessOrder;
use App\Models\GoodsSku; use App\Models\GoodsSku;
use App\Models\Log; use App\Models\Log;
use App\Models\Shop; use App\Models\Shop;
@ -46,45 +47,13 @@ class Test extends Command
*/ */
public function handle() public function handle()
{ {
$onSkuIds = [2823];
event(new StockUpdateEvent($onSkuIds));
exit();
$shop = Shop::query()->find(1); $shop = Shop::query()->find(1);
$business = BusinessFactory::init()->make($shop->plat_id); $business = BusinessFactory::init()->make($shop->plat_id);
$business->setShop($shop); $business->setShop($shop);
var_dump($business->queryGroupStatus()); $order = BusinessOrder::query()->where('shop_id', 1)->where('participate_no', 6436)->first();
exit(); // $res = $business->getOrderInfo($order->order_sn);
// 下架商品 $endTime = DateTimeUtils::getMicroTime();
// GoodsSku::query()->where('status', '<>', 0)->update(['status' => 0]); $beginTime = $endTime - 3000;
// $this->info('全部下架'); $res = $business->getOrderInfo($beginTime, $endTime + 3000);
// 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);
// }
} }
} }

View File

@ -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() protected function getAccessTokenWithCode()
{ {
$type = 'pdd.pop.auth.token.create'; $type = 'pdd.pop.auth.token.create';

View File

@ -47,5 +47,15 @@ class Order
return [$type, $appendParams]; return [$type, $appendParams];
} }
public static function getOrderInfo($orderSn)
{
$type = 'pdd.ktt.order.get';
$appendParams = [
'order_sn' => $orderSn,
];
return [$type, $appendParams];
}
} }