refactor(utils): 修复密码哈希比较逻辑错误 feat(user): 新增按状态筛选优惠券接口 docs: 添加虚拟发货与任务中心相关文档 fix(wechat): 修正Code2Session上下文传递问题 test: 补充订单折扣与积分转换测试用例 build: 更新配置文件与构建脚本 style: 清理多余的空行与注释
52 lines
1.4 KiB
Markdown
52 lines
1.4 KiB
Markdown
# 接口文档:任务中心
|
|
|
|
## 管理端 `/api/admin/task-center`
|
|
- `POST /tasks` 创建任务
|
|
- `GET /tasks` 任务列表
|
|
- `GET /tasks/:id` 任务详情
|
|
- `PUT /tasks/:id` 修改任务
|
|
- `DELETE /tasks/:id` 删除任务
|
|
- `POST /tasks/:id/tiers` 批量创建/更新档位
|
|
- `GET /tasks/:id/tiers` 档位列表
|
|
- `POST /tasks/:id/rewards` 批量创建/更新奖励映射
|
|
- `GET /tasks/:id/rewards` 奖励列表
|
|
- `GET /tasks/:id/progress` 进度概览与发放统计
|
|
- `POST /events/order-paid` 模拟订单支付事件
|
|
- `POST /events/invite-success` 模拟邀请达成事件
|
|
|
|
## APP端 `/api/app/task-center`
|
|
- `GET /tasks` 任务列表与规则说明
|
|
- `GET /tasks/:id/progress` 我的进度与已领奖档位
|
|
- `POST /tasks/:id/claim` 手动领取(如启用),发奖走幂等
|
|
- `GET /rewards` 我的奖励中心(可复用现有接口)
|
|
|
|
## 请求/响应示例
|
|
- `GET /tasks` 响应:
|
|
```json
|
|
{
|
|
"tasks": [
|
|
{"id":1,"name":"首日下单","status":1,"start_time":"...","end_time":"..."},
|
|
{"id":2,"name":"完成N单阶梯","status":1}
|
|
]
|
|
}
|
|
```
|
|
- `GET /tasks/:id/progress` 响应:
|
|
```json
|
|
{
|
|
"task_id":2,
|
|
"metrics":{"order_count":3,"invite_count":0,"first_order":true},
|
|
"claimed_tiers":[1],
|
|
"next_tier":{"threshold":5}
|
|
}
|
|
```
|
|
|
|
管理端事件模拟:
|
|
- `POST /events/order-paid`
|
|
```json
|
|
{"user_id":1001,"order_id":90001}
|
|
```
|
|
- `POST /events/invite-success`
|
|
```json
|
|
{"inviter_id":1001,"invitee_id":2002}
|
|
```
|