From fbb0e8a8402ae58617c5d27b06247fe3581a6c92 Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Mon, 21 Jun 2021 18:58:57 +0800 Subject: [PATCH] aa --- platformapi/jdapi/finance_test.go | 2 +- platformapi/jdapi/order.go | 18 ++++++++++++- platformapi/jdapi/order_test.go | 16 ++++++++++-- platformapi/jdshopapi/store.go | 11 ++++++++ platformapi/jdshopapi/store_test.go | 39 ++++------------------------- platformapi/mtwmapi/order.go | 8 +++--- platformapi/mtwmapi/order_test.go | 2 +- 7 files changed, 54 insertions(+), 42 deletions(-) diff --git a/platformapi/jdapi/finance_test.go b/platformapi/jdapi/finance_test.go index 1460adf3..9037c2f2 100644 --- a/platformapi/jdapi/finance_test.go +++ b/platformapi/jdapi/finance_test.go @@ -15,7 +15,7 @@ func TestQueryOassBussMoney(t *testing.T) { } func TestCheckAfsBill(t *testing.T) { - bussResult, bussErr := api.CheckAfsBill("2104611382000451") + bussResult, bussErr := api.CheckAfsBill("2114753262000162") if bussErr != nil { t.Error(bussErr.Error()) } diff --git a/platformapi/jdapi/order.go b/platformapi/jdapi/order.go index bc450e92..581372c1 100644 --- a/platformapi/jdapi/order.go +++ b/platformapi/jdapi/order.go @@ -318,7 +318,7 @@ type OrderInfo struct { } type OrderQueryParam struct { - PageNo int `json:"pageNo,omitempty"` // 当前页数,默认:1 + PageNo int `json:"pageNo,omitempty"` // 当前页数,默认:1 PageSize int `json:"pageSize,omitempty"` // 每页条数,默认:20,最大值100 OrderID int64 `json:"orderId,omitempty"` @@ -746,3 +746,19 @@ func (a *API) CheckSelfPickCode(selfPickCode, orderID, operPin string) (err erro _, err = a.AccessAPINoPage("ocs/checkSelfPickCode", jdParams, nil, nil, nullResultParser) return err } + +type RefDiffAdjustSkuList struct { + SkuId string `json:"skuId"` + SkuActualWeight int `json:"skuActualWeight"` +} + +// 生成退差价逆向单接口 +//http://opendj.jd.com/staticnew/widgets/resources.html?groupid=169&apiid=74ed627f2d2c45dbb804c900159e4c6a +func (a *API) GenerateReverseOrder(orderID string, skuList []*RefDiffAdjustSkuList) (err error) { + jdParams := map[string]interface{}{ + "orderId": orderID, + "refDiffAdjustSkuList": skuList, + } + _, err = a.AccessAPINoPage("reverse/generateReverseOrder", jdParams, nil, nil, nullResultParser) + return err +} diff --git a/platformapi/jdapi/order_test.go b/platformapi/jdapi/order_test.go index 3422ca77..7c06704a 100644 --- a/platformapi/jdapi/order_test.go +++ b/platformapi/jdapi/order_test.go @@ -87,7 +87,7 @@ func TestDeliveryEndOrder(t *testing.T) { } func TestGetAfsService(t *testing.T) { - result, err := api.GetAfsService("33927317") + result, err := api.GetAfsService("34081924") if err != nil { t.Fatal(err.Error()) } @@ -103,7 +103,7 @@ func TestGetAfsService2(t *testing.T) { } func TestOrderShoudSettlementService2(t *testing.T) { - result, err := api.OrderShoudSettlementService2("2114317310000151") + result, err := api.OrderShoudSettlementService2("2114464478000161") if err != nil { t.Fatal(err.Error()) } @@ -185,3 +185,15 @@ func TestCancelAndRefund(t *testing.T) { t.Fatal(err.Error()) } } + +func TestGenerateReverseOrder(t *testing.T) { + err := api.GenerateReverseOrder("2114820876000231", []*RefDiffAdjustSkuList{ + &RefDiffAdjustSkuList{ + SkuId: "2036475569", + SkuActualWeight: 230, + }, + }) + if err != nil { + t.Fatal(err.Error()) + } +} diff --git a/platformapi/jdshopapi/store.go b/platformapi/jdshopapi/store.go index 8e658fb8..b08eb9d4 100644 --- a/platformapi/jdshopapi/store.go +++ b/platformapi/jdshopapi/store.go @@ -191,3 +191,14 @@ func (a *API) FindStoreInfoByExtStoreId(storeID int) (queryEntityStoreResult *Qu return queryEntityStoreResult, err } + +//更新门店状态 +//https://open.jd.com/home/home#/doc/api?apiCateId=351&apiId=6418&apiName=jingdong.updateStoreStatus +// 停启状态 1.启用,2.停用 +func (a *API) UpdateStoreStatusAPI(storeID, status int) (err error) { + _, err = a.AccessAPI("jingdong.updateStoreStatus", prodURL, map[string]interface{}{ + "storeStatus": status, + "id": storeID, + }) + return err +} diff --git a/platformapi/jdshopapi/store_test.go b/platformapi/jdshopapi/store_test.go index ed2231ad..1469acf6 100644 --- a/platformapi/jdshopapi/store_test.go +++ b/platformapi/jdshopapi/store_test.go @@ -2,7 +2,6 @@ package jdshopapi import ( "encoding/base64" - "fmt" "testing" "git.rosy.net.cn/baseapi/utils" @@ -111,38 +110,10 @@ func TestFindStoreInfoByExtStoreId(t *testing.T) { t.Log(utils.Format4Output(result, false)) } -func TestWIREHL(t *testing.T) { - fmt.Println(largeGroupPositions("abcdddeeeeaabbbcd")) -} - -func largeGroupPositions(s string) (result [][]int) { - var ( - l = 0 - r = 1 - count int - ) - fmt.Println(len(s)) - for { - fmt.Println(l, r, count) - if r == len(s) { - if count > 1 { - result = append(result, []int{l, r - 1}) - count = 0 - } - break - } - if s[l] != s[r] { - if count > 1 { - result = append(result, []int{l, r - 1}) - count = 0 - } - l = r - r++ - count = 0 - } else { - count++ - r++ - } +func TestUpdateStoreStatusAPI(t *testing.T) { + err := api.UpdateStoreStatusAPI(69353633443, 0) + if err != nil { + t.Fatal(err) } - return result + // t.Log(utils.Format4Output(result, false)) } diff --git a/platformapi/mtwmapi/order.go b/platformapi/mtwmapi/order.go index 32e46f85..ee5214fc 100644 --- a/platformapi/mtwmapi/order.go +++ b/platformapi/mtwmapi/order.go @@ -96,9 +96,11 @@ const ( ) type RefundSku struct { - AppFoodCode string `json:"app_food_code"` - SkuID string `json:"sku_id,omitempty"` - Count int `json:"count"` + AppFoodCode string `json:"app_food_code"` + SkuID string `json:"sku_id,omitempty"` + Count int `json:"count"` + ItemID string `json:"item_id,omitempty"` + ActualWeight float64 `json:"actual_weight,omitempty"` } type RefundSkuDetail struct { diff --git a/platformapi/mtwmapi/order_test.go b/platformapi/mtwmapi/order_test.go index e16b22cf..b7879527 100644 --- a/platformapi/mtwmapi/order_test.go +++ b/platformapi/mtwmapi/order_test.go @@ -97,7 +97,7 @@ func TestOrderGetRiderInfoPhoneNumber(t *testing.T) { } func TestGetOrderRefundDetail(t *testing.T) { - result, err := api.GetOrderRefundDetail(115082650031169457, 0) + result, err := api.GetOrderRefundDetail(70263190513673732, 0) if err != nil { t.Fatal(err) }