hyapp-server/docs/flutter对接/任务系统Flutter对接.md
2026-06-11 13:33:44 +08:00

119 lines
2.9 KiB
Markdown

# 任务系统 Flutter 对接
## 获取任务页
地址:`GET /api/v1/tasks/tabs`
参数:无。需要登录态。
返回值:
```json
{
"sections": [
{
"section": "daily",
"server_time_ms": 1781097600000,
"next_refresh_at_ms": 1781136000000,
"items": [
{
"task_id": "task_xxx",
"task_type": "daily",
"category": "gift",
"audience_type": "all",
"metric_type": "gift_spend_coin",
"title": "普通礼物消耗金币",
"description": "",
"icon_key": "gift",
"icon_url": "",
"action_type": "gift_panel",
"action_param": "",
"action_payload": {},
"action_payload_json": "{}",
"dimension_filter_json": "{}",
"target_value": 10000,
"target_unit": "coin",
"progress_value": 1200,
"reward_coin_amount": 200,
"status": "in_progress",
"claimable": false,
"task_day": "2026-06-11",
"server_time_ms": 1781097600000,
"next_refresh_at_ms": 1781136000000,
"sort_order": 10,
"version": 1
}
]
},
{
"section": "exclusive",
"server_time_ms": 1781097600000,
"next_refresh_at_ms": 1781136000000,
"items": []
}
],
"server_time_ms": 1781097600000,
"next_refresh_at_ms": 1781136000000
}
```
说明:
- `section=daily` 是每日任务,按服务端 UTC 00:00 刷新。
- `section=exclusive` 是专属/新手任务,`task_day` 固定为 `lifetime`
- `claimable=true` 显示领取按钮。
- `status=claimed` 显示已领取。
- 其他状态显示去完成按钮,按 `action_type` 跳转。
## 领取任务奖励
地址:`POST /api/v1/tasks/claim`
参数:
```json
{
"task_id": "task_xxx",
"task_type": "daily",
"task_day": "2026-06-11",
"command_id": "app-generated-uuid"
}
```
返回值:
```json
{
"claim_id": "tclaim_xxx",
"task_id": "task_xxx",
"task_type": "daily",
"task_day": "2026-06-11",
"reward_coin_amount": 200,
"status": "granted",
"wallet_transaction_id": "wtx_xxx",
"granted_at_ms": 1781097600000,
"claimed": true
}
```
说明:
- `command_id` 由 App 每次点击领取时生成;同一次重试继续使用同一个 `command_id`
- 每日任务只能领取当天 `task_day`
- 专属任务领取时传列表里的 `task_day`,通常是 `lifetime`
## 跳转类型
| action_type | action_param |
| --- | --- |
| `none` | 不跳转 |
| `room_random` | 随机进入一个有人的房间;没有有人的房间时进入随机房间 |
| `room_random_game` | `game_id`,进入房间后打开指定游戏 |
| `wallet` | 打开钱包 |
| `gift_panel` | 进入房间后打开礼物面板 |
| `gift_panel_specific` | `gift_id`,进入房间后打开礼物面板并定位指定礼物 |
## 相关 IM
无。任务进度来自服务端事实事件,领取结果以接口返回和 `wallet_transaction_id` 为准。