308 lines
5.6 KiB
Markdown
308 lines
5.6 KiB
Markdown
# UserPlanService
|
||
> 用户购买的套餐管理服务
|
||
|
||
---
|
||
|
||
## buyUserPlan
|
||
> 购买套餐
|
||
|
||
- 角色:`admin`, `user`
|
||
- HTTP:`POST https://backend.dooki.cloud/UserPlanService/buyUserPlan`
|
||
- RPC:`rpc buyUserPlan(BuyUserPlanRequest) returns (BuyUserPlanResponse);`
|
||
|
||
**请求对象 (`BuyUserPlanRequest`)**
|
||
|
||
```json
|
||
{
|
||
"userId": "int64 // 用户ID",
|
||
"planId": "int64",
|
||
"dayTo": "string",
|
||
"period": "string",
|
||
"countPeriod": "int32",
|
||
"name": "string // 名称"
|
||
}
|
||
```
|
||
|
||
**响应对象 (`BuyUserPlanResponse`)**
|
||
|
||
```json
|
||
{
|
||
"userPlanId": "int64"
|
||
}
|
||
```
|
||
|
||
**调用示例**
|
||
|
||
```bash
|
||
curl -X POST "https://backend.dooki.cloud/UserPlanService/buyUserPlan" \
|
||
-H "Content-Type: application/json" \
|
||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||
-d '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|
||
|
||
## countAllEnabledUserPlans
|
||
> 计算已购套餐数
|
||
|
||
- 角色:`admin`, `user`
|
||
- HTTP:`POST https://backend.dooki.cloud/UserPlanService/countAllEnabledUserPlans`
|
||
- RPC:`rpc countAllEnabledUserPlans(CountAllEnabledUserPlansRequest) returns (RPCCountResponse);`
|
||
|
||
**请求对象 (`CountAllEnabledUserPlansRequest`)**
|
||
|
||
```json
|
||
{
|
||
"isAvailable": "bool",
|
||
"isExpired": "bool",
|
||
"expiringDays": "int32",
|
||
"userId": "int64 // 用户ID"
|
||
}
|
||
```
|
||
|
||
**响应对象 (`RPCCountResponse`)**
|
||
|
||
```json
|
||
{
|
||
"count": "int64 // 数量"
|
||
}
|
||
```
|
||
|
||
**调用示例**
|
||
|
||
```bash
|
||
curl -X POST "https://backend.dooki.cloud/UserPlanService/countAllEnabledUserPlans" \
|
||
-H "Content-Type: application/json" \
|
||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||
-d '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|
||
|
||
## deleteUserPlan
|
||
> 删除已购套餐
|
||
|
||
- 角色:`admin`, `user`
|
||
- HTTP:`POST https://backend.dooki.cloud/UserPlanService/deleteUserPlan`
|
||
- RPC:`rpc deleteUserPlan(DeleteUserPlanRequest) returns (RPCSuccess);`
|
||
|
||
**请求对象 (`DeleteUserPlanRequest`)**
|
||
|
||
```json
|
||
{
|
||
"userPlanId": "int64"
|
||
}
|
||
```
|
||
|
||
**响应对象 (`RPCSuccess`)**
|
||
|
||
```json
|
||
{}
|
||
```
|
||
|
||
**调用示例**
|
||
|
||
```bash
|
||
curl -X POST "https://backend.dooki.cloud/UserPlanService/deleteUserPlan" \
|
||
-H "Content-Type: application/json" \
|
||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||
-d '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|
||
|
||
## findAllEnabledUserPlansForServer
|
||
> 查找所有服务可用的套餐
|
||
|
||
- 角色:`admin`, `user`
|
||
- HTTP:`POST https://backend.dooki.cloud/UserPlanService/findAllEnabledUserPlansForServer`
|
||
- RPC:`rpc findAllEnabledUserPlansForServer(FindAllEnabledUserPlansForServerRequest) returns (FindAllEnabledUserPlansForServerResponse);`
|
||
|
||
**请求对象 (`FindAllEnabledUserPlansForServerRequest`)**
|
||
|
||
```json
|
||
{
|
||
"userId": "int64 // 用户ID",
|
||
"serverId": "int64 // 服务ID(网站ID)"
|
||
}
|
||
```
|
||
|
||
**响应对象 (`FindAllEnabledUserPlansForServerResponse`)**
|
||
|
||
```json
|
||
{
|
||
"userPlans": "[]UserPlan"
|
||
}
|
||
```
|
||
|
||
**调用示例**
|
||
|
||
```bash
|
||
curl -X POST "https://backend.dooki.cloud/UserPlanService/findAllEnabledUserPlansForServer" \
|
||
-H "Content-Type: application/json" \
|
||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||
-d '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|
||
|
||
## findEnabledUserPlan
|
||
> 查找单个已购套餐信息
|
||
|
||
- 角色:`admin`, `user`
|
||
- HTTP:`POST https://backend.dooki.cloud/UserPlanService/findEnabledUserPlan`
|
||
- RPC:`rpc findEnabledUserPlan(FindEnabledUserPlanRequest) returns (FindEnabledUserPlanResponse);`
|
||
|
||
**请求对象 (`FindEnabledUserPlanRequest`)**
|
||
|
||
```json
|
||
{
|
||
"userPlanId": "int64"
|
||
}
|
||
```
|
||
|
||
**响应对象 (`FindEnabledUserPlanResponse`)**
|
||
|
||
```json
|
||
{
|
||
"userPlan": "UserPlan"
|
||
}
|
||
```
|
||
|
||
**调用示例**
|
||
|
||
```bash
|
||
curl -X POST "https://backend.dooki.cloud/UserPlanService/findEnabledUserPlan" \
|
||
-H "Content-Type: application/json" \
|
||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||
-d '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|
||
|
||
## listEnabledUserPlans
|
||
> 列出单页已购套餐
|
||
|
||
- 角色:`admin`, `user`
|
||
- HTTP:`POST https://backend.dooki.cloud/UserPlanService/listEnabledUserPlans`
|
||
- RPC:`rpc listEnabledUserPlans(ListEnabledUserPlansRequest) returns (ListEnabledUserPlansResponse);`
|
||
|
||
**请求对象 (`ListEnabledUserPlansRequest`)**
|
||
|
||
```json
|
||
{
|
||
"isAvailable": "bool",
|
||
"isExpired": "bool",
|
||
"expiringDays": "int32",
|
||
"userId": "int64 // 用户ID",
|
||
"offset": "int64 // 读取位置",
|
||
"size": "int64 // 数量,通常不能小于0"
|
||
}
|
||
```
|
||
|
||
**响应对象 (`ListEnabledUserPlansResponse`)**
|
||
|
||
```json
|
||
{
|
||
"userPlans": "[]UserPlan"
|
||
}
|
||
```
|
||
|
||
**调用示例**
|
||
|
||
```bash
|
||
curl -X POST "https://backend.dooki.cloud/UserPlanService/listEnabledUserPlans" \
|
||
-H "Content-Type: application/json" \
|
||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||
-d '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|
||
|
||
## renewUserPlan
|
||
> 续费套餐
|
||
|
||
- 角色:`admin`, `user`
|
||
- HTTP:`POST https://backend.dooki.cloud/UserPlanService/renewUserPlan`
|
||
- RPC:`rpc renewUserPlan(RenewUserPlanRequest) returns (RPCSuccess);`
|
||
|
||
**请求对象 (`RenewUserPlanRequest`)**
|
||
|
||
```json
|
||
{
|
||
"userPlanId": "int64",
|
||
"dayTo": "string",
|
||
"period": "string",
|
||
"countPeriod": "int32"
|
||
}
|
||
```
|
||
|
||
**响应对象 (`RPCSuccess`)**
|
||
|
||
```json
|
||
{}
|
||
```
|
||
|
||
**调用示例**
|
||
|
||
```bash
|
||
curl -X POST "https://backend.dooki.cloud/UserPlanService/renewUserPlan" \
|
||
-H "Content-Type: application/json" \
|
||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||
-d '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|
||
|
||
## updateUserPlan
|
||
> 修改已购套餐
|
||
|
||
- 角色:`admin`
|
||
- HTTP:`POST https://backend.dooki.cloud/UserPlanService/updateUserPlan`
|
||
- RPC:`rpc updateUserPlan(UpdateUserPlanRequest) returns (RPCSuccess);`
|
||
|
||
**请求对象 (`UpdateUserPlanRequest`)**
|
||
|
||
```json
|
||
{
|
||
"userPlanId": "int64",
|
||
"planId": "int64",
|
||
"dayTo": "string",
|
||
"isOn": "bool // 是否启用",
|
||
"name": "string // 名称"
|
||
}
|
||
```
|
||
|
||
**响应对象 (`RPCSuccess`)**
|
||
|
||
```json
|
||
{}
|
||
```
|
||
|
||
**调用示例**
|
||
|
||
```bash
|
||
curl -X POST "https://backend.dooki.cloud/UserPlanService/updateUserPlan" \
|
||
-H "Content-Type: application/json" \
|
||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||
-d '{
|
||
...
|
||
}'
|
||
```
|
||
|
||
---
|