Kaynağa Gözat

Merge branch 'dev-xpy' into dev

xupuyuan 4 ay önce
ebeveyn
işleme
f9dc1d02bd

+ 13 - 0
app/common/repositories/store/product/ProductRepository.php

@@ -1016,6 +1016,19 @@ class ProductRepository extends BaseRepository
1016 1016
         }
1017 1017
 
1018 1018
         $res['isRelation'] = $isRelation ?? false;
1019
+        foreach ($res['attrValue'] as $k => $value) {
1020
+            $detail = $value['detail'] ?? null;
1021
+            if (is_array($detail) && count($detail) > 0) {
1022
+                $sku = implode(',', $detail);
1023
+            } else {
1024
+                $detail = ['默认'];
1025
+                $sku = '默认';
1026
+            }
1027
+            $res['attrValue'][$k]['detail'] = $detail;
1028
+            if (empty($value['sku'])) {
1029
+                $res['attrValue'][$k]['sku'] = $sku;
1030
+            }
1031
+        }
1019 1032
         $res['sku'] = $this->detailAttrValue($res['attrValue'], $userInfo, $res['product_type']);
1020 1033
         $res['sales'] = $res['sales'] + $res['ficti'];
1021 1034
         $res['replayData'] = app()->make(ProductReplyRepository::class)->getReplyRate($res['product_id']);