fix(distribution): 修正分销模式判定与结算入账,冻结未确认分成

按买卖站点纯函数判定五种模式,分站卖主站货命中 two_party_platform_receive。
结算批次只收本站 site party,平台分成不再进入分销钱包;生产环境冻结结算入账与站点提现。
This commit is contained in:
yml2213
2026-09-08 16:52:09 +08:00
parent 2c4e87475a
commit 8521bf4753
8 changed files with 662 additions and 160 deletions
@@ -9,6 +9,11 @@ const (
ModeTwoPartyDistributorReceive = "two_party_distributor_receive"
ModeTwoPartyPlatformReceive = "two_party_platform_receive"
ModeThreeParty = "three_party"
// ModeSiteSelfSell 是分站卖本站货,不复用两方默认规则。
ModeSiteSelfSell = "site_self_sell"
PartyTypeSite = "site"
PartyTypePlatform = "platform"
ServiceFeeUnitPercent = "percent"
ServiceFeeUnitFixedAmount = "fixed_amount"
@@ -70,7 +75,8 @@ type SettlementResult struct {
TaxByParty []PartyTaxResult
}
// DefaultRule 返回文档中约定的第一版默认值;调用方应将其写入规则表而非写死到业务流程。
// DefaultRule 返回文档中的第一版占位值,仅供对照,禁止当作已手算确认的生效分成。
// 本站自卖没有默认比例,必须单独配置。
func DefaultRule(mode string) (Rule, error) {
base := Rule{
Mode: mode, ServiceFeeValue: 2.5, ServiceFeeUnit: ServiceFeeUnitRatio,
@@ -86,6 +92,8 @@ func DefaultRule(mode string) (Rule, error) {
case ModeThreeParty:
base.DistributorARatio = 3.5
base.DistributorBRatio = 4
case ModeSiteSelfSell:
return Rule{}, ErrUnsupportedMode
default:
return Rule{}, ErrUnsupportedMode
}