1
This commit is contained in:
@@ -629,3 +629,35 @@ func (a *API) GetEbaiCatIDFromName(shopID, catName string) (ebaiCatID int64) {
|
||||
}
|
||||
return ebaiCatID
|
||||
}
|
||||
|
||||
// CategoryAttrValueList 根据分类id获取商品属性
|
||||
//https://open-retail.ele.me/#/apidoc/me.ele.retail:sku.category.property.list-3?aopApiCategory=item_cate&type=item_all
|
||||
func (a *API) CategoryAttrValueList(cat3Id int64, shopId string) (categoryAttrValueListResult []*CategoryAttr, err error) {
|
||||
result, err := a.AccessAPI("sku.category.property.list", map[string]interface{}{
|
||||
"cat3_id": cat3Id,
|
||||
"shop_id": shopId,
|
||||
})
|
||||
if err == nil && result.ErrNo == 0 {
|
||||
err = utils.UnmarshalUseNumber(utils.MustMarshal(result.Data), &categoryAttrValueListResult)
|
||||
}
|
||||
return categoryAttrValueListResult, err
|
||||
}
|
||||
|
||||
type CategoryAttr struct {
|
||||
PropertyId int64 `json:"propertyId"` // 属性ID
|
||||
CategoryId int64 `json:"categoryId"` // 所属叶子类目ID
|
||||
PropertyName string `json:"propertyName"` // 属性名
|
||||
Required bool `json:"required"` // 是否必选
|
||||
MultiSelect bool `json:"multiSelect"` // 属性值是否多选
|
||||
EnumProp bool `json:"enumProp"` // 是否枚举属性
|
||||
InputProp bool `json:"inputProp"` // 是否可输入属性
|
||||
SaleProp bool `json:"saleProp"` // 是否销售属性,销售属性只能用于生成多规格
|
||||
SortOrder bool `json:"sortOrder"` // 排序值
|
||||
MajorProp bool `json:"majorProp"` // 是否关键属性
|
||||
PropertyValues []PropertyValue `json:"propertyValues"` // 属性值列表
|
||||
}
|
||||
type PropertyValue struct {
|
||||
ValueId int64 `json:"ValueId"` // 属性值id
|
||||
ValueData string `json:"valueData"` // 属性值内容
|
||||
SortOrder int64 `json:"sortOrder"` // 排序码
|
||||
}
|
||||
|
||||
@@ -370,3 +370,7 @@ func TestDeleteSku(t *testing.T) {
|
||||
// api.ShopCategoryDelete(shopId, v.CategoryID)
|
||||
//}
|
||||
}
|
||||
|
||||
func TestCategoryAttrValueList(t *testing.T) {
|
||||
api.CategoryAttrValueList(201220238, "666667")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user