From 939842ec1a576e216ecb9c9cec699214e28b292c Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 2 Oct 2023 15:15:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/product/ProductRepository.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/common/repositories/store/product/ProductRepository.php b/app/common/repositories/store/product/ProductRepository.php index b07c60f7..279862e4 100644 --- a/app/common/repositories/store/product/ProductRepository.php +++ b/app/common/repositories/store/product/ProductRepository.php @@ -663,9 +663,7 @@ class ProductRepository extends BaseRepository public function getAdminOneProduct(int $id, ?int $activeId, $conType = 0) { $with = ['attr', 'attrValue', 'oldAttrValue', 'merCateId.category', 'storeCategory', 'brand', 'temp', 'seckillActive', - 'content' => function($query) use($conType){ - $query->where('type',$conType); - }, + 'content', 'merchant'=> function($query){ $query->field('mer_id,mer_avatar,mer_name,is_trader'); }, @@ -753,7 +751,16 @@ class ProductRepository extends BaseRepository $data['attrValue'] = $arr; $content = $data['content']['content'] ?? ''; - if ($conType) $content = json_decode($content); + if (isset($data['content']) &&$data['content']['type']==1){ + $arr = json_decode($content); + if($arr){ + $content=''; + foreach($arr->image as $k=>$v){ + $content.='
'; + } + + } + } unset($data['content']); $data['content'] = $content; return $data;