实现带宽计费套餐

This commit is contained in:
GoEdgeLab
2022-01-23 19:16:58 +08:00
parent 83d3ab75c3
commit 64e9fe64b3
14 changed files with 1032 additions and 52 deletions

View File

@@ -12,6 +12,7 @@ message Plan {
bytes featuresJSON = 6;
string priceType = 7;
bytes trafficPriceJSON = 8;
bytes bandwidthPriceJSON = 12;
float monthlyPrice = 9;
float seasonallyPrice = 10;
float yearlyPrice = 11;

View File

@@ -0,0 +1,27 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
import "models/model_plan.proto";
import "models/model_user_plan.proto";
import "models/model_user.proto";
import "models/model_server.proto";
message ServerBill {
int64 id = 1;
int64 userId = 2;
int64 serverId = 3;
float amount = 4;
int64 createdAt = 5;
int64 userPlanId = 6;
int64 planId = 7;
int64 totalTrafficBytes = 8;
int64 bandwidthPercentileBytes = 9;
int32 bandwidthPercentile = 10;
UserPlan userPlan = 30;
Plan plan = 31;
User user = 32;
Server server = 33;
}

View File

@@ -20,6 +20,7 @@ message User {
bool isVerified = 13;
bool isRejected = 14;
string rejectReason = 15;
bool isDeleted = 16;
NodeCluster nodeCluster = 10;
repeated UserFeature features = 11;

View File

@@ -16,4 +16,5 @@ message UserBill {
bool isPaid = 8;
int64 paidAt = 9;
string code = 10;
bool canPay = 11;
}

View File

@@ -38,6 +38,7 @@ message CreatePlanRequest {
bytes featuresJSON = 4;
string priceType = 5;
bytes trafficPriceJSON = 6;
bytes bandwidthPriceJSON = 10;
float monthlyPrice = 7;
float seasonallyPrice = 8;
float yearlyPrice = 9;
@@ -57,6 +58,7 @@ message UpdatePlanRequest {
bytes featuresJSON = 6;
string priceType = 7;
bytes trafficPriceJSON = 8;
bytes bandwidthPriceJSON = 12;
float monthlyPrice = 9;
float seasonallyPrice = 10;
float yearlyPrice = 11;

View File

@@ -0,0 +1,34 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
import "models/model_server_bill.proto";
import "models/rpc_messages.proto";
// 服务账单相关服务
service ServerBillService {
// 查询服务账单数量
rpc countAllServerBills(CountAllServerBillsRequest) returns (RPCCountResponse);
// 查询服务账单列表
rpc listServerBills(ListServerBillsRequest) returns (ListServerBillsResponse);
}
// 查询服务账单数量
message CountAllServerBillsRequest {
int64 userId = 1;
string month = 2;
}
// 查询服务账单列表
message ListServerBillsRequest {
int64 userId = 1;
string month = 2;
int64 offset = 3;
int64 size = 4;
}
message ListServerBillsResponse {
repeated ServerBill serverBills = 1;
}