argument('action'); switch ($action) { case 'generate': $userId = $this->option('user-id'); if (!$userId) { $this->error('请使用 --user-id 指定URS用户ID'); return 1; } $result = $script->testGenerateCacheForUser((int)$userId); $this->info('测试完成'); break; case 'check': $result = $script->testCheckIntegrity(); $this->info('检查完成'); break; case 'batch': $users = $this->option('users'); if (!$users) { $this->error('请使用 --users 指定URS用户ID列表,用逗号分隔'); return 1; } $userIds = array_map('intval', explode(',', $users)); $result = $script->testBatchGenerate($userIds); $this->info('批量测试完成'); break; case 'clear': if ($this->confirm('确定要清理所有缓存数据吗?')) { $script->clearAllCache(); $this->info('清理完成'); } else { $this->info('操作已取消'); } break; case 'stats': $stats = $script->showCacheStats(); $this->info('统计完成'); break; default: $this->error('无效的动作,支持的动作: generate, check, batch, clear, stats'); return 1; } return 0; } }