diff --git a/cmd/channel_http_test.go b/cmd/channel_http_test.go index ba94501..aa799d9 100644 --- a/cmd/channel_http_test.go +++ b/cmd/channel_http_test.go @@ -126,10 +126,17 @@ func TestChannelHTTPListsMetricsOptionsAndAtomicCreation(t *testing.T) { t.Fatal("主渠道不见了") return nil } - row := rootRow(list(8, "", 2)) - if row["gameCount"] != float64(1) || row["playerCount"] != float64(1) || row["totalPayAmount"] != "30.30" || row["busierDisplayName"] != "sdk-account(leaf)" { + firstPage := list(8, "", 2) + row := rootRow(firstPage) + if row["gameCount"] != float64(1) || row["playerCount"] != float64(1) || row["totalPayAmount"] != "30.30" || row["busierDisplayName"] != "sdk-account(leaf)" || row["parentName"] != "" { t.Fatalf("默认偏好或展示字段错误: %+v", row) } + for _, raw := range firstPage["rows"].([]any) { + child := raw.(map[string]any) + if child["id"] == "101" && child["parentName"] != "main-channel" { + t.Fatalf("父级名称应保留渠道原始值: %+v", child) + } + } if err := db.Exec("INSERT INTO sys_user_preference(user_id,include_sub_promote,idcard_dedup) VALUES(8,1,0)").Error; err != nil { t.Fatal(err) } diff --git a/internal/biz/business/channel.go b/internal/biz/business/channel.go index b1c4e52..c136422 100644 --- a/internal/biz/business/channel.go +++ b/internal/biz/business/channel.go @@ -61,12 +61,6 @@ func (c *Channel) BusinessDisplayName() string { } func (c *Channel) ParentDisplayName() string { - if c.Level != nil && *c.Level == 1 { - if len(c.BusinessPath) > 0 { - return c.BusinessPath[len(c.BusinessPath)-1] - } - return c.BusinessDisplayName() - } return c.ParentName } diff --git a/internal/service/business/channel_portrait_test.go b/internal/service/business/channel_portrait_test.go index a01177e..0a00a15 100644 --- a/internal/service/business/channel_portrait_test.go +++ b/internal/service/business/channel_portrait_test.go @@ -27,7 +27,7 @@ func TestChannelPortraitKeepsContactAndCooperationStatusSeparateFromAudit(t *tes t.Fatal(err) } b := result.Basic - if b.LockStatusLabel != sample.label || b.StatusLabel != "正常" || b.Phone != channel.Phone || b.SettlementDays == nil || *b.SettlementDays != 7 || b.BusierDisplayName != "SDK商务(所属商务)" || b.ParentPromoteName == nil || *b.ParentPromoteName != "所属商务" { + if b.LockStatusLabel != sample.label || b.StatusLabel != "正常" || b.Phone != channel.Phone || b.SettlementDays == nil || *b.SettlementDays != 7 || b.BusierDisplayName != "SDK商务(所属商务)" || b.ParentPromoteName != nil { t.Fatalf("portrait metadata or status mismatch: %+v", b) } }