StoreSkuBatchUpdateResponse.Code改为string

This commit is contained in:
gazebo
2019-11-20 16:01:59 +08:00
parent da44f1f49e
commit 21fe1e55dc

View File

@@ -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)
}
}