info('正在获取用户数量...'); $users = (new User)->count(); // $transactions = new Transaction(); // 获取今年的交易记录 (MongoDB) $startOfYear = now()->startOfYear(); $endOfYear = now()->endOfYear(); $this->info('正在获取交易记录...'); $transactions = (new Transaction)->where('type', 'payout')->whereBetween('created_at', [$startOfYear, $endOfYear])->count(); $this->info('正在获取主机数量...'); $hosts = (new Host)->count(); $this->info('正在获取部署中的主机数量...'); $pending_hosts = (new Host)->where('status', 'pending')->count(); $this->info('正在获取已停止的主机数量...'); $stopped_hosts = (new Host)->where('status', 'stopped')->count(); $this->info('正在获取部署失败的主机数量...'); $error_hosts = (new Host)->where('status', 'error')->count(); $this->info('正在获取激活的主机数量...'); $active_hosts = (new Host)->where('status', 'running')->count(); $this->info('正在获取暂停的主机数量...'); $suspended_hosts = (new Host)->whereNotNull('suspended_at')->count(); $this->info('正在获取工单数量...'); $workOrders = (new WorkOrder)->count(); $this->info('正在获取工单回复数量...'); $replies = (new Reply)->count(); $this->info('统计服务器...'); $servers = Cache::get('servers', []); $servers = count($servers); $this->info('完成。'); $this->warn('用户数量: '.$users); $this->warn('主机数量: '.$hosts); $this->warn('正在部署的主机数量: '.$pending_hosts); $this->warn('已停止的主机数量: '.$stopped_hosts); $this->warn('部署失败的主机数量: '.$error_hosts); $this->warn('正常的主机数量: '.$active_hosts); $this->warn('暂停的主机数量: '.$suspended_hosts); $this->warn('服务器数量: '.$servers); $this->warn('工单数量: '.$workOrders); $this->warn('工单回复数量: '.$replies); $this->warn('今年的交易记录: '.$transactions.' 条'); return 0; } }