mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-07 23:30:25 +08:00
支持默认价格设置
This commit is contained in:
@@ -40,6 +40,7 @@ type ServerBill struct {
|
|||||||
TotalTrafficBytes int64 `protobuf:"varint,8,opt,name=totalTrafficBytes,proto3" json:"totalTrafficBytes,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"`
|
BandwidthPercentileBytes int64 `protobuf:"varint,9,opt,name=bandwidthPercentileBytes,proto3" json:"bandwidthPercentileBytes,omitempty"`
|
||||||
BandwidthPercentile int32 `protobuf:"varint,10,opt,name=bandwidthPercentile,proto3" json:"bandwidthPercentile,omitempty"`
|
BandwidthPercentile int32 `protobuf:"varint,10,opt,name=bandwidthPercentile,proto3" json:"bandwidthPercentile,omitempty"`
|
||||||
|
PriceType string `protobuf:"bytes,11,opt,name=priceType,proto3" json:"priceType,omitempty"`
|
||||||
UserPlan *UserPlan `protobuf:"bytes,30,opt,name=userPlan,proto3" json:"userPlan,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"`
|
Plan *Plan `protobuf:"bytes,31,opt,name=plan,proto3" json:"plan,omitempty"`
|
||||||
User *User `protobuf:"bytes,32,opt,name=user,proto3" json:"user,omitempty"`
|
User *User `protobuf:"bytes,32,opt,name=user,proto3" json:"user,omitempty"`
|
||||||
@@ -148,6 +149,13 @@ func (x *ServerBill) GetBandwidthPercentile() int32 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *ServerBill) GetPriceType() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.PriceType
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (x *ServerBill) GetUserPlan() *UserPlan {
|
func (x *ServerBill) GetUserPlan() *UserPlan {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.UserPlan
|
return x.UserPlan
|
||||||
@@ -188,7 +196,7 @@ var file_models_model_server_bill_proto_rawDesc = []byte{
|
|||||||
0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70,
|
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,
|
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,
|
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,
|
0x82, 0x04, 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, 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,
|
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,
|
0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
|
||||||
@@ -209,17 +217,19 @@ var file_models_model_server_bill_proto_rawDesc = []byte{
|
|||||||
0x6e, 0x74, 0x69, 0x6c, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x30, 0x0a, 0x13, 0x62, 0x61,
|
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,
|
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,
|
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,
|
0x74, 0x68, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09,
|
||||||
0x75, 0x73, 0x65, 0x72, 0x50, 0x6c, 0x61, 0x6e, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c,
|
0x70, 0x72, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x50, 0x6c, 0x61, 0x6e, 0x52, 0x08, 0x75, 0x73,
|
0x09, 0x70, 0x72, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x28, 0x0a, 0x08, 0x75, 0x73,
|
||||||
0x65, 0x72, 0x50, 0x6c, 0x61, 0x6e, 0x12, 0x1c, 0x0a, 0x04, 0x70, 0x6c, 0x61, 0x6e, 0x18, 0x1f,
|
0x65, 0x72, 0x50, 0x6c, 0x61, 0x6e, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70,
|
||||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x6c, 0x61, 0x6e, 0x52, 0x04,
|
0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x50, 0x6c, 0x61, 0x6e, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72,
|
||||||
0x70, 0x6c, 0x61, 0x6e, 0x12, 0x1c, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x20, 0x20, 0x01,
|
0x50, 0x6c, 0x61, 0x6e, 0x12, 0x1c, 0x0a, 0x04, 0x70, 0x6c, 0x61, 0x6e, 0x18, 0x1f, 0x20, 0x01,
|
||||||
0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73,
|
0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x6c, 0x61, 0x6e, 0x52, 0x04, 0x70, 0x6c,
|
||||||
0x65, 0x72, 0x12, 0x22, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x21, 0x20, 0x01,
|
0x61, 0x6e, 0x12, 0x1c, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x20, 0x20, 0x01, 0x28, 0x0b,
|
||||||
0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06,
|
0x32, 0x08, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72,
|
||||||
0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06,
|
0x12, 0x22, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x21, 0x20, 0x01, 0x28, 0x0b,
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
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 (
|
var (
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ message ServerBill {
|
|||||||
int64 totalTrafficBytes = 8;
|
int64 totalTrafficBytes = 8;
|
||||||
int64 bandwidthPercentileBytes = 9;
|
int64 bandwidthPercentileBytes = 9;
|
||||||
int32 bandwidthPercentile = 10;
|
int32 bandwidthPercentile = 10;
|
||||||
|
string priceType = 11;
|
||||||
|
|
||||||
UserPlan userPlan = 30;
|
UserPlan userPlan = 30;
|
||||||
Plan plan = 31;
|
Plan plan = 31;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ const (
|
|||||||
SettingCodeUserUIConfig SettingCode = "userUIConfig" // 用户界面配置
|
SettingCodeUserUIConfig SettingCode = "userUIConfig" // 用户界面配置
|
||||||
SettingCodeUserRegisterConfig SettingCode = "userRegisterConfig" // 用户注册配置
|
SettingCodeUserRegisterConfig SettingCode = "userRegisterConfig" // 用户注册配置
|
||||||
SettingCodeUserServerConfig SettingCode = "userServerConfig" // 用户服务设置
|
SettingCodeUserServerConfig SettingCode = "userServerConfig" // 用户服务设置
|
||||||
|
SettingCodeUserFinanceConfig SettingCode = "userFinanceConfig" // 用户财务设置
|
||||||
|
|
||||||
SettingCodeNSAccessLogSetting SettingCode = "nsAccessLogSetting" // NS相关全局配置
|
SettingCodeNSAccessLogSetting SettingCode = "nsAccessLogSetting" // NS相关全局配置
|
||||||
SettingCodeNSNodeMonitor SettingCode = "nsNodeMonitor" // 监控NS节点状态
|
SettingCodeNSNodeMonitor SettingCode = "nsNodeMonitor" // 监控NS节点状态
|
||||||
|
|||||||
19
pkg/userconfigs/user_finance_config.go
Normal file
19
pkg/userconfigs/user_finance_config.go
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||||
|
|
||||||
|
package userconfigs
|
||||||
|
|
||||||
|
import "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||||
|
|
||||||
|
// UserFinanceConfig 财务相关设置
|
||||||
|
type UserFinanceConfig struct {
|
||||||
|
IsOn bool `yaml:"isOn" json:"isOn"`
|
||||||
|
PriceType serverconfigs.PlanPriceType `yaml:"priceType" json:"priceType"`
|
||||||
|
TrafficPriceConfig *serverconfigs.PlanTrafficPriceConfig `yaml:"trafficPrice" json:"trafficPrice"`
|
||||||
|
BandwidthPriceConfig *serverconfigs.PlanBandwidthPriceConfig `yaml:"bandwidthPrice" json:"bandwidthPrice"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func DefaultUserFinanceConfig() *UserFinanceConfig {
|
||||||
|
return &UserFinanceConfig{
|
||||||
|
PriceType: serverconfigs.PlanPriceTypeBandwidth,
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user