mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-12-01 22:50:44 +00:00
commit
fe27990a20
50
app/Console/Commands/KttOrderQuery.php
Normal file
50
app/Console/Commands/KttOrderQuery.php
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user