增加银行流水和定时任务程序
This commit is contained in:
@@ -50,12 +50,12 @@ async def create_task(
|
||||
):
|
||||
"""创建定时任务。"""
|
||||
name = (body.get("name") or "").strip()
|
||||
task_type = (body.get("task_type") or "").strip()
|
||||
task_type = (body.get("task_type") or "internal_method").strip()
|
||||
schedule = (body.get("schedule") or "").strip()
|
||||
if not name or not task_type or not schedule:
|
||||
raise HTTPException(status_code=400, detail="任务名称、类型、调度表达式不能为空")
|
||||
if task_type not in ("external_api", "internal_method"):
|
||||
raise HTTPException(status_code=400, detail="任务类型必须为 external_api 或 internal_method")
|
||||
if not name or not schedule:
|
||||
raise HTTPException(status_code=400, detail="任务名称、调度表达式不能为空")
|
||||
if task_type != "internal_method":
|
||||
raise HTTPException(status_code=400, detail="任务类型仅支持 internal_method")
|
||||
|
||||
config = body.get("config")
|
||||
if isinstance(config, dict):
|
||||
@@ -98,8 +98,8 @@ async def update_task(
|
||||
task.name = str(body["name"]).strip()
|
||||
if "task_type" in body:
|
||||
t = body["task_type"]
|
||||
if t not in ("external_api", "internal_method"):
|
||||
raise HTTPException(status_code=400, detail="任务类型必须为 external_api 或 internal_method")
|
||||
if t != "internal_method":
|
||||
raise HTTPException(status_code=400, detail="任务类型仅支持 internal_method")
|
||||
task.task_type = t
|
||||
if "schedule" in body:
|
||||
task.schedule = str(body["schedule"]).strip()
|
||||
|
||||
Reference in New Issue
Block a user