package service import ( "context" "errors" "sea-vhost/internal/isolation" "sea-vhost/internal/panel" "sea-vhost/internal/schedulerbridge" "sea-vhost/internal/scope" ) func (s *Projects) ConfigureSystemScheduler(ctx context.Context, v schedulerbridge.Config) error { if e := v.Validate(); e != nil { return e } node, e := s.store.Node(ctx, v.NodeID) if e != nil || !node.Enabled { return errors.New("节点不可用") } ctx = scope.WithNode(ctx, v.NodeID) agent, ok := s.isolation.(isolation.SchedulerBridge) if !ok { return errors.New("节点未支持调度触发器") } native, ok := s.panel.(panel.SystemScheduler) if !ok { return errors.New("宝塔代理未支持系统计划任务") } if e = agent.ConfigureSchedulerBridge(ctx, v); e != nil { return e } _, e = native.EnsureSystemScheduler(ctx) return e }