Bladeren bron

商品规格更改返回

abiao 5 jaren geleden
bovenliggende
commit
492f5c48a5

+ 5 - 2
go/gopath/src/fohow.com/apps/controllers/product_controller/product_controller.go

@@ -304,6 +304,7 @@ func (self *ProductController) GetProductSizesByPid() {
 	if product != nil {
 		list := product_model.GetProductConfigAttrsByPId(pId)
 		for _, item := range list {
+			attrTypeList := []*product_model.ProductAttr{}
 			productKeyConfig := product_model.GetProductAttrKey(item.AttrKeyId)
 			if productKeyConfig != nil {
 				if item.SizeType == product_model.SIZE_TYPE_1 {
@@ -313,8 +314,9 @@ func (self *ProductController) GetProductSizesByPid() {
 						if prod == nil {
 							continue
 						}
-						productKeyConfig.ProductAttr = append(productKeyConfig.ProductAttr, attr)
+						attrTypeList = append(attrTypeList, attr)
 					}
+					productKeyConfig.ProductAttr = attrTypeList
 					ret.Size = productKeyConfig
 				}
 				if item.SizeType == product_model.SIZE_TYPE_2 {
@@ -324,8 +326,9 @@ func (self *ProductController) GetProductSizesByPid() {
 						if prod == nil {
 							continue
 						}
-						productKeyConfig.ProductAttr = append(productKeyConfig.ProductAttr, attr)
+						attrTypeList = append(attrTypeList, attr)
 					}
+					productKeyConfig.ProductAttr = attrTypeList
 					ret.Color = productKeyConfig
 				}
 			}