From 21fe1e55dcd963730f50fd1c99992142c3cf0f84 Mon Sep 17 00:00:00 2001 From: gazebo Date: Wed, 20 Nov 2019 16:01:59 +0800 Subject: [PATCH] =?UTF-8?q?StoreSkuBatchUpdateResponse.Code=E6=94=B9?= =?UTF-8?q?=E4=B8=BAstring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformapi/jdapi/store_sku.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platformapi/jdapi/store_sku.go b/platformapi/jdapi/store_sku.go index 86b09b7c..7bd3103f 100644 --- a/platformapi/jdapi/store_sku.go +++ b/platformapi/jdapi/store_sku.go @@ -79,7 +79,7 @@ type UpdateVendibilityResponse struct { type StoreSkuBatchUpdateResponse struct { OutSkuID string `json:"outSkuId" json2:"outSkuId"` - Code int `json:"code" json2:"errorCode"` + Code string `json:"code" json2:"errorCode"` // 这个Code有可能返回19000B这种形式,只能当成字符串处理 Msg string `json:"msg" json2:"errorMessage"` // UpdateVendibility会返回以下字段 @@ -93,6 +93,10 @@ type StoreSkuBatchUpdateResponse struct { Vendibility int `json:"vendibility"` } +func IsCodeSuccess(code string) bool { + return code == "" || code == "0" +} + // 传入为数组的,最多一次为50个 // 有好些功能有两个类似的函数,一个为到家ID,一个为商家ID,建议都只用商家ID的那个,因为: // 1,这类函数一般可以批量操作 @@ -154,7 +158,7 @@ func (a *API) handleBatchOpResult(outStationNo, stationNo string, batchCount int if err = utils.Map2Struct(result, &responseList, true, tagName, JavaDateHook); err == nil { var failedList []*StoreSkuBatchUpdateResponse for _, v := range responseList { - if v.Code != 0 { + if !IsCodeSuccess(v.Code) { failedList = append(failedList, v) } }