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
16e120fa1f
commit
0d2060a635
61
app/Console/Commands/DeleteKttQuery.php
Normal file
61
app/Console/Commands/DeleteKttQuery.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Log;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class DeleteKttQuery extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'delete:ktt_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()
|
||||
{
|
||||
$count = Log::where('target_field', 'pdd.ktt.goods.query.list')
|
||||
->where('created_at', '<', date('Y-m-d H:i:s', strtotime('-1 day')))
|
||||
->delete();
|
||||
$this->info('删除商品列表查询: ' . $count);
|
||||
|
||||
$count = Log::where('target_field', 'pdd.ktt.order.list')
|
||||
->where('created_at', '<', date('Y-m-d H:i:s', strtotime('-2 day')))
|
||||
->delete();
|
||||
$this->info('删除根据成交时间拉取订单列表: ' . $count);
|
||||
|
||||
$count = Log::where('target_field', 'pdd.ktt.increment.order.query')
|
||||
->where('created_at', '<', date('Y-m-d H:i:s', strtotime('-2 day')))
|
||||
->delete();
|
||||
$this->info('删除增量查订单: ' . $count);
|
||||
|
||||
$count = Log::where('target_field', '更新库存')
|
||||
->where('created_at', '<', date('Y-m-d H:i:s', strtotime('-2 day')))
|
||||
->delete();
|
||||
$this->info('删除妙选更新库存: ' . $count);
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,7 @@ use App\Console\Commands\Inventory;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
use App\Console\Commands\KttOrderQuery;
|
||||
use App\Console\Commands\DeleteKttQuery;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
@ -21,7 +22,7 @@ class Kernel extends ConsoleKernel
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
@ -30,6 +31,7 @@ class Kernel extends ConsoleKernel
|
||||
// * * * * * cd /home/wwwroot/erp.staging.chutang66.com && php artisan schedule:run >> /dev/null 2>&1
|
||||
$schedule->command(Inventory::class)->dailyAt('07:00');
|
||||
$schedule->command(KttOrderQuery::class)->everyMinute();
|
||||
$schedule->command(DeleteKttQuery::class)->daily();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -39,7 +41,7 @@ class Kernel extends ConsoleKernel
|
||||
*/
|
||||
protected function commands()
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
$this->load(__DIR__ . '/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user