增加出售设置
This commit is contained in:
@@ -52,6 +52,7 @@ type PublishOptionsDTO struct {
|
||||
FireLevelMin int `json:"fire_level_min"`
|
||||
PriceConfig PublishPriceConfig `json:"price_config"`
|
||||
RatioConfig PublishRatioConfig `json:"ratio_config"`
|
||||
SalePriceConfig PublishSalePriceConfig `json:"sale_price_config"`
|
||||
}
|
||||
|
||||
type PublishOptionGroup struct {
|
||||
@@ -103,3 +104,20 @@ type PublishCoinCorrection struct {
|
||||
ThresholdM float64 `json:"threshold_m"`
|
||||
Correction float64 `json:"correction"`
|
||||
}
|
||||
|
||||
type PublishSalePriceConfig struct {
|
||||
FixedMarkupRules []PublishSaleFixedMarkupRule `json:"fixed_markup_rules"`
|
||||
RatioAdjustmentRules []PublishSaleRatioAdjustmentRule `json:"ratio_adjustment_rules"`
|
||||
}
|
||||
|
||||
type PublishSaleFixedMarkupRule struct {
|
||||
MinM float64 `json:"min_m"`
|
||||
MaxM float64 `json:"max_m"`
|
||||
MarkupAmount float64 `json:"markup_amount"`
|
||||
}
|
||||
|
||||
type PublishSaleRatioAdjustmentRule struct {
|
||||
MinM float64 `json:"min_m"`
|
||||
MaxM float64 `json:"max_m,omitempty"`
|
||||
RatioSubtract float64 `json:"ratio_subtract"`
|
||||
}
|
||||
|
||||
@@ -108,5 +108,22 @@ func DefaultPublishOptions() PublishOptionsDTO {
|
||||
{ThresholdM: 530, Correction: 5},
|
||||
},
|
||||
},
|
||||
SalePriceConfig: PublishSalePriceConfig{
|
||||
FixedMarkupRules: []PublishSaleFixedMarkupRule{
|
||||
{MinM: 10, MaxM: 30, MarkupAmount: 28},
|
||||
{MinM: 30, MaxM: 50, MarkupAmount: 31},
|
||||
{MinM: 50, MaxM: 70, MarkupAmount: 34},
|
||||
{MinM: 70, MaxM: 90, MarkupAmount: 38},
|
||||
},
|
||||
RatioAdjustmentRules: []PublishSaleRatioAdjustmentRule{
|
||||
{MinM: 90, MaxM: 150, RatioSubtract: 5},
|
||||
{MinM: 150, MaxM: 230, RatioSubtract: 4},
|
||||
{MinM: 230, MaxM: 310, RatioSubtract: 3.5},
|
||||
{MinM: 310, MaxM: 390, RatioSubtract: 3},
|
||||
{MinM: 390, MaxM: 470, RatioSubtract: 0},
|
||||
{MinM: 470, MaxM: 550, RatioSubtract: 0},
|
||||
{MinM: 550, RatioSubtract: 0},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,4 +214,10 @@ func normalizePublishOptions(options *PublishOptionsDTO) {
|
||||
if len(options.RatioConfig.CoinCorrections) == 0 {
|
||||
options.RatioConfig.CoinCorrections = defaults.RatioConfig.CoinCorrections
|
||||
}
|
||||
if len(options.SalePriceConfig.FixedMarkupRules) == 0 {
|
||||
options.SalePriceConfig.FixedMarkupRules = defaults.SalePriceConfig.FixedMarkupRules
|
||||
}
|
||||
if len(options.SalePriceConfig.RatioAdjustmentRules) == 0 {
|
||||
options.SalePriceConfig.RatioAdjustmentRules = defaults.SalePriceConfig.RatioAdjustmentRules
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user