mirror of
				https://github.com/TeaOSLab/EdgeCommon.git
				synced 2025-11-04 05:00:24 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			104 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Protocol Buffer
		
	
	
	
	
	
			
		
		
	
	
			104 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Protocol Buffer
		
	
	
	
	
	
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);
 | 
						|
 | 
						|
	// 使用余额购买用户套餐
 | 
						|
	rpc buyNSUserPlan(BuyNSUserPlanRequest) returns (BuyNSUserPlanResponse);
 | 
						|
}
 | 
						|
 | 
						|
// 创建用户套餐
 | 
						|
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;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
// 使用余额购买用户套餐
 | 
						|
message BuyNSUserPlanRequest{
 | 
						|
	int64 userId = 1;
 | 
						|
	int64 planId = 2;
 | 
						|
	string period = 3;
 | 
						|
}
 | 
						|
 | 
						|
message BuyNSUserPlanResponse {
 | 
						|
	int64 userPlanId = 1;
 | 
						|
} |