using Fake.Application; using Oms.Domain.XhsAggregate.Consts; using Oms.Domain.XhsAggregate.Entities; namespace Oms.Application.Shared; /// /// Agent 远程控制动作 → 任务定义。 /// public static class XhsTaskFactory { public static XhsTask CreateControlTask(int customerId, int agentId, string action) { var (taskType, toolName, args) = action switch { XhsAgentControlActions.EngineStart => (XhsTaskTypeCodes.EngineStart, null, "{}"), XhsAgentControlActions.EngineStop => (XhsTaskTypeCodes.EngineStop, null, "{}"), XhsAgentControlActions.BrowserLogin => (XhsTaskTypeCodes.BrowserLogin, "browser_login", "{}"), XhsAgentControlActions.ClearCookies => (XhsTaskTypeCodes.ClearCookies, "delete_cookies", "{}"), XhsAgentControlActions.CheckLogin => (XhsTaskTypeCodes.CheckLogin, "check_login_status", "{}"), _ => throw new BusinessException($"未知控制动作: {action}") }; return new XhsTask { CustomerId = customerId, AgentId = agentId, TaskType = taskType, ToolName = toolName, ArgumentsJson = args, Source = XhsTaskSourceCodes.Web, Priority = 10, Status = XhsTaskStatusCodes.Pending }; } }