Просмотр исходного кода

增加商品 规格 + 颜色接口

abiao лет назад: 5
Родитель
Сommit
eef6ad6c33

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

@@ -251,11 +251,23 @@ func (self *ProductController) GetProductSizesByPid() {
 		productKeyConfig := product_model.GetProductAttrKey(item.AttrKeyId)
 		productKeyConfig := product_model.GetProductAttrKey(item.AttrKeyId)
 		if productKeyConfig != nil {
 		if productKeyConfig != nil {
 			if item.SizeType == product_model.SIZE_TYPE_1 {
 			if item.SizeType == product_model.SIZE_TYPE_1 {
-				productKeyConfig.ProductAttr = product_model.GetProductAttrsByKId(productKeyConfig.Id)
+				attrList := product_model.GetProductAttrsByKId(productKeyConfig.Id)
+				for _, attr := range attrList {
+					if attr.Id == product.SizeId {
+						attr.IsSelect = true
+					}
+				}
+				productKeyConfig.ProductAttr = attrList
 				ret.Size = productKeyConfig
 				ret.Size = productKeyConfig
 			}
 			}
 			if item.SizeType == product_model.SIZE_TYPE_2 {
 			if item.SizeType == product_model.SIZE_TYPE_2 {
-				productKeyConfig.ProductAttr = product_model.GetProductAttrsByKId(productKeyConfig.Id)
+				attrList := product_model.GetProductAttrsByKId(productKeyConfig.Id)
+				for _, attr := range attrList {
+					if attr.Id == product.SizeId {
+						attr.IsSelect = true
+					}
+				}
+				productKeyConfig.ProductAttr = attrList
 				ret.Color = productKeyConfig
 				ret.Color = productKeyConfig
 			}
 			}
 		}
 		}

+ 2 - 2
go/gopath/src/fohow.com/apps/models/product_model/product.go

@@ -95,8 +95,8 @@ type Product struct {
 	//规格相关
 	//规格相关
 	RelateProductId string `orm:"column(relate_product_id)"                          json:"relate_product_id"` // varchar(255)
 	RelateProductId string `orm:"column(relate_product_id)"                          json:"relate_product_id"` // varchar(255)
 	ShowFlag        bool   `orm:"column(show_flag)"                          json:"-"`                         // varchar(255)
 	ShowFlag        bool   `orm:"column(show_flag)"                          json:"-"`                         // varchar(255)
-	SizeId          string `orm:"column(size_id)"                          json:"size_id"`                     // varchar(255)
-	ColorId         string `orm:"column(color_id)"                          json:"color_id"`                   // varchar(255)
+	SizeId          int64  `orm:"column(size_id)"                          json:"size_id"`                     // varchar(255)
+	ColorId         int64  `orm:"column(color_id)"                          json:"color_id"`                   // varchar(255)
 	HaveSize        bool   `orm:"column(have_size)"                         json:"have_size"`                  // bool
 	HaveSize        bool   `orm:"column(have_size)"                         json:"have_size"`                  // bool
 }
 }