京东商城商品图片修改
This commit is contained in:
@@ -142,11 +142,12 @@ type CreateSkuResult struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type UpdateWareParam struct {
|
type UpdateWareParam struct {
|
||||||
WareID int64 `json:"wareId"`
|
WareID int64 `json:"wareId"`
|
||||||
Title string `json:"title"` //否 标题 商品名称 限制45个字符内
|
Title string `json:"title"` //否 标题 商品名称 限制45个字符内
|
||||||
VenderID int64 `json:"venderId"`
|
VenderID int64 `json:"venderId"`
|
||||||
PromiseID int `json:"promiseId"` // 否 无 配送时效
|
PromiseID int `json:"promiseId"` // 否 无 配送时效
|
||||||
// Weight int `json:"weight"` //否 无 商品重量,单位kg
|
MobileDesc string `json:"mobileDesc"` // 是 无 移动版的商品介绍 长度限制10W个字符
|
||||||
|
Introduction string `json:"introduction"` // 是 无 PC版的商品介绍 长度限制10W个字符
|
||||||
}
|
}
|
||||||
|
|
||||||
type QueryPictureReuslt struct {
|
type QueryPictureReuslt struct {
|
||||||
@@ -401,3 +402,15 @@ func (a *API) FindSkuStock(skuId int64) (err error) {
|
|||||||
})
|
})
|
||||||
return err
|
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
|
||||||
|
}
|
||||||
|
|||||||
@@ -297,3 +297,11 @@ func TestQueryPicture(t *testing.T) {
|
|||||||
}
|
}
|
||||||
t.Log(utils.Format4Output(result, false))
|
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))
|
||||||
|
}
|
||||||
|
|||||||
@@ -23,9 +23,6 @@ func (a *API) AccessStorePage(fullURL string, bizParams map[string]interface{},
|
|||||||
request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||||
} else {
|
} else {
|
||||||
request, _ = http.NewRequest(http.MethodGet, utils.GenerateGetURL(fullURL, "", bizParams), nil)
|
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)
|
a.FillRequestCookies(request)
|
||||||
return request
|
return request
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ func TestUpdateStoreStatus(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestNewInfoList(t *testing.T) {
|
func TestNewInfoList(t *testing.T) {
|
||||||
result, err := api.NewInfoList(24332466)
|
result, err := api.NewInfoList(1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user