From 060619350856b99a469dbcc7d267dec3ea9da7ba Mon Sep 17 00:00:00 2001 From: zengyyh Date: Fri, 25 Oct 2024 23:13:43 +0800 Subject: [PATCH] 1 --- app/api/controller/Goods.php | 8 ++++++-- app/store/controller/Goods.php | 7 +++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/api/controller/Goods.php b/app/api/controller/Goods.php index cfe64d9e..023ed1da 100644 --- a/app/api/controller/Goods.php +++ b/app/api/controller/Goods.php @@ -564,7 +564,7 @@ class Goods extends Controller { $id = $this->request->param('id'); $detail = ModelTipoff::where('id',$id)->find(); - $goodsList = GoodsModel::whereIn("goods_id",$detail['goods_id'])->field('goods_id,goods_name,goods_price_min,cost_price_min,goods_no')->select(); + $goodsList = GoodsModel::whereIn("goods_id",$detail['goods_id'])->field('goods_id,goods_name,goods_price_min,cost_price_min,goods_no,link')->select(); $goods_no = []; $JdModel = new jd(); @@ -576,7 +576,11 @@ class Goods extends Controller foreach ($goodsList as $key => &$value) { $cates = GoodsCategoryRel::where('goods_id', $value['goods_id'])->select()->toArray(); - $value['jd_short_url'] = $jd_url[$value['goods_no']]['link'] ?? ""; + + $value['jd_short_url'] = $jd_url[$value['goods_no']]['link']; + if(empty($value['jd_short_url'])){ + $value['jd_short_url'] = $value['link']; + } //分类 if ($cates) { //会员价 diff --git a/app/store/controller/Goods.php b/app/store/controller/Goods.php index 8cca7b52..0e5942c2 100644 --- a/app/store/controller/Goods.php +++ b/app/store/controller/Goods.php @@ -697,7 +697,7 @@ class Goods extends Controller { $id = $this->request->param('id'); $detail = ModelTipoff::where('id',$id)->find(); - $goodsList = GoodsModel::whereIn("goods_id",$detail['goods_id'])->field('goods_id,goods_name,goods_price_min,cost_price_min,goods_no')->select(); + $goodsList = GoodsModel::whereIn("goods_id",$detail['goods_id'])->field('goods_id,goods_name,goods_price_min,cost_price_min,goods_no,link')->select(); $goods_no = []; $JdModel = new jd(); @@ -709,7 +709,10 @@ class Goods extends Controller foreach ($goodsList as $key => &$value) { $cates = GoodsCategoryRel::where('goods_id', $value['goods_id'])->select()->toArray(); - $value['jd_short_url'] = $jd_url[$value['goods_no']]['link'] ?? ""; + $value['jd_short_url'] = $jd_url[$value['goods_no']]['link']; + if(empty($value['jd_short_url'])){ + $value['jd_short_url'] = $value['link']; + } //分类 if ($cates) { //会员价