diff --git a/pkg/rpc/pb/model_plan.pb.go b/pkg/rpc/pb/model_plan.pb.go index 8cebb95..43dc7f3 100644 --- a/pkg/rpc/pb/model_plan.pb.go +++ b/pkg/rpc/pb/model_plan.pb.go @@ -30,17 +30,18 @@ type Plan struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - IsOn bool `protobuf:"varint,2,opt,name=isOn,proto3" json:"isOn,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - ClusterId int64 `protobuf:"varint,4,opt,name=clusterId,proto3" json:"clusterId,omitempty"` - TrafficLimitJSON []byte `protobuf:"bytes,5,opt,name=trafficLimitJSON,proto3" json:"trafficLimitJSON,omitempty"` - FeaturesJSON []byte `protobuf:"bytes,6,opt,name=featuresJSON,proto3" json:"featuresJSON,omitempty"` - PriceType string `protobuf:"bytes,7,opt,name=priceType,proto3" json:"priceType,omitempty"` - TrafficPriceJSON []byte `protobuf:"bytes,8,opt,name=trafficPriceJSON,proto3" json:"trafficPriceJSON,omitempty"` - MonthlyPrice float32 `protobuf:"fixed32,9,opt,name=monthlyPrice,proto3" json:"monthlyPrice,omitempty"` - SeasonallyPrice float32 `protobuf:"fixed32,10,opt,name=seasonallyPrice,proto3" json:"seasonallyPrice,omitempty"` - YearlyPrice float32 `protobuf:"fixed32,11,opt,name=yearlyPrice,proto3" json:"yearlyPrice,omitempty"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + IsOn bool `protobuf:"varint,2,opt,name=isOn,proto3" json:"isOn,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + ClusterId int64 `protobuf:"varint,4,opt,name=clusterId,proto3" json:"clusterId,omitempty"` + TrafficLimitJSON []byte `protobuf:"bytes,5,opt,name=trafficLimitJSON,proto3" json:"trafficLimitJSON,omitempty"` + FeaturesJSON []byte `protobuf:"bytes,6,opt,name=featuresJSON,proto3" json:"featuresJSON,omitempty"` + PriceType string `protobuf:"bytes,7,opt,name=priceType,proto3" json:"priceType,omitempty"` + TrafficPriceJSON []byte `protobuf:"bytes,8,opt,name=trafficPriceJSON,proto3" json:"trafficPriceJSON,omitempty"` + BandwidthPriceJSON []byte `protobuf:"bytes,12,opt,name=bandwidthPriceJSON,proto3" json:"bandwidthPriceJSON,omitempty"` + MonthlyPrice float32 `protobuf:"fixed32,9,opt,name=monthlyPrice,proto3" json:"monthlyPrice,omitempty"` + SeasonallyPrice float32 `protobuf:"fixed32,10,opt,name=seasonallyPrice,proto3" json:"seasonallyPrice,omitempty"` + YearlyPrice float32 `protobuf:"fixed32,11,opt,name=yearlyPrice,proto3" json:"yearlyPrice,omitempty"` } func (x *Plan) Reset() { @@ -131,6 +132,13 @@ func (x *Plan) GetTrafficPriceJSON() []byte { return nil } +func (x *Plan) GetBandwidthPriceJSON() []byte { + if x != nil { + return x.BandwidthPriceJSON + } + return nil +} + func (x *Plan) GetMonthlyPrice() float32 { if x != nil { return x.MonthlyPrice @@ -156,7 +164,7 @@ var File_models_model_plan_proto protoreflect.FileDescriptor var file_models_model_plan_proto_rawDesc = []byte{ 0x0a, 0x17, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x70, - 0x6c, 0x61, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xe6, 0x02, + 0x6c, 0x61, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x96, 0x03, 0x0a, 0x04, 0x50, 0x6c, 0x61, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, @@ -172,6 +180,9 @@ var file_models_model_plan_proto_rawDesc = []byte{ 0x09, 0x70, 0x72, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x50, 0x72, 0x69, 0x63, 0x65, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x50, 0x72, 0x69, + 0x63, 0x65, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x2e, 0x0a, 0x12, 0x62, 0x61, 0x6e, 0x64, 0x77, 0x69, + 0x64, 0x74, 0x68, 0x50, 0x72, 0x69, 0x63, 0x65, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0c, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x12, 0x62, 0x61, 0x6e, 0x64, 0x77, 0x69, 0x64, 0x74, 0x68, 0x50, 0x72, 0x69, 0x63, 0x65, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x22, 0x0a, 0x0c, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x6c, 0x79, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0c, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x6c, 0x79, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x73, 0x65, diff --git a/pkg/rpc/pb/model_server_bill.pb.go b/pkg/rpc/pb/model_server_bill.pb.go new file mode 100644 index 0000000..b68fac9 --- /dev/null +++ b/pkg/rpc/pb/model_server_bill.pb.go @@ -0,0 +1,298 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: models/model_server_bill.proto + +package pb + +import ( + proto "github.com/golang/protobuf/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type ServerBill struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + UserId int64 `protobuf:"varint,2,opt,name=userId,proto3" json:"userId,omitempty"` + ServerId int64 `protobuf:"varint,3,opt,name=serverId,proto3" json:"serverId,omitempty"` + Amount float32 `protobuf:"fixed32,4,opt,name=amount,proto3" json:"amount,omitempty"` + CreatedAt int64 `protobuf:"varint,5,opt,name=createdAt,proto3" json:"createdAt,omitempty"` + UserPlanId int64 `protobuf:"varint,6,opt,name=userPlanId,proto3" json:"userPlanId,omitempty"` + PlanId int64 `protobuf:"varint,7,opt,name=planId,proto3" json:"planId,omitempty"` + TotalTrafficBytes int64 `protobuf:"varint,8,opt,name=totalTrafficBytes,proto3" json:"totalTrafficBytes,omitempty"` + BandwidthPercentileBytes int64 `protobuf:"varint,9,opt,name=bandwidthPercentileBytes,proto3" json:"bandwidthPercentileBytes,omitempty"` + BandwidthPercentile int32 `protobuf:"varint,10,opt,name=bandwidthPercentile,proto3" json:"bandwidthPercentile,omitempty"` + UserPlan *UserPlan `protobuf:"bytes,30,opt,name=userPlan,proto3" json:"userPlan,omitempty"` + Plan *Plan `protobuf:"bytes,31,opt,name=plan,proto3" json:"plan,omitempty"` + User *User `protobuf:"bytes,32,opt,name=user,proto3" json:"user,omitempty"` + Server *Server `protobuf:"bytes,33,opt,name=server,proto3" json:"server,omitempty"` +} + +func (x *ServerBill) Reset() { + *x = ServerBill{} + if protoimpl.UnsafeEnabled { + mi := &file_models_model_server_bill_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ServerBill) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerBill) ProtoMessage() {} + +func (x *ServerBill) ProtoReflect() protoreflect.Message { + mi := &file_models_model_server_bill_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServerBill.ProtoReflect.Descriptor instead. +func (*ServerBill) Descriptor() ([]byte, []int) { + return file_models_model_server_bill_proto_rawDescGZIP(), []int{0} +} + +func (x *ServerBill) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *ServerBill) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *ServerBill) GetServerId() int64 { + if x != nil { + return x.ServerId + } + return 0 +} + +func (x *ServerBill) GetAmount() float32 { + if x != nil { + return x.Amount + } + return 0 +} + +func (x *ServerBill) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *ServerBill) GetUserPlanId() int64 { + if x != nil { + return x.UserPlanId + } + return 0 +} + +func (x *ServerBill) GetPlanId() int64 { + if x != nil { + return x.PlanId + } + return 0 +} + +func (x *ServerBill) GetTotalTrafficBytes() int64 { + if x != nil { + return x.TotalTrafficBytes + } + return 0 +} + +func (x *ServerBill) GetBandwidthPercentileBytes() int64 { + if x != nil { + return x.BandwidthPercentileBytes + } + return 0 +} + +func (x *ServerBill) GetBandwidthPercentile() int32 { + if x != nil { + return x.BandwidthPercentile + } + return 0 +} + +func (x *ServerBill) GetUserPlan() *UserPlan { + if x != nil { + return x.UserPlan + } + return nil +} + +func (x *ServerBill) GetPlan() *Plan { + if x != nil { + return x.Plan + } + return nil +} + +func (x *ServerBill) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +func (x *ServerBill) GetServer() *Server { + if x != nil { + return x.Server + } + return nil +} + +var File_models_model_server_bill_proto protoreflect.FileDescriptor + +var file_models_model_server_bill_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x62, 0x69, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x02, 0x70, 0x62, 0x1a, 0x17, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, + 0x65, 0x6c, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x6d, + 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x75, 0x73, 0x65, 0x72, + 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x6d, 0x6f, 0x64, + 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, + 0x65, 0x6c, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0xe4, 0x03, 0x0a, 0x0a, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x42, 0x69, 0x6c, 0x6c, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, + 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, + 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x02, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, + 0x50, 0x6c, 0x61, 0x6e, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, 0x73, + 0x65, 0x72, 0x50, 0x6c, 0x61, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x6c, 0x61, 0x6e, + 0x49, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x70, 0x6c, 0x61, 0x6e, 0x49, 0x64, + 0x12, 0x2c, 0x0a, 0x11, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, + 0x42, 0x79, 0x74, 0x65, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x74, 0x6f, 0x74, + 0x61, 0x6c, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x3a, + 0x0a, 0x18, 0x62, 0x61, 0x6e, 0x64, 0x77, 0x69, 0x64, 0x74, 0x68, 0x50, 0x65, 0x72, 0x63, 0x65, + 0x6e, 0x74, 0x69, 0x6c, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x18, 0x62, 0x61, 0x6e, 0x64, 0x77, 0x69, 0x64, 0x74, 0x68, 0x50, 0x65, 0x72, 0x63, 0x65, + 0x6e, 0x74, 0x69, 0x6c, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x30, 0x0a, 0x13, 0x62, 0x61, + 0x6e, 0x64, 0x77, 0x69, 0x64, 0x74, 0x68, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x6c, + 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x13, 0x62, 0x61, 0x6e, 0x64, 0x77, 0x69, 0x64, + 0x74, 0x68, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x6c, 0x65, 0x12, 0x28, 0x0a, 0x08, + 0x75, 0x73, 0x65, 0x72, 0x50, 0x6c, 0x61, 0x6e, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, + 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x50, 0x6c, 0x61, 0x6e, 0x52, 0x08, 0x75, 0x73, + 0x65, 0x72, 0x50, 0x6c, 0x61, 0x6e, 0x12, 0x1c, 0x0a, 0x04, 0x70, 0x6c, 0x61, 0x6e, 0x18, 0x1f, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x6c, 0x61, 0x6e, 0x52, 0x04, + 0x70, 0x6c, 0x61, 0x6e, 0x12, 0x1c, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x20, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, + 0x65, 0x72, 0x12, 0x22, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x21, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_models_model_server_bill_proto_rawDescOnce sync.Once + file_models_model_server_bill_proto_rawDescData = file_models_model_server_bill_proto_rawDesc +) + +func file_models_model_server_bill_proto_rawDescGZIP() []byte { + file_models_model_server_bill_proto_rawDescOnce.Do(func() { + file_models_model_server_bill_proto_rawDescData = protoimpl.X.CompressGZIP(file_models_model_server_bill_proto_rawDescData) + }) + return file_models_model_server_bill_proto_rawDescData +} + +var file_models_model_server_bill_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_models_model_server_bill_proto_goTypes = []interface{}{ + (*ServerBill)(nil), // 0: pb.ServerBill + (*UserPlan)(nil), // 1: pb.UserPlan + (*Plan)(nil), // 2: pb.Plan + (*User)(nil), // 3: pb.User + (*Server)(nil), // 4: pb.Server +} +var file_models_model_server_bill_proto_depIdxs = []int32{ + 1, // 0: pb.ServerBill.userPlan:type_name -> pb.UserPlan + 2, // 1: pb.ServerBill.plan:type_name -> pb.Plan + 3, // 2: pb.ServerBill.user:type_name -> pb.User + 4, // 3: pb.ServerBill.server:type_name -> pb.Server + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_models_model_server_bill_proto_init() } +func file_models_model_server_bill_proto_init() { + if File_models_model_server_bill_proto != nil { + return + } + file_models_model_plan_proto_init() + file_models_model_user_plan_proto_init() + file_models_model_user_proto_init() + file_models_model_server_proto_init() + if !protoimpl.UnsafeEnabled { + file_models_model_server_bill_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ServerBill); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_models_model_server_bill_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_models_model_server_bill_proto_goTypes, + DependencyIndexes: file_models_model_server_bill_proto_depIdxs, + MessageInfos: file_models_model_server_bill_proto_msgTypes, + }.Build() + File_models_model_server_bill_proto = out.File + file_models_model_server_bill_proto_rawDesc = nil + file_models_model_server_bill_proto_goTypes = nil + file_models_model_server_bill_proto_depIdxs = nil +} diff --git a/pkg/rpc/pb/model_user.pb.go b/pkg/rpc/pb/model_user.pb.go index 4d24b90..b281966 100644 --- a/pkg/rpc/pb/model_user.pb.go +++ b/pkg/rpc/pb/model_user.pb.go @@ -43,6 +43,7 @@ type User struct { IsVerified bool `protobuf:"varint,13,opt,name=isVerified,proto3" json:"isVerified,omitempty"` IsRejected bool `protobuf:"varint,14,opt,name=isRejected,proto3" json:"isRejected,omitempty"` RejectReason string `protobuf:"bytes,15,opt,name=rejectReason,proto3" json:"rejectReason,omitempty"` + IsDeleted bool `protobuf:"varint,16,opt,name=isDeleted,proto3" json:"isDeleted,omitempty"` NodeCluster *NodeCluster `protobuf:"bytes,10,opt,name=nodeCluster,proto3" json:"nodeCluster,omitempty"` Features []*UserFeature `protobuf:"bytes,11,rep,name=features,proto3" json:"features,omitempty"` } @@ -170,6 +171,13 @@ func (x *User) GetRejectReason() string { return "" } +func (x *User) GetIsDeleted() bool { + if x != nil { + return x.IsDeleted + } + return false +} + func (x *User) GetNodeCluster() *NodeCluster { if x != nil { return x.NodeCluster @@ -193,7 +201,7 @@ var file_models_model_user_proto_rawDesc = []byte{ 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0xc0, 0x03, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0xde, 0x03, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x6e, 0x61, 0x6d, 0x65, @@ -215,14 +223,15 @@ var file_models_model_user_proto_rawDesc = []byte{ 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x61, 0x73, - 0x6f, 0x6e, 0x12, 0x31, 0x0a, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, - 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, - 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, - 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x2b, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, - 0x72, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, + 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, + 0x12, 0x31, 0x0a, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, + 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, + 0x74, 0x65, 0x72, 0x12, 0x2b, 0x0a, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x18, + 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x46, + 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x08, 0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, + 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pkg/rpc/pb/model_user_bill.pb.go b/pkg/rpc/pb/model_user_bill.pb.go index beed0c6..30f122d 100644 --- a/pkg/rpc/pb/model_user_bill.pb.go +++ b/pkg/rpc/pb/model_user_bill.pb.go @@ -40,6 +40,7 @@ type UserBill struct { IsPaid bool `protobuf:"varint,8,opt,name=isPaid,proto3" json:"isPaid,omitempty"` PaidAt int64 `protobuf:"varint,9,opt,name=paidAt,proto3" json:"paidAt,omitempty"` Code string `protobuf:"bytes,10,opt,name=code,proto3" json:"code,omitempty"` + CanPay bool `protobuf:"varint,11,opt,name=canPay,proto3" json:"canPay,omitempty"` } func (x *UserBill) Reset() { @@ -144,13 +145,20 @@ func (x *UserBill) GetCode() string { return "" } +func (x *UserBill) GetCanPay() bool { + if x != nil { + return x.CanPay + } + return false +} + var File_models_model_user_bill_proto protoreflect.FileDescriptor var file_models_model_user_bill_proto_rawDesc = []byte{ 0x0a, 0x1c, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x62, 0x69, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x17, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, - 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfc, 0x01, 0x0a, 0x08, + 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x94, 0x02, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x42, 0x69, 0x6c, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, @@ -166,8 +174,10 @@ var file_models_model_user_bill_proto_rawDesc = []byte{ 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x50, 0x61, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x69, 0x64, 0x41, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x70, 0x61, 0x69, 0x64, 0x41, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x0a, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, - 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x61, + 0x6e, 0x50, 0x61, 0x79, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x61, 0x6e, 0x50, + 0x61, 0x79, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/pkg/rpc/pb/service_plan.pb.go b/pkg/rpc/pb/service_plan.pb.go index 3f7ab2d..1efc1bc 100644 --- a/pkg/rpc/pb/service_plan.pb.go +++ b/pkg/rpc/pb/service_plan.pb.go @@ -35,15 +35,16 @@ type CreatePlanRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - ClusterId int64 `protobuf:"varint,2,opt,name=clusterId,proto3" json:"clusterId,omitempty"` - TrafficLimitJSON []byte `protobuf:"bytes,3,opt,name=trafficLimitJSON,proto3" json:"trafficLimitJSON,omitempty"` - FeaturesJSON []byte `protobuf:"bytes,4,opt,name=featuresJSON,proto3" json:"featuresJSON,omitempty"` - PriceType string `protobuf:"bytes,5,opt,name=priceType,proto3" json:"priceType,omitempty"` - TrafficPriceJSON []byte `protobuf:"bytes,6,opt,name=trafficPriceJSON,proto3" json:"trafficPriceJSON,omitempty"` - MonthlyPrice float32 `protobuf:"fixed32,7,opt,name=monthlyPrice,proto3" json:"monthlyPrice,omitempty"` - SeasonallyPrice float32 `protobuf:"fixed32,8,opt,name=seasonallyPrice,proto3" json:"seasonallyPrice,omitempty"` - YearlyPrice float32 `protobuf:"fixed32,9,opt,name=yearlyPrice,proto3" json:"yearlyPrice,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + ClusterId int64 `protobuf:"varint,2,opt,name=clusterId,proto3" json:"clusterId,omitempty"` + TrafficLimitJSON []byte `protobuf:"bytes,3,opt,name=trafficLimitJSON,proto3" json:"trafficLimitJSON,omitempty"` + FeaturesJSON []byte `protobuf:"bytes,4,opt,name=featuresJSON,proto3" json:"featuresJSON,omitempty"` + PriceType string `protobuf:"bytes,5,opt,name=priceType,proto3" json:"priceType,omitempty"` + TrafficPriceJSON []byte `protobuf:"bytes,6,opt,name=trafficPriceJSON,proto3" json:"trafficPriceJSON,omitempty"` + BandwidthPriceJSON []byte `protobuf:"bytes,10,opt,name=bandwidthPriceJSON,proto3" json:"bandwidthPriceJSON,omitempty"` + MonthlyPrice float32 `protobuf:"fixed32,7,opt,name=monthlyPrice,proto3" json:"monthlyPrice,omitempty"` + SeasonallyPrice float32 `protobuf:"fixed32,8,opt,name=seasonallyPrice,proto3" json:"seasonallyPrice,omitempty"` + YearlyPrice float32 `protobuf:"fixed32,9,opt,name=yearlyPrice,proto3" json:"yearlyPrice,omitempty"` } func (x *CreatePlanRequest) Reset() { @@ -120,6 +121,13 @@ func (x *CreatePlanRequest) GetTrafficPriceJSON() []byte { return nil } +func (x *CreatePlanRequest) GetBandwidthPriceJSON() []byte { + if x != nil { + return x.BandwidthPriceJSON + } + return nil +} + func (x *CreatePlanRequest) GetMonthlyPrice() float32 { if x != nil { return x.MonthlyPrice @@ -194,17 +202,18 @@ type UpdatePlanRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - PlanId int64 `protobuf:"varint,1,opt,name=planId,proto3" json:"planId,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - IsOn bool `protobuf:"varint,3,opt,name=isOn,proto3" json:"isOn,omitempty"` - ClusterId int64 `protobuf:"varint,4,opt,name=clusterId,proto3" json:"clusterId,omitempty"` - TrafficLimitJSON []byte `protobuf:"bytes,5,opt,name=trafficLimitJSON,proto3" json:"trafficLimitJSON,omitempty"` - FeaturesJSON []byte `protobuf:"bytes,6,opt,name=featuresJSON,proto3" json:"featuresJSON,omitempty"` - PriceType string `protobuf:"bytes,7,opt,name=priceType,proto3" json:"priceType,omitempty"` - TrafficPriceJSON []byte `protobuf:"bytes,8,opt,name=trafficPriceJSON,proto3" json:"trafficPriceJSON,omitempty"` - MonthlyPrice float32 `protobuf:"fixed32,9,opt,name=monthlyPrice,proto3" json:"monthlyPrice,omitempty"` - SeasonallyPrice float32 `protobuf:"fixed32,10,opt,name=seasonallyPrice,proto3" json:"seasonallyPrice,omitempty"` - YearlyPrice float32 `protobuf:"fixed32,11,opt,name=yearlyPrice,proto3" json:"yearlyPrice,omitempty"` + PlanId int64 `protobuf:"varint,1,opt,name=planId,proto3" json:"planId,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + IsOn bool `protobuf:"varint,3,opt,name=isOn,proto3" json:"isOn,omitempty"` + ClusterId int64 `protobuf:"varint,4,opt,name=clusterId,proto3" json:"clusterId,omitempty"` + TrafficLimitJSON []byte `protobuf:"bytes,5,opt,name=trafficLimitJSON,proto3" json:"trafficLimitJSON,omitempty"` + FeaturesJSON []byte `protobuf:"bytes,6,opt,name=featuresJSON,proto3" json:"featuresJSON,omitempty"` + PriceType string `protobuf:"bytes,7,opt,name=priceType,proto3" json:"priceType,omitempty"` + TrafficPriceJSON []byte `protobuf:"bytes,8,opt,name=trafficPriceJSON,proto3" json:"trafficPriceJSON,omitempty"` + BandwidthPriceJSON []byte `protobuf:"bytes,12,opt,name=bandwidthPriceJSON,proto3" json:"bandwidthPriceJSON,omitempty"` + MonthlyPrice float32 `protobuf:"fixed32,9,opt,name=monthlyPrice,proto3" json:"monthlyPrice,omitempty"` + SeasonallyPrice float32 `protobuf:"fixed32,10,opt,name=seasonallyPrice,proto3" json:"seasonallyPrice,omitempty"` + YearlyPrice float32 `protobuf:"fixed32,11,opt,name=yearlyPrice,proto3" json:"yearlyPrice,omitempty"` } func (x *UpdatePlanRequest) Reset() { @@ -295,6 +304,13 @@ func (x *UpdatePlanRequest) GetTrafficPriceJSON() []byte { return nil } +func (x *UpdatePlanRequest) GetBandwidthPriceJSON() []byte { + if x != nil { + return x.BandwidthPriceJSON + } + return nil +} + func (x *UpdatePlanRequest) GetMonthlyPrice() float32 { if x != nil { return x.MonthlyPrice @@ -656,7 +672,7 @@ var file_service_plan_proto_rawDesc = []byte{ 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x17, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x72, 0x70, 0x63, 0x5f, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcf, 0x02, 0x0a, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xff, 0x02, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6c, 0x61, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, @@ -670,7 +686,10 @@ var file_service_plan_proto_rawDesc = []byte{ 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x50, 0x72, 0x69, 0x63, 0x65, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x74, 0x72, - 0x61, 0x66, 0x66, 0x69, 0x63, 0x50, 0x72, 0x69, 0x63, 0x65, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x22, + 0x61, 0x66, 0x66, 0x69, 0x63, 0x50, 0x72, 0x69, 0x63, 0x65, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x2e, + 0x0a, 0x12, 0x62, 0x61, 0x6e, 0x64, 0x77, 0x69, 0x64, 0x74, 0x68, 0x50, 0x72, 0x69, 0x63, 0x65, + 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x12, 0x62, 0x61, 0x6e, 0x64, + 0x77, 0x69, 0x64, 0x74, 0x68, 0x50, 0x72, 0x69, 0x63, 0x65, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x22, 0x0a, 0x0c, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x6c, 0x79, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0c, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x6c, 0x79, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x73, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x61, 0x6c, 0x6c, 0x79, @@ -680,7 +699,7 @@ var file_service_plan_proto_rawDesc = []byte{ 0x02, 0x52, 0x0b, 0x79, 0x65, 0x61, 0x72, 0x6c, 0x79, 0x50, 0x72, 0x69, 0x63, 0x65, 0x22, 0x2c, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6c, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x6c, 0x61, 0x6e, 0x49, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x70, 0x6c, 0x61, 0x6e, 0x49, 0x64, 0x22, 0xfb, 0x02, 0x0a, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x70, 0x6c, 0x61, 0x6e, 0x49, 0x64, 0x22, 0xab, 0x03, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6c, 0x61, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x6c, 0x61, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x70, 0x6c, 0x61, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, @@ -697,7 +716,10 @@ var file_service_plan_proto_rawDesc = []byte{ 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x50, 0x72, 0x69, 0x63, 0x65, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, - 0x63, 0x50, 0x72, 0x69, 0x63, 0x65, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x22, 0x0a, 0x0c, 0x6d, 0x6f, + 0x63, 0x50, 0x72, 0x69, 0x63, 0x65, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x2e, 0x0a, 0x12, 0x62, 0x61, + 0x6e, 0x64, 0x77, 0x69, 0x64, 0x74, 0x68, 0x50, 0x72, 0x69, 0x63, 0x65, 0x4a, 0x53, 0x4f, 0x4e, + 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x12, 0x62, 0x61, 0x6e, 0x64, 0x77, 0x69, 0x64, 0x74, + 0x68, 0x50, 0x72, 0x69, 0x63, 0x65, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x22, 0x0a, 0x0c, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x6c, 0x79, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0c, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x6c, 0x79, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x73, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x61, 0x6c, 0x6c, 0x79, 0x50, 0x72, 0x69, 0x63, diff --git a/pkg/rpc/pb/service_server_bill.pb.go b/pkg/rpc/pb/service_server_bill.pb.go new file mode 100644 index 0000000..33395f0 --- /dev/null +++ b/pkg/rpc/pb/service_server_bill.pb.go @@ -0,0 +1,463 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: service_server_bill.proto + +package pb + +import ( + context "context" + proto "github.com/golang/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +// 查询服务账单数量 +type CountAllServerBillsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"` + Month string `protobuf:"bytes,2,opt,name=month,proto3" json:"month,omitempty"` +} + +func (x *CountAllServerBillsRequest) Reset() { + *x = CountAllServerBillsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_server_bill_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CountAllServerBillsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CountAllServerBillsRequest) ProtoMessage() {} + +func (x *CountAllServerBillsRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_server_bill_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CountAllServerBillsRequest.ProtoReflect.Descriptor instead. +func (*CountAllServerBillsRequest) Descriptor() ([]byte, []int) { + return file_service_server_bill_proto_rawDescGZIP(), []int{0} +} + +func (x *CountAllServerBillsRequest) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *CountAllServerBillsRequest) GetMonth() string { + if x != nil { + return x.Month + } + return "" +} + +// 查询服务账单列表 +type ListServerBillsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"` + Month string `protobuf:"bytes,2,opt,name=month,proto3" json:"month,omitempty"` + Offset int64 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"` + Size int64 `protobuf:"varint,4,opt,name=size,proto3" json:"size,omitempty"` +} + +func (x *ListServerBillsRequest) Reset() { + *x = ListServerBillsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_server_bill_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListServerBillsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListServerBillsRequest) ProtoMessage() {} + +func (x *ListServerBillsRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_server_bill_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListServerBillsRequest.ProtoReflect.Descriptor instead. +func (*ListServerBillsRequest) Descriptor() ([]byte, []int) { + return file_service_server_bill_proto_rawDescGZIP(), []int{1} +} + +func (x *ListServerBillsRequest) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *ListServerBillsRequest) GetMonth() string { + if x != nil { + return x.Month + } + return "" +} + +func (x *ListServerBillsRequest) GetOffset() int64 { + if x != nil { + return x.Offset + } + return 0 +} + +func (x *ListServerBillsRequest) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +type ListServerBillsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServerBills []*ServerBill `protobuf:"bytes,1,rep,name=serverBills,proto3" json:"serverBills,omitempty"` +} + +func (x *ListServerBillsResponse) Reset() { + *x = ListServerBillsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_server_bill_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListServerBillsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListServerBillsResponse) ProtoMessage() {} + +func (x *ListServerBillsResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_server_bill_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListServerBillsResponse.ProtoReflect.Descriptor instead. +func (*ListServerBillsResponse) Descriptor() ([]byte, []int) { + return file_service_server_bill_proto_rawDescGZIP(), []int{2} +} + +func (x *ListServerBillsResponse) GetServerBills() []*ServerBill { + if x != nil { + return x.ServerBills + } + return nil +} + +var File_service_server_bill_proto protoreflect.FileDescriptor + +var file_service_server_bill_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x5f, 0x62, 0x69, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, + 0x1e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x5f, 0x62, 0x69, 0x6c, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x19, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x72, 0x70, 0x63, 0x5f, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x4a, 0x0a, 0x1a, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x42, 0x69, 0x6c, 0x6c, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, + 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, + 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x22, 0x72, 0x0a, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x42, 0x69, 0x6c, 0x6c, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x6f, 0x6e, 0x74, + 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6d, 0x6f, 0x6e, 0x74, 0x68, 0x12, 0x16, + 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x4b, 0x0a, 0x17, 0x4c, 0x69, + 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x42, 0x69, 0x6c, 0x6c, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x42, + 0x69, 0x6c, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x42, 0x69, 0x6c, 0x6c, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x42, 0x69, 0x6c, 0x6c, 0x73, 0x32, 0xac, 0x01, 0x0a, 0x11, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x42, 0x69, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4b, 0x0a, + 0x13, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x42, + 0x69, 0x6c, 0x6c, 0x73, 0x12, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41, + 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x42, 0x69, 0x6c, 0x6c, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x0f, 0x6c, 0x69, + 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x42, 0x69, 0x6c, 0x6c, 0x73, 0x12, 0x1a, 0x2e, + 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x42, 0x69, 0x6c, + 0x6c, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x42, 0x69, 0x6c, 0x6c, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_service_server_bill_proto_rawDescOnce sync.Once + file_service_server_bill_proto_rawDescData = file_service_server_bill_proto_rawDesc +) + +func file_service_server_bill_proto_rawDescGZIP() []byte { + file_service_server_bill_proto_rawDescOnce.Do(func() { + file_service_server_bill_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_server_bill_proto_rawDescData) + }) + return file_service_server_bill_proto_rawDescData +} + +var file_service_server_bill_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_service_server_bill_proto_goTypes = []interface{}{ + (*CountAllServerBillsRequest)(nil), // 0: pb.CountAllServerBillsRequest + (*ListServerBillsRequest)(nil), // 1: pb.ListServerBillsRequest + (*ListServerBillsResponse)(nil), // 2: pb.ListServerBillsResponse + (*ServerBill)(nil), // 3: pb.ServerBill + (*RPCCountResponse)(nil), // 4: pb.RPCCountResponse +} +var file_service_server_bill_proto_depIdxs = []int32{ + 3, // 0: pb.ListServerBillsResponse.serverBills:type_name -> pb.ServerBill + 0, // 1: pb.ServerBillService.countAllServerBills:input_type -> pb.CountAllServerBillsRequest + 1, // 2: pb.ServerBillService.listServerBills:input_type -> pb.ListServerBillsRequest + 4, // 3: pb.ServerBillService.countAllServerBills:output_type -> pb.RPCCountResponse + 2, // 4: pb.ServerBillService.listServerBills:output_type -> pb.ListServerBillsResponse + 3, // [3:5] is the sub-list for method output_type + 1, // [1:3] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_service_server_bill_proto_init() } +func file_service_server_bill_proto_init() { + if File_service_server_bill_proto != nil { + return + } + file_models_model_server_bill_proto_init() + file_models_rpc_messages_proto_init() + if !protoimpl.UnsafeEnabled { + file_service_server_bill_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CountAllServerBillsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_server_bill_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListServerBillsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_server_bill_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListServerBillsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_service_server_bill_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_service_server_bill_proto_goTypes, + DependencyIndexes: file_service_server_bill_proto_depIdxs, + MessageInfos: file_service_server_bill_proto_msgTypes, + }.Build() + File_service_server_bill_proto = out.File + file_service_server_bill_proto_rawDesc = nil + file_service_server_bill_proto_goTypes = nil + file_service_server_bill_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// ServerBillServiceClient is the client API for ServerBillService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type ServerBillServiceClient interface { + // 查询服务账单数量 + CountAllServerBills(ctx context.Context, in *CountAllServerBillsRequest, opts ...grpc.CallOption) (*RPCCountResponse, error) + // 查询服务账单列表 + ListServerBills(ctx context.Context, in *ListServerBillsRequest, opts ...grpc.CallOption) (*ListServerBillsResponse, error) +} + +type serverBillServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewServerBillServiceClient(cc grpc.ClientConnInterface) ServerBillServiceClient { + return &serverBillServiceClient{cc} +} + +func (c *serverBillServiceClient) CountAllServerBills(ctx context.Context, in *CountAllServerBillsRequest, opts ...grpc.CallOption) (*RPCCountResponse, error) { + out := new(RPCCountResponse) + err := c.cc.Invoke(ctx, "/pb.ServerBillService/countAllServerBills", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serverBillServiceClient) ListServerBills(ctx context.Context, in *ListServerBillsRequest, opts ...grpc.CallOption) (*ListServerBillsResponse, error) { + out := new(ListServerBillsResponse) + err := c.cc.Invoke(ctx, "/pb.ServerBillService/listServerBills", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ServerBillServiceServer is the server API for ServerBillService service. +type ServerBillServiceServer interface { + // 查询服务账单数量 + CountAllServerBills(context.Context, *CountAllServerBillsRequest) (*RPCCountResponse, error) + // 查询服务账单列表 + ListServerBills(context.Context, *ListServerBillsRequest) (*ListServerBillsResponse, error) +} + +// UnimplementedServerBillServiceServer can be embedded to have forward compatible implementations. +type UnimplementedServerBillServiceServer struct { +} + +func (*UnimplementedServerBillServiceServer) CountAllServerBills(context.Context, *CountAllServerBillsRequest) (*RPCCountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CountAllServerBills not implemented") +} +func (*UnimplementedServerBillServiceServer) ListServerBills(context.Context, *ListServerBillsRequest) (*ListServerBillsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListServerBills not implemented") +} + +func RegisterServerBillServiceServer(s *grpc.Server, srv ServerBillServiceServer) { + s.RegisterService(&_ServerBillService_serviceDesc, srv) +} + +func _ServerBillService_CountAllServerBills_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CountAllServerBillsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServerBillServiceServer).CountAllServerBills(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.ServerBillService/CountAllServerBills", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServerBillServiceServer).CountAllServerBills(ctx, req.(*CountAllServerBillsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ServerBillService_ListServerBills_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListServerBillsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServerBillServiceServer).ListServerBills(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.ServerBillService/ListServerBills", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServerBillServiceServer).ListServerBills(ctx, req.(*ListServerBillsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _ServerBillService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "pb.ServerBillService", + HandlerType: (*ServerBillServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "countAllServerBills", + Handler: _ServerBillService_CountAllServerBills_Handler, + }, + { + MethodName: "listServerBills", + Handler: _ServerBillService_ListServerBills_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "service_server_bill.proto", +} diff --git a/pkg/rpc/protos/models/model_plan.proto b/pkg/rpc/protos/models/model_plan.proto index 2dd62eb..8766a0d 100644 --- a/pkg/rpc/protos/models/model_plan.proto +++ b/pkg/rpc/protos/models/model_plan.proto @@ -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; diff --git a/pkg/rpc/protos/models/model_server_bill.proto b/pkg/rpc/protos/models/model_server_bill.proto new file mode 100644 index 0000000..89ecd00 --- /dev/null +++ b/pkg/rpc/protos/models/model_server_bill.proto @@ -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; +} \ No newline at end of file diff --git a/pkg/rpc/protos/models/model_user.proto b/pkg/rpc/protos/models/model_user.proto index d9bbe2e..47358e3 100644 --- a/pkg/rpc/protos/models/model_user.proto +++ b/pkg/rpc/protos/models/model_user.proto @@ -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; diff --git a/pkg/rpc/protos/models/model_user_bill.proto b/pkg/rpc/protos/models/model_user_bill.proto index e1f1a19..083fdb2 100644 --- a/pkg/rpc/protos/models/model_user_bill.proto +++ b/pkg/rpc/protos/models/model_user_bill.proto @@ -16,4 +16,5 @@ message UserBill { bool isPaid = 8; int64 paidAt = 9; string code = 10; + bool canPay = 11; } \ No newline at end of file diff --git a/pkg/rpc/protos/service_plan.proto b/pkg/rpc/protos/service_plan.proto index 89ef968..4dbc28c 100644 --- a/pkg/rpc/protos/service_plan.proto +++ b/pkg/rpc/protos/service_plan.proto @@ -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; diff --git a/pkg/rpc/protos/service_server_bill.proto b/pkg/rpc/protos/service_server_bill.proto new file mode 100644 index 0000000..b833638 --- /dev/null +++ b/pkg/rpc/protos/service_server_bill.proto @@ -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; +} \ No newline at end of file diff --git a/pkg/serverconfigs/plan_price_types.go b/pkg/serverconfigs/plan_price_types.go index 946a0b5..91cce30 100644 --- a/pkg/serverconfigs/plan_price_types.go +++ b/pkg/serverconfigs/plan_price_types.go @@ -2,23 +2,83 @@ package serverconfigs +// PlanPriceType 套餐类型 type PlanPriceType = string const ( - PlanPriceTypeTraffic PlanPriceType = "traffic" - PlanPriceTypePeriod PlanPriceType = "period" + PlanPriceTypeTraffic PlanPriceType = "traffic" // 流量 + PlanPriceTypePeriod PlanPriceType = "period" // 周期 + PlanPriceTypeBandwidth PlanPriceType = "bandwidth" // 百分位 ) func FindPlanPriceTypeName(priceType PlanPriceType) string { switch priceType { case PlanPriceTypeTraffic: - return "带宽用量" + return "流量" case PlanPriceTypePeriod: return "时间周期" + case PlanPriceTypeBandwidth: + return "带宽" } return "" } -type PlanTrafficPrice struct { +// PlanTrafficPriceConfig 按流量计费价格配置 +type PlanTrafficPriceConfig struct { Base float32 `yaml:"base" json:"base"` // 基础价格,单位是 元/GB } + +// PlanBandwidthPriceConfig 按百分位带宽计费配置 +type PlanBandwidthPriceConfig struct { + Percentile int `yaml:"percentile" json:"percentile"` // 百分位 + Ranges []*PlanBandwidthPriceRangeConfig `yaml:"ranges" json:"ranges"` +} + +func (this *PlanBandwidthPriceConfig) LookupRange(sizeMB float32) *PlanBandwidthPriceRangeConfig { + if len(this.Ranges) == 0 { + return nil + } + for _, r := range this.Ranges { + if sizeMB >= r.MinMB && (r.MaxMB <= 0 || r.MaxMB >= sizeMB) { + return r + } + } + + // 寻找最接近的 + for index, r := range this.Ranges { + if r.MinMB >= sizeMB { + if index > 0 { + return this.Ranges[index-1] + } + return r + } + } + + for _, r := range this.Ranges { + if r.MaxMB <= 0 || r.MaxMB >= sizeMB { + return r + } + } + + // 获取最大值 + return this.Ranges[len(this.Ranges)-1] +} + +func (this *PlanBandwidthPriceConfig) LookupPrice(sizeMB float32) float32 { + var r = this.LookupRange(sizeMB) + if r == nil { + return 0 + } + + if r.TotalPrice > 0 { + return r.TotalPrice + } + return r.PricePerMB * sizeMB +} + +type PlanBandwidthPriceRangeConfig struct { + MinMB float32 `yaml:"minMB" json:"minMB"` + MaxMB float32 `yaml:"maxMB" json:"maxMB"` + PricePerMB float32 `yaml:"pricePerMB" json:"pricePerMB"` // 单位价格,元/MB + TotalPrice float32 `yaml:"totalPrice" json:"totalPrice"` // 总价格 +} diff --git a/pkg/serverconfigs/plan_price_types_test.go b/pkg/serverconfigs/plan_price_types_test.go new file mode 100644 index 0000000..3e3d2b8 --- /dev/null +++ b/pkg/serverconfigs/plan_price_types_test.go @@ -0,0 +1,41 @@ +// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. + +package serverconfigs_test + +import ( + "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" + "testing" +) + +func TestPlanBandwidthPriceConfig_Lookup(t *testing.T) { + { + var config = &serverconfigs.PlanBandwidthPriceConfig{} + t.Log(config.LookupRange(1)) + } + + { + var config = &serverconfigs.PlanBandwidthPriceConfig{ + Ranges: []*serverconfigs.PlanBandwidthPriceRangeConfig{ + { + MinMB: 1, + MaxMB: 1.5, + }, + { + MinMB: 1.5, + MaxMB: 2, + }, + { + MinMB: 5, + MaxMB: 10, + }, + { + MinMB: 20, + MaxMB: 100, + }, + }, + } + for _, mb := range []float32{0.5, 1, 3, 5, 7, 20, 50, 1000} { + t.Log(mb, config.LookupRange(mb)) + } + } +}