erp/app/Console/Commands/KttOrderQuery.php
2023-05-19 21:19:49 +08:00

52 lines
1.2 KiB
PHP

<?php
namespace App\Console\Commands;
use App\Models\Shop;
use App\Services\Business\BusinessFactory;
use App\Utils\DateTimeUtils;
use Illuminate\Console\Command;
class KttOrderQuery extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'ktt:order_query';
/**
* The console command description.
*
* @var string
*/
protected $description = '快团团根据成交时间拉取订单列表';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
* @throws \Exception
*/
public function handle()
{
$shops = Shop::query()->where('plat_id', Shop::$PLAT_KTT)->where('status', Shop::$STATUS_AUTHORIZED)->get();
$endTime = DateTimeUtils::getMicroTime();
$beginTime = $endTime - 63000;
foreach ($shops as $shop) {
BusinessFactory::init()->make($shop->plat_id)->setShop($shop)->downloadOrdersAndSave($beginTime, $endTime + 3000);
}
}
}