From d011e532031d970dc1b7c11c9cdfb3c398e32396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 26 May 2020 14:08:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E5=95=86=E5=93=81=E9=80=8F=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformapi/jdshopapi/order.go | 10 ++++++++-- platformapi/jdshopapi/order_test.go | 2 +- platformapi/jdshopapi/sku.go | 12 ++++++++++++ platformapi/jdshopapi/sku_test.go | 16 ++++++++++++++++ 4 files changed, 37 insertions(+), 3 deletions(-) diff --git a/platformapi/jdshopapi/order.go b/platformapi/jdshopapi/order.go index 939199f1..2db41987 100644 --- a/platformapi/jdshopapi/order.go +++ b/platformapi/jdshopapi/order.go @@ -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 } diff --git a/platformapi/jdshopapi/order_test.go b/platformapi/jdshopapi/order_test.go index 23655aa2..8c02a36d 100644 --- a/platformapi/jdshopapi/order_test.go +++ b/platformapi/jdshopapi/order_test.go @@ -5,7 +5,7 @@ import ( ) func TestEnGet(t *testing.T) { - err := api.EnGet(116889545275) + err := api.EnGet(116925931738) if err != nil { t.Fatal(err) } diff --git a/platformapi/jdshopapi/sku.go b/platformapi/jdshopapi/sku.go index 9a9bf03a..cc996186 100644 --- a/platformapi/jdshopapi/sku.go +++ b/platformapi/jdshopapi/sku.go @@ -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 +} diff --git a/platformapi/jdshopapi/sku_test.go b/platformapi/jdshopapi/sku_test.go index 691e9c11..1220d3b3 100644 --- a/platformapi/jdshopapi/sku_test.go +++ b/platformapi/jdshopapi/sku_test.go @@ -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)) +}