- 京东门店信息查询相关的三个API返回值改为具体的struct
This commit is contained in:
@@ -41,6 +41,38 @@ type SkuIdEntity struct {
|
||||
OutSkuId string `json:"outSkuId"`
|
||||
}
|
||||
|
||||
type StorePriceInfo struct {
|
||||
MarketPrice int64 `json:"marketPrice"`
|
||||
Pin string `json:"pin"`
|
||||
Price int64 `json:"price"`
|
||||
PromoteVipPrice int64 `json:"promoteVipPrice"`
|
||||
SkuID int64 `json:"skuId"`
|
||||
StationNo string `json:"stationNo"`
|
||||
VenderID string `json:"venderId"`
|
||||
VipPrice int64 `json:"vipPrice"`
|
||||
}
|
||||
|
||||
type QueryStockResponse struct {
|
||||
SkuID int64 `json:"skuId"`
|
||||
StationNo string `json:"stationNo"`
|
||||
UsableQty int `json:"usableQty"`
|
||||
LockQty int `json:"lockQty"`
|
||||
OrderQty int `json:"orderQty"`
|
||||
Vendibility int `json:"vendibility"`
|
||||
}
|
||||
|
||||
type UpdateVendibilityResponse struct {
|
||||
Code int `json:"code"`
|
||||
CurrentQty int `json:"currentQty"`
|
||||
LockQty int `json:"lockQty"`
|
||||
Msg string `json:"msg"`
|
||||
OrderQty int `json:"orderQty"`
|
||||
OutSkuID string `json:"outSkuId"`
|
||||
SkuID int64 `json:"skuId"`
|
||||
UsableQty int `json:"usableQty"`
|
||||
Vendibility int `json:"vendibility"`
|
||||
}
|
||||
|
||||
// 传入为数组的,最多一次为50个
|
||||
// 有好些功能有两个类似的函数,一个为到家ID,一个为商家ID,建议都只用商家ID的那个,因为:
|
||||
// 1,这类函数一般可以批量操作
|
||||
@@ -85,16 +117,16 @@ func (a *API) UpdateStationPrice(skuId int64, stationNo string, price int) (stri
|
||||
|
||||
// 根据到家商品编码和到家门店编码批量查询商品门店价格信息接口
|
||||
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=205&apiid=21ccd5a00d3a4582b4c9a8ef0ae238fc
|
||||
func (a *API) GetStationInfoList(stationNo string, skuIds []int64) ([]map[string]interface{}, error) {
|
||||
func (a *API) GetStationInfoList(stationNo string, skuIds []int64) (priceInfo []*StorePriceInfo, err error) {
|
||||
jdParams := map[string]interface{}{
|
||||
"skuIds": skuIds,
|
||||
"stationNo": stationNo,
|
||||
}
|
||||
result, err := a.AccessAPINoPage("price/getStationInfoList", jdParams, nil, nil, nil)
|
||||
result, err := a.AccessAPINoPage("price/getStationInfoList", jdParams, nil, nil, genNoPageResultParser("code", "detail", "result", "0"))
|
||||
if err == nil && result != nil {
|
||||
return utils.Slice2MapSlice(result.([]interface{})), nil
|
||||
err = utils.Map2StructByJson(result, &priceInfo, false)
|
||||
}
|
||||
return nil, err
|
||||
return priceInfo, err
|
||||
}
|
||||
|
||||
// 根据商家商品编码和商家门店编码批量修改现货库存接口
|
||||
@@ -174,20 +206,20 @@ func (a *API) BatchUpdateVendibility(outStationNo, stationNo string, stockVendib
|
||||
// 根据到家商品编码和门店编码批量查询商品库存及可售状态信息接口
|
||||
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=200&apiid=bc6ad75e8fd34580856e06b5eb149aad
|
||||
// 尽量不用这个接口,用下面那个
|
||||
func (a *API) QueryOpenUseable(listBaseStockCenterRequest []*BaseStockCenterRequest) ([]map[string]interface{}, error) {
|
||||
func (a *API) QueryOpenUseable(listBaseStockCenterRequest []*BaseStockCenterRequest) (stockResponse []*QueryStockResponse, err error) {
|
||||
jdParams := map[string]interface{}{
|
||||
"listBaseStockCenterRequest": listBaseStockCenterRequest,
|
||||
}
|
||||
result, err := a.AccessAPINoPage("stock/queryOpenUseable", jdParams, nil, nil, genNoPageResultParser("retCode", "retMsg", "data", "0"))
|
||||
if err == nil && result != nil {
|
||||
return utils.Slice2MapSlice(result.([]interface{})), nil
|
||||
err = utils.Map2StructByJson(result, &stockResponse, false)
|
||||
}
|
||||
return nil, err
|
||||
return stockResponse, err
|
||||
}
|
||||
|
||||
// 根据商家商品编码和门店编码批量查询商品库存及可售状态信息接口
|
||||
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=200&apiid=ba70316bb84f425f8c088d3c19b2570d
|
||||
func (a *API) QueryStockCenter(outStationNo string, skuIds []*SkuIdEntity, userPin string) ([]map[string]interface{}, error) {
|
||||
func (a *API) QueryStockCenter(outStationNo string, skuIds []*SkuIdEntity, userPin string) (vendibilityResponse []*UpdateVendibilityResponse, err error) {
|
||||
jdParams := map[string]interface{}{
|
||||
"outStationNo": outStationNo,
|
||||
"skuIds": skuIds,
|
||||
@@ -195,7 +227,7 @@ func (a *API) QueryStockCenter(outStationNo string, skuIds []*SkuIdEntity, userP
|
||||
}
|
||||
result, err := a.AccessAPINoPage("stock/queryStockCenter", jdParams, nil, nil, genNoPageResultParser("retCode", "retMsg", "data", "0"))
|
||||
if err == nil && result != nil {
|
||||
return utils.Slice2MapSlice(result.([]interface{})), nil
|
||||
err = utils.Map2StructByJson(result, &vendibilityResponse, false)
|
||||
}
|
||||
return nil, err
|
||||
return vendibilityResponse, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user