浏览代码

U - 任务管理 禁止未设置触发器的任务启动

雷二猛 6 年之前
父节点
当前提交
976374b5c5
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      spug_api/apps/schedule/job.py

+ 2 - 0
spug_api/apps/schedule/job.py

@@ -91,6 +91,8 @@ def set_trigger(job_id):
 def switch(job_id):
     job = Job.query.get_or_404(job_id)
     if request.method == 'POST':
+        if job.trigger is None:
+            return json_response(message='请在 更多-设置触发器 中配置调度策略')
         job.update(enabled=True)
         scheduler.add_job(job)
     elif request.method == 'DELETE':