更新商品价格
This commit is contained in:
@@ -444,14 +444,38 @@ func (a *API) SkuPriceUpdateBatch(trackInfo, shopID string, priceList ShopSkuInf
|
|||||||
return opResult, err
|
return opResult, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) SkuPriceUpdateOne(trackInfo, shopID string, priceInfo *ShopSkuInfo) (err error) {
|
func (a *API) SkuPriceUpdateOne(trackInfo, shopID string, priceInfo *ShopSkuInfo) (opResult *BatchOpResult, err error) {
|
||||||
skuIDType := priceInfo.GuessIDType()
|
skuIDType := priceInfo.GuessIDType()
|
||||||
params := map[string]interface{}{
|
params := map[string]interface{}{
|
||||||
KeyShopID: shopID,
|
KeyShopID: shopID,
|
||||||
priceUpdateKeyIDMap[skuIDType]: priceInfo.PriceString(skuIDType),
|
priceUpdateKeyIDMap[skuIDType]: priceInfo.PriceString(skuIDType),
|
||||||
}
|
}
|
||||||
_, err = a.AccessAPI2("sku.price.update.one", params, trackInfo)
|
result, err := a.AccessAPI2("sku.price.update.one", params, trackInfo)
|
||||||
return err
|
resultMap := utils.Struct2MapByJson(result)
|
||||||
|
if resultMap["errno"] == 0 {
|
||||||
|
var successList []*BatchOpSkuResult
|
||||||
|
success := &BatchOpSkuResult{
|
||||||
|
SkuID: priceInfo.SkuID,
|
||||||
|
ErrorMsg: resultMap["error"].(string),
|
||||||
|
ErrorNo: resultMap["errno"].(int),
|
||||||
|
}
|
||||||
|
successList = append(successList, success)
|
||||||
|
opResult = &BatchOpResult{
|
||||||
|
SuccessList: successList,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var failedList []*BatchOpSkuResult
|
||||||
|
failed := &BatchOpSkuResult{
|
||||||
|
SkuID: priceInfo.SkuID,
|
||||||
|
ErrorMsg: resultMap["error"].(string),
|
||||||
|
ErrorNo: resultMap["errno"].(int),
|
||||||
|
}
|
||||||
|
failedList = append(failedList, failed)
|
||||||
|
opResult = &BatchOpResult{
|
||||||
|
FailedList: failedList,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return opResult, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) SkuStockUpdateBatch(trackInfo, shopID string, stockList ShopSkuInfoList, skuIDType int) (opResult *BatchOpResult, err error) {
|
func (a *API) SkuStockUpdateBatch(trackInfo, shopID string, stockList ShopSkuInfoList, skuIDType int) (opResult *BatchOpResult, err error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user