18 lines
471 B
PHP
18 lines
471 B
PHP
<?php
|
|
namespace App\Console\Commands;
|
|
|
|
use Illuminate\Console\Command;
|
|
use App\Models\PullRecord;
|
|
use Carbon\Carbon;
|
|
|
|
class CleanPullRecordsCommand extends Command
|
|
{
|
|
protected $signature = 'orders:clean-records';
|
|
protected $description = '清理30天前的拉取记录';
|
|
|
|
public function handle()
|
|
{
|
|
$count = PullRecord::where('created_at', '<', Carbon::now()->subDays(30))->delete();
|
|
$this->info("已清理 {$count} 条旧记录");
|
|
}
|
|
} |