73b1696b0a
为节点新增 auto_online 字段与后台同步任务, 仅对开启托管的节点按在线状态自动同步前台显示。 管理端补齐单节点与批量开关、列表标识与统计, 并在自动上线启用时禁用手动显隐切换。 后端新增定时命令、保存校验、批量更新支持、 数据库迁移与单元测试,保证托管逻辑可落地。
30 lines
742 B
PHP
30 lines
742 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Services\ServerAutoOnlineService;
|
|
use Illuminate\Console\Command;
|
|
|
|
class SyncServerAutoOnline extends Command
|
|
{
|
|
protected $signature = 'sync:server-auto-online';
|
|
|
|
protected $description = 'Sync visible status for nodes with auto online enabled';
|
|
|
|
public function handle(ServerAutoOnlineService $service): int
|
|
{
|
|
$result = $service->sync();
|
|
|
|
$this->info(sprintf(
|
|
'Server auto online synced: total=%d updated=%d shown=%d hidden=%d unchanged=%d',
|
|
$result['total'],
|
|
$result['updated'],
|
|
$result['shown'],
|
|
$result['hidden'],
|
|
$result['unchanged']
|
|
));
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
}
|