From 456943326de180643893d81ef6ac3a18d758b5f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Thu, 1 Sep 2022 09:56:08 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20#10000=20=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E8=BF=94=E5=9B=9E=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/Business/BusinessClient.php | 3 --- app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php | 6 +++++- 2 files changed, 5 insertions(+), 4 deletions(-) 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..b385410 100644 --- a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php +++ b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php @@ -119,8 +119,12 @@ class KuaiTuanTuan extends BusinessClient } $publicParams = array_merge($publicParams, $appendParams); $publicParams['sign'] = $this->getSign($publicParams); + $res = $this->formDataPostRequest($url, $publicParams); + if (isset($res['error_response'])) { + throw new \RuntimeException($res['error_response']['error_msg']); + } - return $this->formDataPostRequest($url, $publicParams); + return $res; } public function downloadGoods($skuId) From 2044dd4d6b9669da1e094e45287d7224b2798d85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Thu, 1 Sep 2022 10:11:39 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20#10000=20=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E4=B8=8D=E5=AD=98=E5=9C=A8=E5=95=86=E5=93=81,=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E5=BA=93=E5=AD=98=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php index b385410..034f86d 100644 --- a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php +++ b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php @@ -121,7 +121,12 @@ class KuaiTuanTuan extends BusinessClient $publicParams['sign'] = $this->getSign($publicParams); $res = $this->formDataPostRequest($url, $publicParams); if (isset($res['error_response'])) { - throw new \RuntimeException($res['error_response']['error_msg']); + // 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 $res;