refactor(distribution): 重写分销迁移并落地利润百分比分成与货架比例

将 000064-000078 合并为 064/065/066,默认规则改为收号 35%、卖出 40%、服务费 25%。
货架调价改为增加分站 1 元兑换哈夫币比例。sql-guard 仅保护 main 已发布迁移。
This commit is contained in:
yml2213
2026-09-08 19:02:58 +08:00
parent 48a2961245
commit d762b33f54
48 changed files with 745 additions and 1073 deletions
@@ -118,19 +118,19 @@ func TestBuildOrderPricingDoesNotDiscountAllExtraItemOrder(t *testing.T) {
}
}
func TestCheckoutDoesNotRefundShelfMarkup(t *testing.T) {
func TestCheckoutRefundsSiteRent(t *testing.T) {
order := model.RentalOrder{
RentAmountCent: 20000,
RentAmountCent: 8000,
OwnerRentAmountCent: 8000,
PlatformFeeCent: 2000,
PlatformFeeCent: 0,
BasePriceCent: 10000,
ShelfMarkupCent: 10000,
ShelfRatioDelta: 25,
DepositAmountCent: 1000,
AccountSnapshot: datatypes.JSON([]byte(`{
"haf_coin_amount": 100000000,
"asset_summary": {
"price_breakdown": {
"buyer_coin_base_price": 100,
"buyer_coin_base_price": 80,
"seller_coin_base_price": 80,
"consumable_price": 0
}
@@ -139,11 +139,11 @@ func TestCheckoutDoesNotRefundShelfMarkup(t *testing.T) {
}
settlement := calculateCheckoutSettlement(order, 0, 100, 0)
if settlement.RentRefundCent != 0 {
t.Fatalf("full consume must not refund shelf markup, rent refund = %d", settlement.RentRefundCent)
t.Fatalf("full consume must not refund rent, rent refund = %d", settlement.RentRefundCent)
}
zeroUse := calculateCheckoutSettlement(order, 0, 0, 0)
if zeroUse.RentRefundCent != 10000 {
t.Fatalf("unused listing refunds base price only, got %d want 10000", zeroUse.RentRefundCent)
if zeroUse.RentRefundCent != 8000 {
t.Fatalf("unused listing refunds site rent, got %d want 8000", zeroUse.RentRefundCent)
}
}