!77 增加每分钟获取成交订单

Merge pull request !77 from develop
This commit is contained in:
赵世界 2022-08-30 07:50:59 +00:00 committed by Gitee
commit fe27990a20
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,50 @@
<?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
*/
public function handle()
{
$shops = Shop::query()->where('plat_id', 1)->where('status', 1)->get();
$endTime = DateTimeUtils::getMicroTime();
$beginTime = $endTime - 60000;
foreach ($shops as $shop) {
BusinessFactory::init()->make($shop->plat_id)->setShop($shop)->downloadOrdersAndSave($beginTime, $endTime);
}
}
}

View File

@ -5,6 +5,7 @@ namespace App\Console;
use App\Console\Commands\Inventory; use App\Console\Commands\Inventory;
use Illuminate\Console\Scheduling\Schedule; use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use App\Console\Commands\KttOrderQuery;
class Kernel extends ConsoleKernel class Kernel extends ConsoleKernel
{ {
@ -28,6 +29,7 @@ class Kernel extends ConsoleKernel
// 服务器添加cron入口 // 服务器添加cron入口
// * * * * * cd /home/wwwroot/erp.staging.chutang66.com && php artisan schedule:run >> /dev/null 2>&1 // * * * * * cd /home/wwwroot/erp.staging.chutang66.com && php artisan schedule:run >> /dev/null 2>&1
$schedule->command(Inventory::class)->dailyAt('07:00'); $schedule->command(Inventory::class)->dailyAt('07:00');
$schedule->command(KttOrderQuery::class)->everyMinute();
} }
/** /**