diff --git a/platformapi/jdshopapi/order.go b/platformapi/jdshopapi/order.go index f253b20c..9919bf7d 100644 --- a/platformapi/jdshopapi/order.go +++ b/platformapi/jdshopapi/order.go @@ -36,3 +36,13 @@ func (a *API) GetDeliveryCompany() (result interface{}, err error) { } 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 +} diff --git a/platformapi/jdshopapi/order_test.go b/platformapi/jdshopapi/order_test.go index f1a73569..71aa58ef 100644 --- a/platformapi/jdshopapi/order_test.go +++ b/platformapi/jdshopapi/order_test.go @@ -21,3 +21,11 @@ func TestGetDeliveryCompany(t *testing.T) { } 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)) +} diff --git a/platformapi/jdshopapi/store_test.go b/platformapi/jdshopapi/store_test.go index 5c258d93..4bd19ff9 100644 --- a/platformapi/jdshopapi/store_test.go +++ b/platformapi/jdshopapi/store_test.go @@ -4,6 +4,7 @@ import ( "encoding/base64" "fmt" "testing" + "time" "git.rosy.net.cn/baseapi/utils" ) @@ -48,7 +49,7 @@ func TestGetProvince(t *testing.T) { } func TestGetCity(t *testing.T) { - result, err := api.GetCity(12) + result, err := api.GetCity(4) if err != nil { t.Fatal(err) } @@ -56,7 +57,7 @@ func TestGetCity(t *testing.T) { } func TestGetCounty(t *testing.T) { - result, err := api.GetCounty(988) + result, err := api.GetCounty(50953) if err != nil { t.Fatal(err) } @@ -96,7 +97,5 @@ func TestFindStoreInfoByExtStoreId(t *testing.T) { } func TestWIREHL(t *testing.T) { - data := "http://image.jxc4.com/image/f8578c9ee724408d514bbbfac3461142.tem.png" - res := base64.URLEncoding.EncodeToString([]byte(data)) - fmt.Println(res) + fmt.Println(time.Now().Sub(utils.Str2Time("2020-06-29 00:00:00")) > 24*time.Hour) } diff --git a/platformapi/yinbaoapi/store_page.go b/platformapi/yinbaoapi/store_page.go index 1ff7df94..068cbc21 100644 --- a/platformapi/yinbaoapi/store_page.go +++ b/platformapi/yinbaoapi/store_page.go @@ -458,10 +458,12 @@ func (a *API) ResetCoverImage(userId, keyword string) (err error) { if err != nil { return err } - _, err = a.AccessStorePage("Product/ResetCoverImage", map[string]interface{}{ - "productImageId": findProductResult.Productimages[len(findProductResult.Productimages)-1].ID, - "forMulColorSize": false, - }) + if len(findProductResult.Productimages) > 0 { + _, err = a.AccessStorePage("Product/ResetCoverImage", map[string]interface{}{ + "productImageId": findProductResult.Productimages[len(findProductResult.Productimages)-1].ID, + "forMulColorSize": false, + }) + } return err }