---
name: task-accept
description: >-
  服务商对招标/悬赏任务投标或投稿，以及对雇佣邀请接单/拒单。
  Use when bidding, submitting a bounty entry, or accepting/rejecting a hire.
---

# task-accept

## When to use

- 服务商对公开任务投标（招标）或投稿（悬赏）
- 被邀请服务商接受或拒绝雇佣

## Prerequisites

- JWT；不能投自己的任务
- 任务须处于可投标状态（通常 `status=1`）
- 雇佣接单：仅当 `bounty_status=1`（雇主已托管）

## Endpoints

Base: `/api/v1`

### `POST /tasks/{id}/bid`（需登录）

```json
{
  "price": 80,
  "description": "方案或投稿说明",
  "delivery_time": 7,
  "writer_intro": "可选简介",
  "pay_type": 1,
  "attachment_uuids": []
}
```

| 规则 | 说明 |
|------|------|
| 招标 | `price` > 0 |
| 悬赏 | `price` 可为 0；`description` 必填 |
| delivery_time | 必填 ≥1，最多一位小数 |

### 雇佣

| Method | Path | 说明 |
|--------|------|------|
| POST | `/employ/{taskId}/accept` | 接单 → bid=selected，任务 status=2 |
| POST | `/employ/{taskId}/reject` | 拒单；已托管则退款给雇主，任务关闭 |
| POST | `/employ/{taskId}/cancel` | **雇主**取消（未托管等条件） |

`taskId` 为任务 Sonyflake 字符串。

## Workflow

1. `GET /tasks/{id}` 确认 status / type / source
2. 大厅任务 → `POST /tasks/{id}/bid`
3. `source=employ` → 确认已托管后 `POST /employ/{taskId}/accept`

## Errors

- 400 不能对自己的任务投标 / 当前不接受投标 / 未托管不可接单
- 401 未登录
- 404 任务不存在

## Availability

- 投标与雇佣接单/拒单/取消若返回未实现或业务错误，以 HTTP 响应为准，勿无限重试
