银豹api,eclp库存api修改
This commit is contained in:
@@ -139,6 +139,23 @@ type SearchShopStockResult struct {
|
||||
PageNumber string `json:"pageNumber"`
|
||||
}
|
||||
|
||||
type QueryStockResult struct {
|
||||
RecordCount int `json:"recordCount"`
|
||||
IsvSku string `json:"isvSku"`
|
||||
DeptName string `json:"deptName"`
|
||||
SellerGoodsSign string `json:"sellerGoodsSign"`
|
||||
GoodsNo string `json:"goodsNo"`
|
||||
UsableNum int `json:"usableNum"`
|
||||
DeptNo string `json:"deptNo"`
|
||||
WarehouseName string `json:"warehouseName"`
|
||||
TotalNum int `json:"totalNum"`
|
||||
StockType string `json:"stockType"`
|
||||
StockStatus string `json:"stockStatus"`
|
||||
GoodsLevel string `json:"goodsLevel"`
|
||||
WarehouseNo string `json:"warehouseNo"`
|
||||
GoodsName string `json:"goodsName"`
|
||||
}
|
||||
|
||||
func New(accessToken, appKey, appSecret string, config ...*platformapi.APIConfig) *API {
|
||||
curConfig := platformapi.DefAPIConfig
|
||||
if len(config) > 0 {
|
||||
@@ -296,7 +313,7 @@ func (a *API) SearchShopStock(goodsNo string) (searchShopStockResult *SearchShop
|
||||
|
||||
//查询仓库商品库存
|
||||
//https://open.jd.com/home/home#/doc/api?apiCateId=138&apiId=3396&apiName=jingdong.eclp.stock.searchShopStock
|
||||
func (a *API) QueryStock(goodsNo string) (searchShopStockResult *SearchShopStockResult, err error) {
|
||||
func (a *API) QueryStock(goodsNo string) (queryStockResult []*QueryStockResult, err error) {
|
||||
params := map[string]interface{}{
|
||||
"deptNo": DepartmentNo,
|
||||
"warehouseNo": WarehouseNo,
|
||||
@@ -307,7 +324,7 @@ func (a *API) QueryStock(goodsNo string) (searchShopStockResult *SearchShopStock
|
||||
}
|
||||
result, err := a.AccessAPI("jingdong.eclp.stock.queryStock", prodURL, params)
|
||||
if err == nil {
|
||||
utils.Map2StructByJson(result["jingdong_eclp_stock_queryStock_responce"].(map[string]interface{})["querystock_result"], &searchShopStockResult, false)
|
||||
utils.Map2StructByJson(result["jingdong_eclp_stock_queryStock_responce"].(map[string]interface{})["querystock_result"], &queryStockResult, false)
|
||||
}
|
||||
return searchShopStockResult, err
|
||||
return queryStockResult, err
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ func TestSearchShopStock(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestQueryStock(t *testing.T) {
|
||||
result, err := api.QueryStock("JX10001")
|
||||
result, err := api.QueryStock("")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user