feat(distribution): 补齐退款加价回退、本站自卖与开通默认规则

退款时压缩卖方加价,人工/自动批次仅完结单可入账,号主收入进主站钱包;仲裁后重算释放并支持作废未入账 DS。开通时四种模式按默认生效,对外口径合并为 35/40/25,不再单独展示通道费。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
yml2213
2026-09-10 18:13:46 +08:00
co-authored by Cursor
parent e621722218
commit 768902f2f7
28 changed files with 627 additions and 263 deletions
@@ -19,16 +19,13 @@ func TestOnboardSiteAndLoginFlow(t *testing.T) {
// 1. Onboard new site
req := OnboardSiteRequest{
SiteCode: "gz_dist",
SiteName: "广州分销站",
Domain: "gz.distribution.com",
AdminUsername: "gz_operator",
AdminPassword: "Password123!",
AdminNickname: "广州运营小李",
MemberType: "operator",
DistributorReceiveRatio: 3.8,
PlatformSellRatio: 4.2,
ServiceFeeValue: 2.0,
SiteCode: "gz_dist",
SiteName: "广州分销站",
Domain: "gz.distribution.com",
AdminUsername: "gz_operator",
AdminPassword: "Password123!",
AdminNickname: "广州运营小李",
MemberType: "operator",
}
resp, err := svc.OnboardSite(ctx, req)
@@ -48,11 +45,11 @@ func TestOnboardSiteAndLoginFlow(t *testing.T) {
if resp.Member.SiteID == nil || *resp.Member.SiteID != resp.Site.ID {
t.Fatalf("expected SiteID=%d, got %v", resp.Site.ID, resp.Member.SiteID)
}
if resp.Rule.DistributorReceiveRatio != 38 {
t.Fatalf("expected rule percent 38, got %f", resp.Rule.DistributorReceiveRatio)
if resp.Rule.DistributorReceiveRatio != 35 || resp.Rule.PlatformSellRatio != 40 || resp.Rule.ServiceFeeValue != 25 {
t.Fatalf("expected default 35/40/25, got %+v", resp.Rule)
}
if resp.Rule.Status != "draft" {
t.Fatalf("onboard rule must stay draft until split is verified, got %s", resp.Rule.Status)
if resp.Rule.Status != "active" {
t.Fatalf("onboard rules should be active by default, got %s", resp.Rule.Status)
}
// 2. Duplicate site code or domain check