diff --git a/app/Services/Business/BusinessClient.php b/app/Services/Business/BusinessClient.php index a42e6dc..b389bc2 100644 --- a/app/Services/Business/BusinessClient.php +++ b/app/Services/Business/BusinessClient.php @@ -154,9 +154,6 @@ abstract class BusinessClient } $log->save(); } - if (isset($res['error_response'])) { - exit(); - } return $res; } diff --git a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php index 5c953a1..034f86d 100644 --- a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php +++ b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php @@ -119,8 +119,17 @@ class KuaiTuanTuan extends BusinessClient } $publicParams = array_merge($publicParams, $appendParams); $publicParams['sign'] = $this->getSign($publicParams); + $res = $this->formDataPostRequest($url, $publicParams); + if (isset($res['error_response'])) { + // ToDo 重构异常处理 + if ('业务服务错误' === $res['error_response']['error_msg'] && '该店铺下不存在该商品' === $res['error_response']['sub_msg']) { + BusinessGoodsSku::where('goods_id', $appendParams['goods_id'])->where('sku_id', $appendParams['sku_id'])->delete(); + } else { + throw new \RuntimeException($res['error_response']['error_msg'] . ':' . $res['error_response']['error_msg']); + } + } - return $this->formDataPostRequest($url, $publicParams); + return $res; } public function downloadGoods($skuId)