ZHIWEI666 commited on
Commit
ab01d5b
·
verified ·
1 Parent(s): 878c2b6

Upload router_tasks.py

Browse files
Files changed (1) hide show
  1. 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("价格")