mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
feat: #10000 快团团订单获取优化
This commit is contained in:
parent
81e10c3a5a
commit
8f060c2da5
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user