eclp增加仓库查询接口,增加银豹api
This commit is contained in:
@@ -281,7 +281,7 @@ func (a *API) SearchShopStock(goodsNo string) (searchShopStockResult *SearchShop
|
||||
"requestId": utils.GetUUID(),
|
||||
"deptNo": DepartmentNo,
|
||||
"shopNo": ShopNo,
|
||||
"pageSize": 1000,
|
||||
"pageSize": 100,
|
||||
"pageNumber": 1,
|
||||
}
|
||||
if goodsNo != "" {
|
||||
@@ -294,35 +294,20 @@ func (a *API) SearchShopStock(goodsNo string) (searchShopStockResult *SearchShop
|
||||
return searchShopStockResult, err
|
||||
}
|
||||
|
||||
//获取tokenCode
|
||||
//https://oauth.jd.com/oauth/authorize?response_type=code&client_id=YOUR_APP_KEY&redirect_uri=YOUR_REGISTERED_REDIRECT_URI&state=YOUR_CUSTOM_CODE
|
||||
//https://oauth.jd.com/oauth/authorize?response_type=code&client_id=YOUR_APP_KEY&redirect_uri=urn:ietf:wg:oauth:2.0:oob&state=1212
|
||||
// func (a *API) GetTokenInfo() (code string, err error) {
|
||||
// result, err := a.AccessAPI("authorize", prodURL2, map[string]interface{}{
|
||||
// "response_type": "code",
|
||||
// "client_id": a.appKey,
|
||||
// "redirect_uri": a.redirectUri,
|
||||
// "state": state,
|
||||
// })
|
||||
// if err == nil {
|
||||
// code = result["code"].(string)
|
||||
// }
|
||||
// return code, err
|
||||
// }
|
||||
|
||||
//获取token
|
||||
//https://oauth.jd.com/oauth/token?grant_type=authorization_code&client_id=YOUR_APP_KEY&redirect_uri=YOUR_REGISTERED_REDIRECT_URI&code=GET_CODE&state=YOUR_CUSTOM_CODE&client_secret= YOUR_APP_SECRET
|
||||
// func (a *API) GetToken() (token string, err error) {
|
||||
// code, err := a.GetTokenInfo()
|
||||
// result, err := a.AccessAPI("token", prodURL2, map[string]interface{}{
|
||||
// "grant_type": "authorization_code",
|
||||
// "client_id": a.appKey,
|
||||
// "redirect_uri": a.redirectUri,
|
||||
// "code": code,
|
||||
// "state": state,
|
||||
// })
|
||||
// if err == nil {
|
||||
// token = result["token"].(string)
|
||||
// }
|
||||
// return token, err
|
||||
// }
|
||||
//查询仓库商品库存
|
||||
//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) {
|
||||
params := map[string]interface{}{
|
||||
"deptNo": DepartmentNo,
|
||||
"warehouseNo": WarehouseNo,
|
||||
"returnZeroStock": 2, //表示返回库存为0的数据
|
||||
}
|
||||
if goodsNo != "" {
|
||||
params["goodsNo"] = goodsNo
|
||||
}
|
||||
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)
|
||||
}
|
||||
return searchShopStockResult, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user