fix: match legacy channel business owner display
This commit is contained in:
@@ -49,9 +49,7 @@ type Channel struct {
|
||||
}
|
||||
|
||||
func (c *Channel) BusinessDisplayName() string {
|
||||
if len(c.BusinessPath) > 0 {
|
||||
return strings.Join(c.BusinessPath, "→")
|
||||
}
|
||||
// 沿用旧商务系统:显示绑定的平台商务账号及当前商务登录名。
|
||||
account, user := strings.TrimSpace(c.BindingAccount), strings.TrimSpace(c.BindingUserName)
|
||||
if account == "" {
|
||||
return user
|
||||
|
||||
@@ -112,7 +112,7 @@ func TestChannelListMatchesBindingsAndLiteralBusinessKeyword(t *testing.T) {
|
||||
t.Fatalf("指定商务应只取本人绑定: %+v %v", page, err)
|
||||
}
|
||||
for _, row := range page.Rows {
|
||||
if row.SourceDB != "lx" || row.BusierUserID == nil || *row.BusierUserID != 9 || row.BusinessDisplayName() != "parent→branch→leaf" {
|
||||
if row.SourceDB != "lx" || row.BusierUserID == nil || *row.BusierUserID != 9 || row.BusinessDisplayName() != "lx-business(leaf)" {
|
||||
t.Fatalf("归属展示错误: %+v", row)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,14 +20,14 @@ func TestChannelPortraitKeepsContactAndCooperationStatusSeparateFromAudit(t *tes
|
||||
status int
|
||||
label string
|
||||
}{{0, "正常"}, {-1, "锁定"}, {-2, "解除合作"}} {
|
||||
channel := &business.Channel{ChannelKey: business.ChannelKey{SourceDB: "lx", ID: 100}, Account: "渠道账号", Level: &level, Status: &auditStatus, LockStatus: &sample.status, Phone: "13812345678", SettlementDays: &days, BusinessPath: []string{"一级商务", "所属商务"}}
|
||||
channel := &business.Channel{ChannelKey: business.ChannelKey{SourceDB: "lx", ID: 100}, Account: "渠道账号", Level: &level, Status: &auditStatus, LockStatus: &sample.status, Phone: "13812345678", SettlementDays: &days, BindingAccount: "SDK商务", BindingUserName: "所属商务", BusinessPath: []string{"一级商务", "所属商务"}}
|
||||
service := &ChannelPortraitService{uc: channelPortraitTransportFake{&business.ChannelPortrait{Basic: &business.ChannelPortraitBasic{Channel: channel}}}}
|
||||
result, err := service.Portrait(context.Background(), &dto.ChannelPortraitQuery{SourceDB: "lx", PromoteID: 100})
|
||||
if err != nil {
|
||||
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 != "一级商务→所属商务" || 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 || *b.ParentPromoteName != "所属商务" {
|
||||
t.Fatalf("portrait metadata or status mismatch: %+v", b)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user