diff --git a/app/api/controller/sharp/Goods.php b/app/api/controller/sharp/Goods.php index a3df1f79..ee1535a5 100644 --- a/app/api/controller/sharp/Goods.php +++ b/app/api/controller/sharp/Goods.php @@ -18,6 +18,7 @@ use app\api\service\User as UserService; use app\api\service\sharp\Active as ActiveService; use app\common\service\qrcode\sharp\Goods as GoodsPoster; use cores\exception\BaseException; +use app\api\service\Setting as SettingService; /** * 整点秒杀-商品管理 @@ -57,6 +58,12 @@ class Goods extends Controller // 获取秒杀活动商品详情 $service = new ActiveService; $data = $service->getActiveGoodsDetail($activeTimeId, $sharpGoodsId); + $storeId = $data['active']['store_id']; + $merchantId = $data['goods']['merchant_id']; + //获取客服设置 + $service = new SettingService; + $setting = $service->getGoodsCustomer($merchantId,$storeId); + $data['setting'] = $setting; return $this->renderSuccess($data); } diff --git a/app/common/model/sharp/Goods.php b/app/common/model/sharp/Goods.php index 084920a2..5d0f01a2 100644 --- a/app/common/model/sharp/Goods.php +++ b/app/common/model/sharp/Goods.php @@ -112,7 +112,12 @@ class Goods extends BaseModel $item['goods_image'] = !empty($item['goods']['goods_image']) ? $item['goods']['goods_image'] : ''; // 秒杀商品原价 (获取主商品价格) //$item['original_price'] = !empty($item['goods']['original_price']) ? $item['goods']['original_price']: $item['goods']['goods_price_min']; - $item['original_price'] = isset($item['goods']['original_price']) ? $item['goods']['original_price'] : $item['goods']['goods_price_min']; + if (isset($item['goods']) && $item['goods'] !== null) { + $item['original_price'] = isset($item['goods']['original_price']) ? $item['goods']['original_price'] : $item['goods']['goods_price_min']; + } else { + // 可以设置一个默认值或处理逻辑 + $item['original_price'] = null; // 或者其他默认值 + } // 回调函数 is_callable($callback) && call_user_func($callback, $item); }