京东商城商品图片修改

This commit is contained in:
苏尹岚
2020-05-19 15:22:54 +08:00
parent 8b94cbc613
commit 22c740f0f3
4 changed files with 27 additions and 9 deletions

View File

@@ -142,11 +142,12 @@ type CreateSkuResult struct {
}
type UpdateWareParam struct {
WareID int64 `json:"wareId"`
Title string `json:"title"` //否 标题 商品名称 限制45个字符内
VenderID int64 `json:"venderId"`
PromiseID int `json:"promiseId"` // 否 无 配送时效
// Weight int `json:"weight"` //否 无 商品重量,单位kg
WareID int64 `json:"wareId"`
Title string `json:"title"` //否 标题 商品名称 限制45个字符内
VenderID int64 `json:"venderId"`
PromiseID int `json:"promiseId"` // 否 无 配送时效
MobileDesc string `json:"mobileDesc"` // 是 无 移动版的商品介绍 长度限制10W个字符
Introduction string `json:"introduction"` // 是 无 PC版的商品介绍 长度限制10W个字符
}
type QueryPictureReuslt struct {
@@ -401,3 +402,15 @@ func (a *API) FindSkuStock(skuId int64) (err error) {
})
return err
}
//修改商品图片
//https://open.jd.com/home/home#/doc/api?apiCateId=48&apiId=1258&apiName=jingdong.image.write.update
func (a *API) ImageUpdate(wareId int64, imgIndex int, imgUrl string) (err error) {
_, err = a.AccessAPI("jingdong.image.write.update", prodURL, map[string]interface{}{
"wareId": wareId,
"imgIndex": imgIndex,
"imgUrl": imgUrl,
"colorId": "0000000000",
})
return err
}

View File

@@ -297,3 +297,11 @@ func TestQueryPicture(t *testing.T) {
}
t.Log(utils.Format4Output(result, false))
}
func TestImageUpdate(t *testing.T) {
err := api.ImageUpdate(14535527473, 1, "jfs/t1/116844/10/7385/198098/5ec3853bEa53d0730/168e5654c6309c96.jpg")
if err != nil {
t.Fatal(err)
}
// t.Log(utils.Format4Output(result, false))
}

View File

@@ -23,9 +23,6 @@ func (a *API) AccessStorePage(fullURL string, bizParams map[string]interface{},
request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
} else {
request, _ = http.NewRequest(http.MethodGet, utils.GenerateGetURL(fullURL, "", bizParams), nil)
request.Header.Set("Content-Type", "application/json;charset=UTF-8")
request.Header.Set("referer", "https://stores.shop.jd.com/")
request.Header.Set("origin", "https://stores.shop.jd.com/")
}
a.FillRequestCookies(request)
return request

View File

@@ -29,7 +29,7 @@ func TestUpdateStoreStatus(t *testing.T) {
}
func TestNewInfoList(t *testing.T) {
result, err := api.NewInfoList(24332466)
result, err := api.NewInfoList(1)
if err != nil {
t.Fatal(err)
}