Spaces:
Running
Running
Upload router_tasks.py
Browse files- router_tasks.py +3 -0
router_tasks.py
CHANGED
|
@@ -379,6 +379,9 @@ async def update_task(task_id: str, update_data: TaskUpdate, current_user: str =
|
|
| 379 |
# 价格和订金只能在open状态修改
|
| 380 |
if status == "open":
|
| 381 |
if update_data.totalPrice is not None:
|
|
|
|
|
|
|
|
|
|
| 382 |
task["total_price"] = update_data.totalPrice
|
| 383 |
task["deposit_amount"] = int(update_data.totalPrice * task["deposit_ratio"] / 100)
|
| 384 |
changes.append("价格")
|
|
|
|
| 379 |
# 价格和订金只能在open状态修改
|
| 380 |
if status == "open":
|
| 381 |
if update_data.totalPrice is not None:
|
| 382 |
+
# 验证价格
|
| 383 |
+
if update_data.totalPrice < 0:
|
| 384 |
+
raise HTTPException(status_code=400, detail="任务价格不能低于0积分")
|
| 385 |
task["total_price"] = update_data.totalPrice
|
| 386 |
task["deposit_amount"] = int(update_data.totalPrice * task["deposit_ratio"] / 100)
|
| 387 |
changes.append("价格")
|