feat: add configurable verification and redemption codes
This commit is contained in:
58
docs/api.md
58
docs/api.md
@@ -576,8 +576,9 @@ Authorization: Bearer <token>
|
||||
"used_units": 120,
|
||||
"included_units": 10000,
|
||||
"bonus_units": 500,
|
||||
"total_units": 10500,
|
||||
"remaining_units": 10380
|
||||
"redeemed_units": 200,
|
||||
"total_units": 10700,
|
||||
"remaining_units": 10580
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -612,6 +613,23 @@ GET /billing/invoices?page=1&limit=20
|
||||
Authorization: Bearer <token>
|
||||
```
|
||||
|
||||
### 9.7 兑换套餐卡或次数卡
|
||||
```http
|
||||
POST /redemptions/redeem
|
||||
Authorization: Bearer <token>
|
||||
Content-Type: application/json
|
||||
|
||||
{ "code": "IMG-XXXX-XXXX-XXXX-XXXX" }
|
||||
```
|
||||
|
||||
### 9.8 获取自己的兑换记录
|
||||
```http
|
||||
GET /redemptions
|
||||
Authorization: Bearer <token>
|
||||
```
|
||||
|
||||
次数卡额度拥有独立有效期,扣减时优先使用更早到期的可用额度。套餐卡不会覆盖仍然有效的 Stripe 订阅。
|
||||
|
||||
---
|
||||
|
||||
## 10. Webhooks(支付回调)
|
||||
@@ -713,6 +731,42 @@ Authorization: Bearer <admin_token>
|
||||
|
||||
凭据加密保存且不通过 API 回传。测试接口执行 Bucket 检查、内部临时对象读写删和公网预签名下载;激活接口会再次测试并原子切换活动端点。活动端点不能直接编辑或删除。
|
||||
|
||||
### 11.7 兑换码管理
|
||||
|
||||
```http
|
||||
GET /admin/redemption-codes?page=1&limit=50
|
||||
Authorization: Bearer <admin_token>
|
||||
```
|
||||
|
||||
```http
|
||||
POST /admin/redemption-codes
|
||||
Authorization: Bearer <admin_token>
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"benefit_kind": "units",
|
||||
"units": 100,
|
||||
"duration_days": 30,
|
||||
"quantity": 10,
|
||||
"redeem_before": "2026-12-31T15:59:59Z",
|
||||
"note": "活动批次"
|
||||
}
|
||||
```
|
||||
|
||||
套餐卡使用 `benefit_kind: "plan"` 并传入 `plan_id`。完整兑换码只在创建响应中返回一次,数据库只保存 HMAC 哈希和脱敏标识。
|
||||
|
||||
```http
|
||||
PUT /admin/redemption-codes/{code_id}
|
||||
Authorization: Bearer <admin_token>
|
||||
Content-Type: application/json
|
||||
|
||||
{ "is_active": false }
|
||||
```
|
||||
|
||||
### 11.8 邮箱验证开关
|
||||
|
||||
`GET /admin/auth` 和 `PUT /admin/auth` 的配置体包含 `email_verification_required`。该配置独立于 SMTP,修改后立即生效,不需要重启服务。
|
||||
|
||||
---
|
||||
|
||||
## 12. WebSocket(网站任务进度)
|
||||
|
||||
Reference in New Issue
Block a user