Files
ProxyPanel/app/Console/Commands/ServiceTimer.php
BrettonYe d9ff6ad6ee Improve System Blade
- Removed Task config, add those settings to System blade.
- Improve the font-end of system setting blade.
- Improve Payments files to be more  "Modularize"
2025-06-09 23:54:12 +08:00

32 lines
786 B
PHP

<?php
namespace App\Console\Commands;
use App\Models\Order;
use Illuminate\Console\Command;
use Log;
class ServiceTimer extends Command
{
protected $signature = 'serviceTimer';
protected $description = '服务计时器';
public function handle(): void
{
$jobTime = microtime(true);
$this->expiredPlan(); // 过期套餐
$jobTime = round(microtime(true) - $jobTime, 4);
Log::info(__('----「:job」Completed, Used :time seconds ----', ['job' => $this->description, 'time' => $jobTime]));
}
private function expiredPlan(): void
{
Order::activePlan()->where('expired_at', '<=', now())->chunk(sysConfig('tasks_chunk'), function ($orders) {
$orders->each->expired(); // 过期订单
});
}
}