diff --git a/backend/app/services/task_service.py b/backend/app/services/task_service.py index 8da022c..c47c3a6 100644 --- a/backend/app/services/task_service.py +++ b/backend/app/services/task_service.py @@ -792,12 +792,16 @@ async def transfer_task( created_tasks: list[Task] = [] for task_name, assignee_id in real_branches: + # 🔧 动态推导 task_type:禁止分支任务转交被硬编码为 TRANSFER(否则 is_main 判定误升为主线) if is_fission: new_parent_task_id = task.id + new_task_type = "SPAWN" # 裂变产生新分支 elif is_child_task: new_parent_task_id = task.parent_task_id + new_task_type = task.task_type or "SPAWN" # 继承父任务的分支血统 else: new_parent_task_id = task.id + new_task_type = "TRANSFER" # 主干常规流转 new_task = Task( product_id=task.product_id, @@ -805,7 +809,7 @@ async def transfer_task( task_name=task_name, assignee_id=assignee_id, status=TASK_STATUS_PENDING, - task_type="TRANSFER", + task_type=new_task_type, # ← 使用动态推导的类型 notify_parent_on_complete=False, is_rework=False, remark=request.note or None,