Initial commit
This commit is contained in:
361
reference/goedge 文档/PlanService.md
Normal file
361
reference/goedge 文档/PlanService.md
Normal file
@@ -0,0 +1,361 @@
|
||||
# PlanService
|
||||
> 套餐相关服务
|
||||
|
||||
---
|
||||
|
||||
## countAllEnabledPlans
|
||||
> 计算套餐数量
|
||||
|
||||
- 角色:`admin`
|
||||
- HTTP:`POST https://backend.dooki.cloud/PlanService/countAllEnabledPlans`
|
||||
- RPC:`rpc countAllEnabledPlans(CountAllEnabledPlansRequest) returns (RPCCountResponse);`
|
||||
|
||||
**请求对象 (`CountAllEnabledPlansRequest`)**
|
||||
|
||||
```json
|
||||
{}
|
||||
```
|
||||
|
||||
**响应对象 (`RPCCountResponse`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"count": "int64 // 数量"
|
||||
}
|
||||
```
|
||||
|
||||
**调用示例**
|
||||
|
||||
```bash
|
||||
curl -X POST "https://backend.dooki.cloud/PlanService/countAllEnabledPlans" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||||
-d '{
|
||||
...
|
||||
}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## createPlan
|
||||
> 创建套餐
|
||||
|
||||
- 角色:`admin`
|
||||
- HTTP:`POST https://backend.dooki.cloud/PlanService/createPlan`
|
||||
- RPC:`rpc createPlan(CreatePlanRequest) returns (CreatePlanResponse);`
|
||||
|
||||
**请求对象 (`CreatePlanRequest`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "string // 套餐名称",
|
||||
"description": "string // 套餐简介",
|
||||
"clusterId": "int64 // 集群ID",
|
||||
"trafficLimitJSON": "bytes // 流量限制",
|
||||
"bandwidthLimitPerNodeJSON": "bytes // 单节点带宽限制 json:bit_size_capacity",
|
||||
"hasFullFeatures": "bool // 是否有所有权限",
|
||||
"featuresJSON": "bytes // 权限列表,[code1, code2, ...]",
|
||||
"priceType": "string // 价格类型:traffic, bandwidth, period",
|
||||
"trafficPriceJSON": "bytes // 流量价格配置",
|
||||
"bandwidthPriceJSON": "bytes // 带宽价格配置",
|
||||
"monthlyPrice": "float // 月度价格",
|
||||
"seasonallyPrice": "float // 季度价格",
|
||||
"yearlyPrice": "float // 年度价格",
|
||||
"totalServers": "int32 // 可以添加的网站数",
|
||||
"totalServerNamesPerServer": "int32 // 每个网站可以添加的域名数",
|
||||
"totalServerNames": "int32 // 可以添加的域名总数",
|
||||
"dailyRequests": "int64 // 每日访问量额度",
|
||||
"monthlyRequests": "int64 // 每月访问量额度",
|
||||
"dailyWebsocketConnections": "int64 // 每日Websocket连接数额度",
|
||||
"monthlyWebsocketConnections": "int64 // 每月Websocket连接数额度",
|
||||
"maxUploadSizeJSON": "bytes // 文件最大上传尺寸 json:size_capacity"
|
||||
}
|
||||
```
|
||||
|
||||
**响应对象 (`CreatePlanResponse`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"planId": "int64"
|
||||
}
|
||||
```
|
||||
|
||||
**调用示例**
|
||||
|
||||
```bash
|
||||
curl -X POST "https://backend.dooki.cloud/PlanService/createPlan" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||||
-d '{
|
||||
...
|
||||
}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## deletePlan
|
||||
> 删除套餐
|
||||
|
||||
- 角色:`admin`
|
||||
- HTTP:`POST https://backend.dooki.cloud/PlanService/deletePlan`
|
||||
- RPC:`rpc deletePlan(DeletePlanRequest) returns (RPCSuccess);`
|
||||
|
||||
**请求对象 (`DeletePlanRequest`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"planId": "int64 // 套餐ID"
|
||||
}
|
||||
```
|
||||
|
||||
**响应对象 (`RPCSuccess`)**
|
||||
|
||||
```json
|
||||
{}
|
||||
```
|
||||
|
||||
**调用示例**
|
||||
|
||||
```bash
|
||||
curl -X POST "https://backend.dooki.cloud/PlanService/deletePlan" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||||
-d '{
|
||||
...
|
||||
}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## findAllAvailablePlans
|
||||
> 列出所有可用的套餐
|
||||
|
||||
- 角色:`admin`, `user`
|
||||
- HTTP:`POST https://backend.dooki.cloud/PlanService/findAllAvailablePlans`
|
||||
- RPC:`rpc findAllAvailablePlans(FindAllAvailablePlansRequest) returns (FindAllAvailablePlansResponse);`
|
||||
|
||||
**请求对象 (`FindAllAvailablePlansRequest`)**
|
||||
|
||||
```json
|
||||
{}
|
||||
```
|
||||
|
||||
**响应对象 (`FindAllAvailablePlansResponse`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"plans": "[]Plan // 套餐列表"
|
||||
}
|
||||
```
|
||||
|
||||
**调用示例**
|
||||
|
||||
```bash
|
||||
curl -X POST "https://backend.dooki.cloud/PlanService/findAllAvailablePlans" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||||
-d '{
|
||||
...
|
||||
}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## findBasicPlan
|
||||
> 查找套餐基本信息
|
||||
|
||||
- 角色:`admin`, `user`
|
||||
- HTTP:`POST https://backend.dooki.cloud/PlanService/findBasicPlan`
|
||||
- RPC:`rpc findBasicPlan(FindBasicPlanRequest) returns (FindBasicPlanResponse);`
|
||||
|
||||
**请求对象 (`FindBasicPlanRequest`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"planId": "int64 // 套餐ID"
|
||||
}
|
||||
```
|
||||
|
||||
**响应对象 (`FindBasicPlanResponse`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"plan": "Plan // 套餐信息(只读取基本信息)"
|
||||
}
|
||||
```
|
||||
|
||||
**调用示例**
|
||||
|
||||
```bash
|
||||
curl -X POST "https://backend.dooki.cloud/PlanService/findBasicPlan" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||||
-d '{
|
||||
...
|
||||
}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## findEnabledPlan
|
||||
> 查找单个套餐
|
||||
|
||||
- 角色:`admin`, `user`
|
||||
- HTTP:`POST https://backend.dooki.cloud/PlanService/findEnabledPlan`
|
||||
- RPC:`rpc findEnabledPlan(FindEnabledPlanRequest) returns (FindEnabledPlanResponse);`
|
||||
|
||||
**请求对象 (`FindEnabledPlanRequest`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"planId": "int64 // 套餐ID"
|
||||
}
|
||||
```
|
||||
|
||||
**响应对象 (`FindEnabledPlanResponse`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"plan": "Plan // 套餐信息"
|
||||
}
|
||||
```
|
||||
|
||||
**调用示例**
|
||||
|
||||
```bash
|
||||
curl -X POST "https://backend.dooki.cloud/PlanService/findEnabledPlan" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||||
-d '{
|
||||
...
|
||||
}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## listEnabledPlans
|
||||
> 列出单页套餐
|
||||
|
||||
- 角色:`admin`
|
||||
- HTTP:`POST https://backend.dooki.cloud/PlanService/listEnabledPlans`
|
||||
- RPC:`rpc listEnabledPlans(ListEnabledPlansRequest) returns (ListEnabledPlansResponse);`
|
||||
|
||||
**请求对象 (`ListEnabledPlansRequest`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"offset": "int64 // 读取位置",
|
||||
"size": "int64 // 数量,通常不能小于0"
|
||||
}
|
||||
```
|
||||
|
||||
**响应对象 (`ListEnabledPlansResponse`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"plans": "[]Plan // 套餐列表"
|
||||
}
|
||||
```
|
||||
|
||||
**调用示例**
|
||||
|
||||
```bash
|
||||
curl -X POST "https://backend.dooki.cloud/PlanService/listEnabledPlans" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||||
-d '{
|
||||
...
|
||||
}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## sortPlans
|
||||
> 对套餐进行排序
|
||||
|
||||
- 角色:`admin`
|
||||
- HTTP:`POST https://backend.dooki.cloud/PlanService/sortPlans`
|
||||
- RPC:`rpc sortPlans(SortPlansRequest) returns (RPCSuccess);`
|
||||
|
||||
**请求对象 (`SortPlansRequest`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"planIds": "[]int64 // 排序后的套餐ID列表"
|
||||
}
|
||||
```
|
||||
|
||||
**响应对象 (`RPCSuccess`)**
|
||||
|
||||
```json
|
||||
{}
|
||||
```
|
||||
|
||||
**调用示例**
|
||||
|
||||
```bash
|
||||
curl -X POST "https://backend.dooki.cloud/PlanService/sortPlans" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||||
-d '{
|
||||
...
|
||||
}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## updatePlan
|
||||
> 修改套餐
|
||||
|
||||
- 角色:`admin`
|
||||
- HTTP:`POST https://backend.dooki.cloud/PlanService/updatePlan`
|
||||
- RPC:`rpc updatePlan(UpdatePlanRequest) returns (RPCSuccess);`
|
||||
|
||||
**请求对象 (`UpdatePlanRequest`)**
|
||||
|
||||
```json
|
||||
{
|
||||
"planId": "int64 // 套餐ID",
|
||||
"name": "string // 套餐名称",
|
||||
"description": "string // 套餐简介",
|
||||
"isOn": "bool // 是否启用",
|
||||
"clusterId": "int64 // 集群ID",
|
||||
"trafficLimitJSON": "bytes // 流量限制",
|
||||
"bandwidthLimitPerNodeJSON": "bytes // 单节点带宽限制",
|
||||
"hasFullFeatures": "bool // 是否有所有权限",
|
||||
"featuresJSON": "bytes // 权限列表,[code1, code2, ...]",
|
||||
"priceType": "string // 价格类型:traffic, bandwidth, period",
|
||||
"trafficPriceJSON": "bytes // 流量价格配置",
|
||||
"bandwidthPriceJSON": "bytes // 带宽价格配置",
|
||||
"monthlyPrice": "float // 月费用",
|
||||
"seasonallyPrice": "float // 季度费用",
|
||||
"yearlyPrice": "float // 年度费用",
|
||||
"totalServers": "int32 // 可以添加的网站数",
|
||||
"totalServerNamesPerServer": "int32 // 每个网站可以添加的域名数",
|
||||
"totalServerNames": "int32 // 可以添加的域名总数",
|
||||
"dailyRequests": "int64 // 每日访问量额度",
|
||||
"monthlyRequests": "int64 // 每月访问量额度",
|
||||
"dailyWebsocketConnections": "int64 // 每日Websocket连接数额度",
|
||||
"monthlyWebsocketConnections": "int64 // 每月Websocket连接数额度",
|
||||
"maxUploadSizeJSON": "bytes // 文件最大上传尺寸 json:size_capacity"
|
||||
}
|
||||
```
|
||||
|
||||
**响应对象 (`RPCSuccess`)**
|
||||
|
||||
```json
|
||||
{}
|
||||
```
|
||||
|
||||
**调用示例**
|
||||
|
||||
```bash
|
||||
curl -X POST "https://backend.dooki.cloud/PlanService/updatePlan" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
|
||||
-d '{
|
||||
...
|
||||
}'
|
||||
```
|
||||
|
||||
---
|
||||
Reference in New Issue
Block a user