京东商品

This commit is contained in:
苏尹岚
2020-06-09 18:58:04 +08:00
parent 762a41dbdd
commit 73b0253721
5 changed files with 321 additions and 8 deletions

View File

@@ -119,7 +119,7 @@ type CreateSkuParamSkus struct {
}
type CreateSkuParamAttrs struct {
// AttrValueAlias []string `json:"attrValueAlias"` //否 无 值别名,发布商品时不可设置
// AttrValueAlias []string `json:"attrValueAlias,omitempty"` //否 无 值别名,发布商品时不可设置
AttrID string `json:"attrId"` //是 无 下沉到sku的属性ID 通过接口 jingdong.category.read.findAttrsByCategoryIdUnlimitCate 获取 features字段中attrLevel=1
AttrValues []string `json:"attrValues"` //是 无 下沉到sku属性值 单选或者多选 通过接口jingdong.category.read.findValuesByAttrIdUnlimit获取 输入类型请手动输入
}
@@ -573,3 +573,46 @@ func (a *API) TransparentImageAdd(wareId int64, imageUrl string) (err error) {
})
return err
}
type UpdateWareSaleAttrvalueAliasParam struct {
WareID int64 `json:"wareId"`
Props []*CreateSkuParamAttrs2 `json:"props"` //否 无 多级SKU属性仅当属性可以下沉时才能设置不验证必填sku维度设置后以sku上的属性为准
}
type CreateSkuParamAttrs2 struct {
AttrValueAlias []string `json:"attrValueAlias,omitempty"` //否 无 值别名,发布商品时不可设置
AttrID string `json:"attrId"` //是 无 下沉到sku的属性ID 通过接口 jingdong.category.read.findAttrsByCategoryIdUnlimitCate 获取 features字段中attrLevel=1
AttrValues []string `json:"attrValues"` //是 无 下沉到sku属性值 单选或者多选 通过接口jingdong.category.read.findValuesByAttrIdUnlimit获取 输入类型请手动输入
Type string `json:"type"` //"com.jd.pop.ware.ic.api.domain.Prop"
Type2 string `json:"@type"`
}
//修改商品销售属性
//https://open.jd.com/home/home#/doc/api?apiCateId=48&apiId=1381&apiName=jingdong.ware.write.updateWareSaleAttrvalueAlias
func (a *API) UpdateWareSaleAttrvalueAlias(param *UpdateWareSaleAttrvalueAliasParam) (err error) {
data, _ := json.Marshal(param)
_, err = a.AccessAPI2("jingdong.ware.write.updateWareSaleAttrvalueAlias", prodURL, map[string]interface{}{
"360buy_param_json": string(data),
})
return err
}
type SearchSkuListResult struct {
Status int `json:"status"`
JdPrice float64 `json:"jdPrice"`
SkuID int64 `json:"skuId"`
WareID int64 `json:"wareId"`
OuterID string `json:"outerId"`
}
//搜索sku
//https://open.jd.com/home/home#/doc/api?apiCateId=48&apiId=1227&apiName=jingdong.sku.read.searchSkuList
func (a *API) SearchSkuList(wareId int64) (list []*SearchSkuListResult, err error) {
result, err := a.AccessAPI2("jingdong.sku.read.searchSkuList", prodURL, map[string]interface{}{
"wareId": wareId,
})
if err == nil {
utils.Map2StructByJson(result["jingdong_sku_read_searchSkuList_responce"].(map[string]interface{})["page"].(map[string]interface{})["data"], &list, false)
}
return list, err
}