refactor(distribution): 重写分销迁移并落地利润百分比分成与货架比例
将 000064-000078 合并为 064/065/066,默认规则改为收号 35%、卖出 40%、服务费 25%。 货架调价改为增加分站 1 元兑换哈夫币比例。sql-guard 仅保护 main 已发布迁移。
This commit is contained in:
@@ -548,31 +548,31 @@ func TestDistributionBrandingAndMarkup(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
display, err := repo.UpdateAccountMarkup(t.Context(), 0, dsa.ID, 500)
|
||||
display, err := repo.UpdateAccountMarkup(t.Context(), 0, dsa.ID, 5)
|
||||
if err != nil {
|
||||
t.Fatalf("UpdateAccountMarkup failed: %v", err)
|
||||
}
|
||||
if display.MarkupAmountCent != 500 {
|
||||
t.Fatalf("expected markup 500, got %d", display.MarkupAmountCent)
|
||||
if display.ShelfRatioDelta != 5 {
|
||||
t.Fatalf("expected shelf ratio delta 5, got %v", display.ShelfRatioDelta)
|
||||
}
|
||||
|
||||
// Batch update markup
|
||||
if err := repo.BatchUpdateAccountMarkup(t.Context(), 0, site.ID, BatchUpdateAccountMarkupRequest{
|
||||
ListingIDs: nil,
|
||||
MarkupAmountCent: 800,
|
||||
ListingIDs: nil,
|
||||
ShelfRatioDelta: 8,
|
||||
}); !errors.Is(err, ErrEmptyListingIDs) {
|
||||
t.Fatalf("empty listing_ids err = %v", err)
|
||||
}
|
||||
if err := repo.BatchUpdateAccountMarkup(t.Context(), 0, site.ID, BatchUpdateAccountMarkupRequest{
|
||||
ListingIDs: []uint64{201},
|
||||
MarkupAmountCent: 800,
|
||||
ListingIDs: []uint64{201},
|
||||
ShelfRatioDelta: 8,
|
||||
}); err != nil {
|
||||
t.Fatalf("BatchUpdateAccountMarkup failed: %v", err)
|
||||
}
|
||||
|
||||
displays, err := repo.ListAccountDisplays(t.Context(), site.ID, "")
|
||||
if err != nil || len(displays) == 0 || displays[0].MarkupAmountCent != 800 {
|
||||
t.Fatalf("expected markup 800 after batch, got: %+v", displays)
|
||||
if err != nil || len(displays) == 0 || displays[0].ShelfRatioDelta != 8 {
|
||||
t.Fatalf("expected shelf ratio delta 8 after batch, got: %+v", displays)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user