2022-08-30 23:36:26 +08:00
|
|
|
<?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()
|
|
|
|
|
{
|
2022-09-16 11:13:51 +08:00
|
|
|
$count = Log::query()->where('target_field', 'pdd.ktt.goods.query.list')
|
2022-08-30 23:36:26 +08:00
|
|
|
->where('created_at', '<', date('Y-m-d H:i:s', strtotime('-1 day')))
|
|
|
|
|
->delete();
|
|
|
|
|
$this->info('删除商品列表查询: ' . $count);
|
|
|
|
|
|
2022-09-16 11:13:51 +08:00
|
|
|
$count = Log::query()->where('target_field', 'pdd.ktt.order.list')
|
2022-08-30 23:36:26 +08:00
|
|
|
->where('created_at', '<', date('Y-m-d H:i:s', strtotime('-2 day')))
|
|
|
|
|
->delete();
|
|
|
|
|
$this->info('删除根据成交时间拉取订单列表: ' . $count);
|
|
|
|
|
|
2022-09-16 11:13:51 +08:00
|
|
|
$count = Log::query()->where('target_field', 'pdd.ktt.increment.order.query')
|
2022-08-30 23:36:26 +08:00
|
|
|
->where('created_at', '<', date('Y-m-d H:i:s', strtotime('-2 day')))
|
|
|
|
|
->delete();
|
|
|
|
|
$this->info('删除增量查订单: ' . $count);
|
|
|
|
|
|
2022-09-16 11:13:51 +08:00
|
|
|
$count = Log::query()->where('target_field', 'pdd.ktt.goods.incr.quantity')
|
2022-08-30 23:46:56 +08:00
|
|
|
->where('created_at', '<', date('Y-m-d H:i:s', strtotime('-2 day')))
|
|
|
|
|
->delete();
|
|
|
|
|
$this->info('删除快团团更新库存: ' . $count);
|
|
|
|
|
|
2022-09-16 11:13:51 +08:00
|
|
|
$count = Log::query()->where('target_field', '更新库存')
|
2022-08-30 23:36:26 +08:00
|
|
|
->where('created_at', '<', date('Y-m-d H:i:s', strtotime('-2 day')))
|
|
|
|
|
->delete();
|
|
|
|
|
$this->info('删除妙选更新库存: ' . $count);
|
|
|
|
|
}
|
|
|
|
|
}
|