This commit is contained in:
ddrwode
2026-02-27 15:42:13 +08:00
parent 435bd2d81a
commit b7b7f17a25
2 changed files with 9 additions and 2 deletions

View File

@@ -65,7 +65,13 @@ def task_list(request):
ser.is_valid(raise_exception=True)
validated = ser.validated_data.copy()
account_id = validated.pop("id", None)
account_id = validated.pop("id", None) or validated.pop("account_id", None)
# form-data 可能把数字传成字符串
if account_id is not None:
try:
account_id = int(account_id)
except (TypeError, ValueError):
account_id = None
req = TaskCreate(**validated)
target_worker_id = req.worker_id or ""
account_name = req.account_name or ""