fix(distribution): 分成改为分主站提价利润,分站自主提价溢价全额归卖方

- 文档:升级至 v0.7,固化号主保底、主站提价利润分账(35/40/25)与分站加价溢价独享逻辑
- 定价:修正货架兑换比例调价方向为调减比例提价(site_ratio = base_ratio - delta)
- 分账:分成基数剔除号主成本与分站加价,提价利润按规则切分,分站自主加价溢价 100% 归卖出方
- 前端:更新分销后台提价说明文案,提示调减比例提高售价且溢价归本站
This commit is contained in:
yml2213
2026-09-08 19:45:05 +08:00
parent d762b33f54
commit 4aab9e7e33
11 changed files with 176 additions and 132 deletions
@@ -13,7 +13,9 @@ func BaseExchangeRatio(hafCoinAmount, priceCent int64) float64 {
return roundRatio(CoinWan(hafCoinAmount) / centToYuan(priceCent))
}
// ApplyShelfRatio 按分站加价比例重算售价。delta=0 时保持原价,避免四舍五入漂移。
// ApplyShelfRatio 按分站加价比例重算售价。
// 在「1 元兑换多少万哈夫币」的比例机制下:比例越小,售价越高(提价);比例越大,售价越低(打折)。
// 分站货架自主提价应调小兑换比例(siteRatio = baseRatio - ratioDelta),使分站售价高于主站基准价。
func ApplyShelfRatio(hafCoinAmount, basePriceCent int64, ratioDelta float64) (priceCent int64, baseRatio, siteRatio float64) {
baseRatio = BaseExchangeRatio(hafCoinAmount, basePriceCent)
if ratioDelta < 0 {
@@ -22,13 +24,13 @@ func ApplyShelfRatio(hafCoinAmount, basePriceCent int64, ratioDelta float64) (pr
if baseRatio <= 0 || ratioDelta == 0 {
return basePriceCent, baseRatio, baseRatio
}
siteRatio = roundRatio(baseRatio + ratioDelta)
if siteRatio <= 0 {
return basePriceCent, baseRatio, baseRatio
siteRatio = roundRatio(baseRatio - ratioDelta)
if siteRatio <= 0.01 {
siteRatio = 0.01
}
priceCent = yuanToCent(CoinWan(hafCoinAmount) / siteRatio)
if priceCent < 0 {
priceCent = 0
if priceCent < basePriceCent {
priceCent = basePriceCent
}
return priceCent, baseRatio, siteRatio
}