mirror of
https://github.com/ProxyPanel/ProxyPanel.git
synced 2026-04-03 19:18:44 +00:00
- Update services and controllers for new node support; - Update relate views and language files; - Improve client config generation and node type handling;
34 lines
960 B
PHP
34 lines
960 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Jobs\Hysteria2\GetOnlineUser;
|
|
use App\Jobs\Hysteria2\GetTrafficStats;
|
|
use App\Models\Node;
|
|
use Illuminate\Console\Command;
|
|
use Log;
|
|
|
|
class SyncHysteria2Data extends Command
|
|
{
|
|
protected $signature = 'hysteria2:sync';
|
|
|
|
protected $description = '同步Hysteria2节点流量数据';
|
|
|
|
public function handle(): void
|
|
{
|
|
$jobTime = microtime(true);
|
|
$this->info('开始同步Hysteria2节点流量数据');
|
|
|
|
// 同步所有Hysteria2节点
|
|
$hysteria2Nodes = Node::where('type', 5)->where('status', 1)->get();
|
|
|
|
if ($hysteria2Nodes->isNotEmpty()) {
|
|
GetTrafficStats::dispatchSync($hysteria2Nodes);
|
|
GetOnlineUser::dispatchSync($hysteria2Nodes);
|
|
}
|
|
|
|
$jobTime = round(microtime(true) - $jobTime, 4);
|
|
Log::info(__('----「:job」Completed, Used :time seconds ----', ['job' => $this->description, 'time' => $jobTime]));
|
|
}
|
|
}
|