尝试获取京东商城订单

This commit is contained in:
苏尹岚
2020-06-29 14:45:54 +08:00
parent 2641c0ac1b
commit 62f9947573
4 changed files with 28 additions and 9 deletions

View File

@@ -36,3 +36,13 @@ func (a *API) GetDeliveryCompany() (result interface{}, err error) {
} }
return result, err return result, err
} }
//查询单个订单
//https://open.jd.com/home/home#/doc/api?apiCateId=55&apiId=4247&apiName=jingdong.pop.order.get
func (a *API) GetOrder(orderID int64) (err error) {
_, err = a.AccessAPI("jingdong.pop.order.get", prodURL, map[string]interface{}{
"order_id": orderID,
"optional_fields": "orderType,payType,orderTotalPrice,orderSellerPrice,orderPayment,freightPrice",
})
return err
}

View File

@@ -21,3 +21,11 @@ func TestGetDeliveryCompany(t *testing.T) {
} }
t.Log(utils.Format4Output(result, false)) t.Log(utils.Format4Output(result, false))
} }
func TestGetOrder(t *testing.T) {
err := api.GetOrder(120146365818)
if err != nil {
t.Fatal(err)
}
// t.Log(utils.Format4Output(result, false))
}

View File

@@ -4,6 +4,7 @@ import (
"encoding/base64" "encoding/base64"
"fmt" "fmt"
"testing" "testing"
"time"
"git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/baseapi/utils"
) )
@@ -48,7 +49,7 @@ func TestGetProvince(t *testing.T) {
} }
func TestGetCity(t *testing.T) { func TestGetCity(t *testing.T) {
result, err := api.GetCity(12) result, err := api.GetCity(4)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@@ -56,7 +57,7 @@ func TestGetCity(t *testing.T) {
} }
func TestGetCounty(t *testing.T) { func TestGetCounty(t *testing.T) {
result, err := api.GetCounty(988) result, err := api.GetCounty(50953)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@@ -96,7 +97,5 @@ func TestFindStoreInfoByExtStoreId(t *testing.T) {
} }
func TestWIREHL(t *testing.T) { func TestWIREHL(t *testing.T) {
data := "http://image.jxc4.com/image/f8578c9ee724408d514bbbfac3461142.tem.png" fmt.Println(time.Now().Sub(utils.Str2Time("2020-06-29 00:00:00")) > 24*time.Hour)
res := base64.URLEncoding.EncodeToString([]byte(data))
fmt.Println(res)
} }

View File

@@ -458,10 +458,12 @@ func (a *API) ResetCoverImage(userId, keyword string) (err error) {
if err != nil { if err != nil {
return err return err
} }
if len(findProductResult.Productimages) > 0 {
_, err = a.AccessStorePage("Product/ResetCoverImage", map[string]interface{}{ _, err = a.AccessStorePage("Product/ResetCoverImage", map[string]interface{}{
"productImageId": findProductResult.Productimages[len(findProductResult.Productimages)-1].ID, "productImageId": findProductResult.Productimages[len(findProductResult.Productimages)-1].ID,
"forMulColorSize": false, "forMulColorSize": false,
}) })
}
return err return err
} }