增加DNS套餐相关API

This commit is contained in:
刘祥超
2022-09-13 10:50:26 +08:00
parent da02e6df4a
commit cf4b9a49ed
20 changed files with 7944 additions and 4304 deletions

View File

@@ -0,0 +1,13 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
message NSPlan {
int64 id = 1;
string name = 2;
bool isOn = 3;
float monthlyPrice = 4;
float yearlyPrice = 5;
bytes configJSON = 6;
}

View File

@@ -0,0 +1,19 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
import "models/model_ns_plan.proto";
import "models/model_user.proto";
message NSUserPlan {
int64 id = 1;
int64 nsPlanId = 2;
int64 userId = 3;
string dayFrom = 4;
string dayTo = 5;
string periodUnit = 6;
NSPlan nsPlan = 30;
User user = 31;
}

View File

@@ -0,0 +1,90 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
import "models/model_ns_plan.proto";
import "models/rpc_messages.proto";
// DNS套餐服务
service NSPlanService {
// 创建DNS套餐
rpc createNSPlan(CreateNSPlanRequest) returns (CreateNSPlanResponse);
// 修改DNS套餐
rpc updateNSPlan(UpdateNSPlanRequest) returns (RPCSuccess);
// 修改DNS套餐顺序
rpc sortNSPlanOrders(SortNSPlansRequest) returns (RPCSuccess);
// 查找所有DNS套餐
rpc findAllNSPlans(FindAllNSPlansRequest) returns (FindAllNSPlansResponse);
// 查找所有可用DNS套餐
rpc findAllEnabledNSPlans(FindAllEnabledNSPlansRequest) returns (FindAllEnabledNSPlansResponse);
// 查找DNS套餐
rpc findNSPlan(FindNSPlanRequest) returns (FindNSPlanResponse);
// 删除DNS套餐
rpc deleteNSPlan(DeleteNSPlanRequest) returns (RPCSuccess);
}
// 创建DNS套餐
message CreateNSPlanRequest {
string name = 1;
float monthlyPrice = 2;
float yearlyPrice = 3;
bytes configJSON = 4;
}
message CreateNSPlanResponse {
int64 nsPlanId = 1;
}
// 修改DNS套餐
message UpdateNSPlanRequest {
int64 nsPlanId = 1;
string name = 2;
bool isOn = 3;
float monthlyPrice = 4;
float yearlyPrice = 5;
bytes configJSON = 6;
}
// 修改DNS套餐顺序
message SortNSPlansRequest {
repeated int64 nsPlanIds = 1;
}
// 查找所有DNS套餐
message FindAllNSPlansRequest {
}
message FindAllNSPlansResponse {
repeated NSPlan nsPlans = 1;
}
// 查找所有可用DNS套餐
message FindAllEnabledNSPlansRequest {
}
message FindAllEnabledNSPlansResponse {
repeated NSPlan nsPlans = 1;
}
// 查找DNS套餐
message FindNSPlanRequest {
int64 nsPlanId = 1;
}
message FindNSPlanResponse {
NSPlan nsPlan = 1;
}
// 删除DNS套餐
message DeleteNSPlanRequest {
int64 nsPlanId = 1;
}

View File

@@ -38,6 +38,9 @@ service NSRecordService {
// 计算记录数量
rpc countAllNSRecords (CountAllNSRecordsRequest) returns (RPCCountResponse);
// 查询相同记录名的记录数
rpc countAllNSRecordsWithName (CountAllNSRecordsWithNameRequest) returns (RPCCountResponse);
// 读取单页记录
rpc listNSRecords (ListNSRecordsRequest) returns (ListNSRecordsResponse);
@@ -167,6 +170,13 @@ message CountAllNSRecordsRequest {
string keyword = 4;
}
// 查询相同记录名的记录数
message CountAllNSRecordsWithNameRequest {
int64 nsDomainId = 1;
string name = 2;
string type = 3;
}
// 读取单页记录
message ListNSRecordsRequest {
int64 nsDomainId = 1;

View File

@@ -20,6 +20,9 @@ service NSRouteService {
// 获取单个自定义路线信息
rpc findNSRoute (FindNSRouteRequest) returns (FindNSRouteResponse);
// 查询自定义线路数量
rpc countAllNSRoutes(CountAllNSRoutesRequest) returns (RPCCountResponse);
// 读取所有自定义线路
rpc findAllNSRoutes (FindAllNSRoutesRequest) returns (FindAllNSRoutesResponse);
@@ -73,6 +76,13 @@ message FindNSRouteResponse {
NSRoute nsRoute = 1;
}
// 查询自定义线路数量
message CountAllNSRoutesRequest {
int64 nsClusterId = 1;
int64 nsDomainId = 2;
int64 userId = 3;
}
// 读取所有自定义线路
message FindAllNSRoutesRequest {
int64 nsClusterId = 1;

View File

@@ -0,0 +1,89 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
import "models/model_ns_user_plan.proto";
import "models/rpc_messages.proto";
// 用户DNS套餐服务
service NSUserPlanService {
// 创建用户套餐
rpc createNSUserPlan(CreateNSUserPlanRequest) returns (CreateNSUserPlanResponse);
// 修改用户套餐
rpc updateNSUserPlan(UpdateNSUserPlanRequest) returns (RPCSuccess);
// 删除用户套餐
rpc deleteNSUserPlan(DeleteNSUserPlanRequest) returns (RPCSuccess);
// 读取用户套餐
rpc findNSUserPlan(FindNSUserPlanRequest) returns (FindNSUserPlanResponse);
// 计算用户套餐数量
rpc countNSUserPlans(CountNSUserPlansRequest) returns (RPCCountResponse);
// 列出单页套餐
rpc listNSUserPlans(ListNSUserPlansRequest) returns (ListNSUserPlansResponse);
}
// 创建用户套餐
message CreateNSUserPlanRequest {
int64 userId = 1;
int64 nsPlanId = 2;
string dayFrom = 3; // YYYYMMDD
string dayTo = 4; // YYYYMMDD
string periodUnit = 5; // yearly|monthly
}
message CreateNSUserPlanResponse {
int64 nsUserPlanId = 1;
}
// 修改用户套餐
message UpdateNSUserPlanRequest {
int64 nsUserPlanId = 1;
int64 nsPlanId = 2;
string dayFrom = 3; // YYYYMMDD
string dayTo = 4; // YYYYMMDD
string periodUnit = 5; // yearly|monthly
}
// 删除用户套餐
message DeleteNSUserPlanRequest{
int64 nsUserPlanId = 1;
}
// 读取用户套餐
message FindNSUserPlanRequest {
int64 userId = 1; // 和 nsUserPlanId 二选一
int64 nsUserPlanId = 2;
}
message FindNSUserPlanResponse {
NSUserPlan nsUserPlan = 1;
}
// 计算用户套餐数量
message CountNSUserPlansRequest{
int64 userId = 1;
int64 nsPlanId = 2;
string periodUnit = 3;
bool isExpired = 4;
int32 expireDays = 5;
}
// 列出单页套餐
message ListNSUserPlansRequest {
int64 userId = 1;
int64 nsPlanId = 2;
string periodUnit = 3;
bool isExpired = 4;
int32 expireDays = 5;
int64 offset = 6;
int64 size = 7;
}
message ListNSUserPlansResponse {
repeated NSUserPlan nsUserPlans = 1;
}

View File

@@ -3,7 +3,7 @@ option go_package = "./pb";
package pb;
import "models/server_domain_hourly_stat.proto";
import "models/model_server_domain_hourly_stat.proto";
// 服务域名按小时统计服务
service ServerDomainHourlyStatService {