From 60ff7e585402af4eae4ef7490ddf96edf2fece3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 12 Mar 2021 16:35:40 +0800 Subject: [PATCH] aa --- platformapi/jdshopapi/store_page.go | 36 ++++++++++++++++++++++++ platformapi/jdshopapi/store_page_test.go | 8 ++++++ 2 files changed, 44 insertions(+) diff --git a/platformapi/jdshopapi/store_page.go b/platformapi/jdshopapi/store_page.go index 40021f2b..39216529 100644 --- a/platformapi/jdshopapi/store_page.go +++ b/platformapi/jdshopapi/store_page.go @@ -1150,3 +1150,39 @@ func (a *API) SetOrderStateToFinish(orderId int64) (err error) { _, err = a.AccessStorePage("https://porder.shop.jd.com/order/global/setOrderStateToFinish", params, false) return err } + +type StoreProductSearchResult struct { + SkuID int64 `json:"skuId"` + CategoryID int `json:"categoryId"` + CategoryName []string `json:"categoryName"` + StoreID string `json:"storeId"` + StoreName string `json:"storeName"` + StoreAddress string `json:"storeAddress"` + VenderID string `json:"venderId"` + Status int `json:"status"` + LastUpTime interface{} `json:"lastUpTime"` + LastDownTime int64 `json:"lastDownTime"` + StorePrice interface{} `json:"storePrice"` + StockNum int `json:"stockNum"` + SkuName string `json:"skuName"` + Logo string `json:"logo"` + FeatureMap struct { + } `json:"featureMap"` + PriceAuditStatus interface{} `json:"priceAuditStatus"` + Reason interface{} `json:"reason"` + ShopSkuStatus interface{} `json:"shopSkuStatus"` +} + +//门店商品查询 +func (a *API) StoreProductSearch(pageNo, pageSize int, vendorStoreIDs []string) (storeProductSearchResult []*StoreProductSearchResult, totalCount int, err error) { + result, err := a.AccessStorePage2("https://ware.shop.jd.com/rest/storeProduct/search", map[string]interface{}{ + "pageNo": pageNo, + "pageSize": pageSize, + "storeIds": vendorStoreIDs, + }, true) + if err == nil && result["data"] != nil { + utils.Map2StructByJson(result["data"].(map[string]interface{})["data"], &storeProductSearchResult, false) + totalCount = int(utils.MustInterface2Int64(result["data"].(map[string]interface{})["totalItem"])) + } + return storeProductSearchResult, totalCount, err +} diff --git a/platformapi/jdshopapi/store_page_test.go b/platformapi/jdshopapi/store_page_test.go index 0d56682f..31aa8b50 100644 --- a/platformapi/jdshopapi/store_page_test.go +++ b/platformapi/jdshopapi/store_page_test.go @@ -734,3 +734,11 @@ func TestSetOrderStateToWait(t *testing.T) { } // t.Log(utils.Format4Output(result, false)) } + +func TestStoreProductSearch(t *testing.T) { + result, _, err := api.StoreProductSearch(1, 20, []string{"1000069025"}) + if err != nil { + t.Fatal(err) + } + t.Log(utils.Format4Output(result, false)) +}