京东商城上传商品透图
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
package jdshopapi
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
//查询单个订单
|
||||
//https://open.jd.com/home/home#/doc/api?apiCateId=55&apiId=2389&apiName=jingdong.pop.order.enGet
|
||||
func (a *API) EnGet(orderID int64) (err error) {
|
||||
_, err = a.AccessAPI("jingdong.pop.order.enGet", prodURL, map[string]interface{}{
|
||||
dataMap := map[string]interface{}{
|
||||
"order_id": orderID,
|
||||
"optional_fields": "ALL",
|
||||
"optional_fields": "orderType,payType",
|
||||
}
|
||||
data, _ := json.Marshal(dataMap)
|
||||
_, err = a.AccessAPI("jingdong.pop.order.enGet", prodURL, map[string]interface{}{
|
||||
"360buy_param_json": string(data),
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
)
|
||||
|
||||
func TestEnGet(t *testing.T) {
|
||||
err := api.EnGet(116889545275)
|
||||
err := api.EnGet(116925931738)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -535,6 +535,7 @@ func (a *API) FindSkuById(skuId int64) (findSkuByIdParam *FindSkuByIdParam, err
|
||||
func (a *API) FindWareById(wareId int64) (err error) {
|
||||
_, err = a.AccessAPI2("jingdong.ware.read.findWareById", prodURL, map[string]interface{}{
|
||||
"wareId": wareId,
|
||||
"field": "features",
|
||||
})
|
||||
return err
|
||||
}
|
||||
@@ -560,3 +561,14 @@ func (a *API) FindOpReason(wareId int64) (reason string, err error) {
|
||||
}
|
||||
return reason, err
|
||||
}
|
||||
|
||||
//商品透图追加
|
||||
//https://open.jd.com/home/home#/doc/api?apiCateId=48&apiId=2504&apiName=jingdong.transparentImage.write.add
|
||||
func (a *API) TransparentImageAdd(wareId int64, imageUrl string) (err error) {
|
||||
_, err = a.AccessAPI2("jingdong.transparentImage.write.add", prodURL, map[string]interface{}{
|
||||
"wareId": wareId,
|
||||
"colorId": "0000000000",
|
||||
"imageUrl": imageUrl,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -408,3 +408,19 @@ func ConvertDistanceToLogLat(lng, lat, distance, angle float64) (newLng, newLat
|
||||
newLat = lat + (distance*math.Cos(angle*math.Pi/180))/oneDu //将距离转换成纬度的计算公式
|
||||
return newLng, newLat
|
||||
}
|
||||
|
||||
func TestFindWareById(t *testing.T) {
|
||||
err := api.FindWareById(14546096098)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestTransparentImageAdd(t *testing.T) {
|
||||
// err := api.TransparentImageAdd(wareId, imageUrl)
|
||||
// if err != nil {
|
||||
// t.Fatal(err)
|
||||
// }
|
||||
// t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user