infish2018 hace 1 semana
padre
commit
f40f307d06
Se han modificado 2 ficheros con 12 adiciones y 4 borrados
  1. 11 3
      sku3d/sku3d/api/a-service-img.go
  2. 1 1
      sku3d/sku3d/app.yaml

+ 11 - 3
sku3d/sku3d/api/a-service-img.go

@@ -36,12 +36,15 @@ func getSerialNum(img *model.MatImage, ctx *repo.RepoSession) (string, error) {
 		fmt.Println("find category error", 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 _, s1 := range s.Children {
 			setMap[s1.IdStr] = s1
 			for _, c := range s1.Children {
 				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
 			for _, c := range s1.Children {
 				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 {
 		c, ok := setMap[v]
 		if !ok {
 			continue
 		}
 		p := setParentMap[v]
-
+		fmt.Println("parent->", p.Name, c.Name)
 		if p.Name == "商品分类" {
 			catId1 = 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 == "产品系列" {
 			catId2 = c.CusNum
+			fmt.Println("产品系列 name", catId2)
 			continue
 		}
 		if p.Name == "产品用途" {
 			catId3 = c.CusNum
+			fmt.Println("产品用途 name", c.CusNum)
 		}
 	}
 

+ 1 - 1
sku3d/sku3d/app.yaml

@@ -2,7 +2,7 @@
 port: 7902
 
 nats:
-  # url: nats://124.71.139.24:14223
+  # url: nats://47.96.90.34:14223
   url: nats://comm-bus:4222
   maxReconnect: 1000
   reconnDelaySecond: 5