feat: #10000 店铺不存在商品,同步库存优化

This commit is contained in:
赵世界 2022-09-01 10:11:39 +08:00
parent 456943326d
commit 2044dd4d6b

View File

@ -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;