From ae997b85defd41150ae84b3d9eb0ccd089ecd7d9 Mon Sep 17 00:00:00 2001 From: evoxwht <442384644@qq.com> Date: Wed, 7 Jun 2023 10:49:56 +0800 Subject: [PATCH] =?UTF-8?q?=E8=99=9A=E6=8B=9F=E8=AF=84=E8=AE=BA=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E8=A7=84=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/product/StoreProductReplyServices.php | 6 ++++-- .../services/product/product/StoreProductServices.php | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/crmeb/app/services/product/product/StoreProductReplyServices.php b/crmeb/app/services/product/product/StoreProductReplyServices.php index a29266557..e5399edbb 100644 --- a/crmeb/app/services/product/product/StoreProductReplyServices.php +++ b/crmeb/app/services/product/product/StoreProductReplyServices.php @@ -131,10 +131,12 @@ class StoreProductReplyServices extends BaseServices public function getRecProductReply(int $productId) { $res = $this->dao->getProductReply($productId); + if ($res) { $res = $res->toArray(); -// $res['cart_info'] = isset($res['cart_info']) ? json_decode($res['cart_info'], true) : []; - $res['suk'] = isset($res['cart_info']['productInfo']['attrInfo']) ? $res['cart_info']['productInfo']['attrInfo']['suk'] : ''; + if ($res['suk'] == '') { + $res['suk'] = isset($res['cart_info']['productInfo']['attrInfo']) ? $res['cart_info']['productInfo']['attrInfo']['suk'] : ''; + } $res['nickname'] = anonymity($res['nickname']); $res['merchant_reply_time'] = date('Y-m-d H:i', $res['merchant_reply_time']); $res['add_time'] = time_tran($res['add_time']); diff --git a/crmeb/app/services/product/product/StoreProductServices.php b/crmeb/app/services/product/product/StoreProductServices.php index 5fca857c7..cf6648895 100644 --- a/crmeb/app/services/product/product/StoreProductServices.php +++ b/crmeb/app/services/product/product/StoreProductServices.php @@ -865,6 +865,15 @@ class StoreProductServices extends BaseServices $item['cost'] = floatval($item['cost']); $item['is_product_type'] = 1; $item['logistics'] = explode(',', $item['logistics']); + $attrs = $this->getProductRules($item['id'], 0)['attrs']; + foreach ($attrs as $items) { + $item['attrs'][] = [ + 'image' => $items['pic'], + 'price' => $items['price'], + 'ot_price' => $items['ot_price'], + 'sku' => implode(',', $items['detail']) + ]; + } } return $data; }