4.9 KiB
4.9 KiB
NSUserPlanService
用户DNS套餐服务
buyNSUserPlan
使用余额购买用户套餐
- 角色:
admin - HTTP:
POST https://backend.dooki.cloud/NSUserPlanService/buyNSUserPlan - RPC:
rpc buyNSUserPlan(BuyNSUserPlanRequest) returns (BuyNSUserPlanResponse);
请求对象 (BuyNSUserPlanRequest)
{
"userId": "int64 // 用户ID",
"planId": "int64",
"period": "string"
}
响应对象 (BuyNSUserPlanResponse)
{
"userPlanId": "int64"
}
调用示例
curl -X POST "https://backend.dooki.cloud/NSUserPlanService/buyNSUserPlan" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
countNSUserPlans
计算用户套餐数量
- 角色:
admin - HTTP:
POST https://backend.dooki.cloud/NSUserPlanService/countNSUserPlans - RPC:
rpc countNSUserPlans(CountNSUserPlansRequest) returns (RPCCountResponse);
请求对象 (CountNSUserPlansRequest)
{
"userId": "int64 // 用户ID",
"nsPlanId": "int64",
"periodUnit": "string",
"isExpired": "bool",
"expireDays": "int32"
}
响应对象 (RPCCountResponse)
{
"count": "int64 // 数量"
}
调用示例
curl -X POST "https://backend.dooki.cloud/NSUserPlanService/countNSUserPlans" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
createNSUserPlan
创建用户套餐
- 角色:
admin - HTTP:
POST https://backend.dooki.cloud/NSUserPlanService/createNSUserPlan - RPC:
rpc createNSUserPlan(CreateNSUserPlanRequest) returns (CreateNSUserPlanResponse);
请求对象 (CreateNSUserPlanRequest)
{
"userId": "int64 // 用户ID",
"nsPlanId": "int64",
"dayFrom": "string // YYYYMMDD",
"dayTo": "string // YYYYMMDD",
"periodUnit": "string // yearly|monthly"
}
响应对象 (CreateNSUserPlanResponse)
{
"nsUserPlanId": "int64"
}
调用示例
curl -X POST "https://backend.dooki.cloud/NSUserPlanService/createNSUserPlan" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
deleteNSUserPlan
删除用户套餐
- 角色:
admin - HTTP:
POST https://backend.dooki.cloud/NSUserPlanService/deleteNSUserPlan - RPC:
rpc deleteNSUserPlan(DeleteNSUserPlanRequest) returns (RPCSuccess);
请求对象 (DeleteNSUserPlanRequest)
{
"nsUserPlanId": "int64"
}
响应对象 (RPCSuccess)
{}
调用示例
curl -X POST "https://backend.dooki.cloud/NSUserPlanService/deleteNSUserPlan" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
findNSUserPlan
读取用户套餐
- 角色:
admin,user - HTTP:
POST https://backend.dooki.cloud/NSUserPlanService/findNSUserPlan - RPC:
rpc findNSUserPlan(FindNSUserPlanRequest) returns (FindNSUserPlanResponse);
请求对象 (FindNSUserPlanRequest)
{
"userId": "int64 // 和 nsUserPlanId 二选一",
"nsUserPlanId": "int64"
}
响应对象 (FindNSUserPlanResponse)
{
"nsUserPlan": "NSUserPlan"
}
调用示例
curl -X POST "https://backend.dooki.cloud/NSUserPlanService/findNSUserPlan" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
listNSUserPlans
列出单页套餐
- 角色:
admin - HTTP:
POST https://backend.dooki.cloud/NSUserPlanService/listNSUserPlans - RPC:
rpc listNSUserPlans(ListNSUserPlansRequest) returns (ListNSUserPlansResponse);
请求对象 (ListNSUserPlansRequest)
{
"userId": "int64 // 用户ID",
"nsPlanId": "int64",
"periodUnit": "string",
"isExpired": "bool",
"expireDays": "int32",
"offset": "int64 // 读取位置",
"size": "int64 // 数量,通常不能小于0"
}
响应对象 (ListNSUserPlansResponse)
{
"nsUserPlans": "[]NSUserPlan"
}
调用示例
curl -X POST "https://backend.dooki.cloud/NSUserPlanService/listNSUserPlans" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'
updateNSUserPlan
修改用户套餐
- 角色:
admin - HTTP:
POST https://backend.dooki.cloud/NSUserPlanService/updateNSUserPlan - RPC:
rpc updateNSUserPlan(UpdateNSUserPlanRequest) returns (RPCSuccess);
请求对象 (UpdateNSUserPlanRequest)
{
"nsUserPlanId": "int64",
"nsPlanId": "int64",
"dayFrom": "string // YYYYMMDD",
"dayTo": "string // YYYYMMDD",
"periodUnit": "string // yearly|monthly"
}
响应对象 (RPCSuccess)
{}
调用示例
curl -X POST "https://backend.dooki.cloud/NSUserPlanService/updateNSUserPlan" \
-H "Content-Type: application/json" \
-H "X-Edge-Access-Token: <YOUR_TOKEN>" \
-d '{
...
}'