2022-08-30 15:49:15 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
|
|
|
|
use App\Models\Shop;
|
|
|
|
|
use App\Services\Business\BusinessFactory;
|
|
|
|
|
use App\Utils\DateTimeUtils;
|
|
|
|
|
use Illuminate\Console\Command;
|
2024-08-06 13:53:22 +08:00
|
|
|
use Illuminate\Support\Facades\Log;
|
2022-08-30 15:49:15 +08:00
|
|
|
|
|
|
|
|
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
|
2023-05-19 21:19:49 +08:00
|
|
|
* @throws \Exception
|
2022-08-30 15:49:15 +08:00
|
|
|
*/
|
|
|
|
|
public function handle()
|
|
|
|
|
{
|
2022-10-25 10:47:36 +08:00
|
|
|
$shops = Shop::query()->where('plat_id', Shop::$PLAT_KTT)->where('status', Shop::$STATUS_AUTHORIZED)->get();
|
2022-08-30 15:49:15 +08:00
|
|
|
$endTime = DateTimeUtils::getMicroTime();
|
2023-04-06 14:01:52 +08:00
|
|
|
$beginTime = $endTime - 63000;
|
2022-08-30 15:49:15 +08:00
|
|
|
foreach ($shops as $shop) {
|
2023-04-04 19:06:15 +08:00
|
|
|
BusinessFactory::init()->make($shop->plat_id)->setShop($shop)->downloadOrdersAndSave($beginTime, $endTime + 3000);
|
2022-08-30 15:49:15 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|