StoreSkuBatchUpdateResponse.Code改为string
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user