Files
shaguabijia-app-server/docs/api/tasks-list.md
T
OuYingJun1024 32d04d7008 fix(welfare): 消息提醒可重复领取并发重复发放修复 + review 清理
代码 review(本分支未提交 WIP)发现并修复:
- 高: enable_notification 可重复领取的发放是无锁读-算-写,并发/连点会算出同一序号
  双倍发钱。给 coin_transaction 加 (user_id,biz_type,ref_id) 部分唯一索引(仅 task_*),
  claim 撞唯一约束→IntegrityError 回滚兜底成 AlreadyClaimedError(409),不双发。
  配套 alembic 迁移 coin_txn_task_ref_uq(挂 head=drop_force_onboarding)。
- 中: 加领取封顶 rewards.notification_max_claims(减半到底=1 后不再可领),挡通知一直关着
  时无限刷 1 金币;列表领满后 claimed 置 True 供客户端隐藏。
- 中: _notification_grant_times 改只数 amount>0 流水,避免日后冲正/负向流水把次数算大。
- 低: 合并 ops_marquee._nickname 两个一字不差的重复分支。
- 文档: tasks-list / tasks-claim 补可重复领取/逐次减半/409 语义。
- 测试: 新增「领满到底→409 + claimed=True」用例;test_welfare 全绿(3 个 proxy 失败
  为 pre-existing httpx mock 问题,与本次无关)。

注: review 标的「do_signin 未归一化老 cycle_day」经验算为非 bug(x%LEN+1 对越界值
本就周期正确,且与 get_status 预览公式恒等),未改。

含本分支签到7天改制/任务文案/膨胀金币等 WIP。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 23:39:27 +08:00

26 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# GET /api/v1/tasks — 任务及领取状态
> 所属:Tasks 组(前缀 `/api/v1/tasks`,本接口 GET 前缀本身) | 鉴权:Bearer | [← 返回 API 索引](./README.md)
## 入参
无(用户由 token 确定)。
## 出参
响应 `200`:`TaskListOut` = `{ items: TaskOut[] }`
**TaskOut**
| 字段 | 类型 | 说明 |
|---|---|---|
| `task_key` | string | 任务标识,如 `enable_notification`(打开消息提醒) |
| `coin` | int | 下一次完成可得金币(可重复任务为减半后的当前档) |
| `claimed` | bool | 是否已领取(可重复任务恒 `false`,仅「减半到底领满」后置 `true` |
## 说明
福利页任务行的状态源。领取走 [tasks-claim](./tasks-claim.md)。
`enable_notification`(打开消息提醒)是**可重复领取**任务:每次开启通知发一次,金额逐次减半
750→375→188→…→1,`coin` 返回下一次的金额;客户端按「通知权限是否开启」决定展不展示
(开着就隐藏)。`claimed` 平时恒 `false`,减半到底(领满,约 11 次)后置 `true`,客户端据此隐藏。
其余为一次性任务,`claimed` 领过即 `true`