Files
pyGoEdge-UserPanel/reference/goedge 文档/NSUserPlanService.md
2025-11-18 03:36:49 +08:00

4.9 KiB
Raw Permalink Blame History

NSUserPlanService

用户DNS套餐服务


buyNSUserPlan

使用余额购买用户套餐

  • 角色:admin
  • HTTPPOST https://backend.dooki.cloud/NSUserPlanService/buyNSUserPlan
  • RPCrpc 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
  • HTTPPOST https://backend.dooki.cloud/NSUserPlanService/countNSUserPlans
  • RPCrpc 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
  • HTTPPOST https://backend.dooki.cloud/NSUserPlanService/createNSUserPlan
  • RPCrpc 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
  • HTTPPOST https://backend.dooki.cloud/NSUserPlanService/deleteNSUserPlan
  • RPCrpc 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
  • HTTPPOST https://backend.dooki.cloud/NSUserPlanService/findNSUserPlan
  • RPCrpc 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
  • HTTPPOST https://backend.dooki.cloud/NSUserPlanService/listNSUserPlans
  • RPCrpc 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
  • HTTPPOST https://backend.dooki.cloud/NSUserPlanService/updateNSUserPlan
  • RPCrpc 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 '{
    ...
  }'