diff --git a/backend/internal/api/handlers/agent_install.go b/backend/internal/api/handlers/agent_install.go index 99e902c..783a0c8 100644 --- a/backend/internal/api/handlers/agent_install.go +++ b/backend/internal/api/handlers/agent_install.go @@ -357,7 +357,7 @@ func (h *AgentInstallHandler) BatchUninstallAgent(c *gin.Context) { log.Printf("[BatchUninstall] 服务器 %d 不存在,跳过", id) continue } - if server.Username == "" || server.Password == "" { + if server.Username == "" || (server.Password == "" && server.SSHKey == "") { h.db.Model(&server).Updates(map[string]interface{}{"agent_status": "offline", "agent_version": ""}) log.Printf("[BatchUninstall] %s 无SSH凭据,已标记离线", server.Hostname) successCount++