+ UpdateCurrentQty,
This commit is contained in:
@@ -78,6 +78,16 @@ type StoreSkuBatchUpdateResponse struct {
|
|||||||
OutSkuID string `json:"outSkuId"`
|
OutSkuID string `json:"outSkuId"`
|
||||||
Code int `json:"code"`
|
Code int `json:"code"`
|
||||||
Msg string `json:"msg"`
|
Msg string `json:"msg"`
|
||||||
|
|
||||||
|
// UpdateVendibility会返回以下字段
|
||||||
|
SkuID int64 `json:"skuId"`
|
||||||
|
StationNo string `json:"stationNo"`
|
||||||
|
BusinessNo int `json:"businessNo"`
|
||||||
|
CreatePin string `json:"createPin"`
|
||||||
|
StockQty int `json:"stockQty"`
|
||||||
|
StockSource int `json:"stockSource"`
|
||||||
|
UpdatePin string `json:"updatePin"`
|
||||||
|
Vendibility int `json:"vendibility"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 传入为数组的,最多一次为50个
|
// 传入为数组的,最多一次为50个
|
||||||
@@ -108,7 +118,7 @@ func (a *API) UpdateVendorStationPrice(outStationNo, stationNo string, skuPriceI
|
|||||||
|
|
||||||
// 根据到家商品编码和到家门店编码修改门店价格接口
|
// 根据到家商品编码和到家门店编码修改门店价格接口
|
||||||
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=205&apiid=45f83ef7c6e74dad94b6b68d3c50b673
|
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=205&apiid=45f83ef7c6e74dad94b6b68d3c50b673
|
||||||
// 此接口基本可以不用
|
// 单商品用此接口
|
||||||
func (a *API) UpdateStationPrice(skuId int64, stationNo string, price int) (string, error) {
|
func (a *API) UpdateStationPrice(skuId int64, stationNo string, price int) (string, error) {
|
||||||
jdParams := map[string]interface{}{
|
jdParams := map[string]interface{}{
|
||||||
"skuId": skuId,
|
"skuId": skuId,
|
||||||
@@ -178,10 +188,11 @@ func (a *API) BatchUpdateCurrentQtys(outStationNo, stationNo string, skuStockLis
|
|||||||
// 根据商家商品编码和商家门店编码更新门店现货库存接口
|
// 根据商家商品编码和商家门店编码更新门店现货库存接口
|
||||||
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=200&apiid=a78664d4ead349da95d2f4576ed18d7f
|
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=200&apiid=a78664d4ead349da95d2f4576ed18d7f
|
||||||
// 此接口基本可以不用
|
// 此接口基本可以不用
|
||||||
func (a *API) StockUpdate(stationNo string, skuId int64, currentQty int) error {
|
func (a *API) StockUpdate(outStationNo string, outSkuID string, currentQty int) error {
|
||||||
|
// !这个接口的stationNo与skuId好像本身就写错了的
|
||||||
jdParams := map[string]interface{}{
|
jdParams := map[string]interface{}{
|
||||||
"stationNo": stationNo,
|
"stationNo": outStationNo,
|
||||||
"skuId": skuId,
|
"skuId": outSkuID,
|
||||||
"currentQty": currentQty,
|
"currentQty": currentQty,
|
||||||
}
|
}
|
||||||
_, err := a.AccessAPINoPage("stock/update", jdParams, nil, nil, genNoPageResultParser("retCode", "retMsg", "", ""))
|
_, err := a.AccessAPINoPage("stock/update", jdParams, nil, nil, genNoPageResultParser("retCode", "retMsg", "", ""))
|
||||||
@@ -191,16 +202,32 @@ func (a *API) StockUpdate(stationNo string, skuId int64, currentQty int) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 根据到家商品编码和到家门店编码更新门店现货库存
|
||||||
|
// https://openo2o.jddj.com/staticnew/widgets/resources.html?groupid=200&apiid=af70e699d4974e1683128742018f6381
|
||||||
|
// 单商品用此接口
|
||||||
|
func (a *API) UpdateCurrentQty(stationNo string, skuID int64, currentQty int) error {
|
||||||
|
jdParams := map[string]interface{}{
|
||||||
|
"stationNo": stationNo,
|
||||||
|
"skuId": skuID,
|
||||||
|
"currentQty": currentQty,
|
||||||
|
}
|
||||||
|
_, err := a.AccessAPINoPage("update/currentQty", jdParams, nil, nil, genNoPageResultParser("retCode", "retMsg", "", ""))
|
||||||
|
if err == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// 根据到家商品编码和到家门店编码批量修改门店商品可售状态接口
|
// 根据到家商品编码和到家门店编码批量修改门店商品可售状态接口
|
||||||
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=200&apiid=b783a508e2cf4aca94681e4eed9af5bc
|
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=200&apiid=b783a508e2cf4aca94681e4eed9af5bc
|
||||||
// 尽量不用这个接口,用下面那个
|
// 尽量不用这个接口,用下面那个
|
||||||
func (a *API) UpdateVendibility(listBaseStockCenterRequest []*QueryStockRequest) ([]map[string]interface{}, error) {
|
func (a *API) UpdateVendibility(listBaseStockCenterRequest []*QueryStockRequest) (responseList []*StoreSkuBatchUpdateResponse, err error) {
|
||||||
jdParams := map[string]interface{}{
|
jdParams := map[string]interface{}{
|
||||||
"listBaseStockCenterRequest": listBaseStockCenterRequest,
|
"listBaseStockCenterRequest": listBaseStockCenterRequest,
|
||||||
}
|
}
|
||||||
result, err := a.AccessAPINoPage("stock/updateVendibility", jdParams, nil, nil, genNoPageResultParser("retCode", "retMsg", "data", "0"))
|
result, err := a.AccessAPINoPage("stock/updateVendibility", jdParams, nil, nil, genNoPageResultParser("retCode", "retMsg", "data", "0"))
|
||||||
if err == nil && result != nil {
|
if err == nil && result != nil {
|
||||||
return utils.Slice2MapSlice(result.([]interface{})), nil
|
responseList, err = a.handleBatchOpResult(len(listBaseStockCenterRequest), result)
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,3 +57,17 @@ func TestBatchUpdateVendibility(t *testing.T) {
|
|||||||
}
|
}
|
||||||
baseapi.SugarLogger.Debug(utils.Format4Output(result, false))
|
baseapi.SugarLogger.Debug(utils.Format4Output(result, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestUpdateVendibility(t *testing.T) {
|
||||||
|
result, err := api.UpdateVendibility([]*QueryStockRequest{
|
||||||
|
&QueryStockRequest{
|
||||||
|
StationNo: "11053496",
|
||||||
|
SkuId: 2012224772,
|
||||||
|
DoSale: 1,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
baseapi.SugarLogger.Debug(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user