|
@@ -36,12 +36,15 @@ func getSerialNum(img *model.MatImage, ctx *repo.RepoSession) (string, error) {
|
|
fmt.Println("find category error", err)
|
|
fmt.Println("find category error", err)
|
|
return "", err
|
|
return "", err
|
|
}
|
|
}
|
|
- setMap := make(map[string]*model.Category, len(cat.Children)*20)
|
|
|
|
|
|
+ setMap := make(map[string]*model.Category, len(cat.Children)*200)
|
|
for _, s := range cat.Children {
|
|
for _, s := range cat.Children {
|
|
for _, s1 := range s.Children {
|
|
for _, s1 := range s.Children {
|
|
setMap[s1.IdStr] = s1
|
|
setMap[s1.IdStr] = s1
|
|
for _, c := range s1.Children {
|
|
for _, c := range s1.Children {
|
|
setMap[c.IdStr] = c
|
|
setMap[c.IdStr] = c
|
|
|
|
+ for _, cc := range c.Children {
|
|
|
|
+ setMap[cc.IdStr] = cc
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -52,17 +55,20 @@ func getSerialNum(img *model.MatImage, ctx *repo.RepoSession) (string, error) {
|
|
setParentMap[s1.IdStr] = s
|
|
setParentMap[s1.IdStr] = s
|
|
for _, c := range s1.Children {
|
|
for _, c := range s1.Children {
|
|
setParentMap[c.IdStr] = s1
|
|
setParentMap[c.IdStr] = s1
|
|
|
|
+ for _, cc := range c.Children {
|
|
|
|
+ setParentMap[cc.IdStr] = c
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ fmt.Println("len of cate =", len(img.Categories))
|
|
for _, v := range img.Categories {
|
|
for _, v := range img.Categories {
|
|
c, ok := setMap[v]
|
|
c, ok := setMap[v]
|
|
if !ok {
|
|
if !ok {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
p := setParentMap[v]
|
|
p := setParentMap[v]
|
|
-
|
|
|
|
|
|
+ fmt.Println("parent->", p.Name, c.Name)
|
|
if p.Name == "商品分类" {
|
|
if p.Name == "商品分类" {
|
|
catId1 = c.CusNum
|
|
catId1 = c.CusNum
|
|
fmt.Println("p name", c.CusNum)
|
|
fmt.Println("p name", c.CusNum)
|
|
@@ -70,10 +76,12 @@ func getSerialNum(img *model.MatImage, ctx *repo.RepoSession) (string, error) {
|
|
}
|
|
}
|
|
if p.Name == "产品系列" {
|
|
if p.Name == "产品系列" {
|
|
catId2 = c.CusNum
|
|
catId2 = c.CusNum
|
|
|
|
+ fmt.Println("产品系列 name", catId2)
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
if p.Name == "产品用途" {
|
|
if p.Name == "产品用途" {
|
|
catId3 = c.CusNum
|
|
catId3 = c.CusNum
|
|
|
|
+ fmt.Println("产品用途 name", c.CusNum)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|