diff --git a/app/api/controller/Goods.php b/app/api/controller/Goods.php index 2657c976..d4ef633f 100644 --- a/app/api/controller/Goods.php +++ b/app/api/controller/Goods.php @@ -85,17 +85,26 @@ class Goods extends Controller if ($goodsInfo['channel'] == 'sn') { $goodsInfo['link'] = ""; } - //获取商户id - $merchantId = $goodsInfo['merchant_id']; - $storeId = $goodsInfo['store_id']; + //获取商户id-兼容有上级商城的商城 + if ($this->storeInfo->p_store_id) { + $merchantId = 0; + $storeId = $this->storeId; + } else { + $merchantId = $goodsInfo['merchant_id']; + $storeId = $goodsInfo['store_id']; + } + //获取客服设置 $service = new SettingService; $setting = $service->getGoodsCustomer($merchantId,$storeId); $goodsInfo['setting'] = $setting; - //京东短链 - $jd = new Jd(); - $jd_short_url = $jd->getJdShortLink($goodsInfo['goods_no']); + //京东短链-非小程序终端不需要京东短链 + if (request()->header()['platform'] == "MP-WEIXIN") { + $jd = new Jd(); + $jd_short_url = $jd->getJdShortLink($goodsInfo['goods_no']); + } + //获取商品短链 $goodsInfo['jd_short_url'] = $jd_short_url[0]['link'] ?? ""; return $this->renderSuccess(['detail' => $goodsInfo]);