2 次代码提交 9092103120 ... 39a9971723

作者 SHA1 备注 提交日期
  xupuyuan 39a9971723 Merge branch 'dev-xpy' into dev 6 月之前
  xupuyuan 3f29d25e8d 商品详情-增加单规格商品填充detail的功能 6 月之前
共有 1 个文件被更改,包括 5 次插入 和 1 次删除
  1. 5 1
      app/common/repositories/store/product/ProductRepository.php

+ 5 - 1
app/common/repositories/store/product/ProductRepository.php

@@ -418,8 +418,12 @@ class ProductRepository extends BaseRepository
418
                 $value['plate_mer_profit'] = $value['gong_mer_profit'];
418
                 $value['plate_mer_profit'] = $value['gong_mer_profit'];
419
 
419
 
420
                 $sku = '';
420
                 $sku = '';
421
-                if (isset($value['detail']) && is_array($value['detail'])) {
421
+                if (isset($value['detail']) && is_array($value['detail']) && count($value['detail']) > 0) {
422
                     $sku = implode(',', $value['detail']);
422
                     $sku = implode(',', $value['detail']);
423
+                } else {
424
+                    // 单规格情况,detail填充默认内容
425
+                    $value['detail'] = ['默认'];
426
+                    $sku = '默认';
423
                 }
427
                 }
424
                 $product_data = Db::name('store_product')->where('product_id', $id)->value('spu_id');
428
                 $product_data = Db::name('store_product')->where('product_id', $id)->value('spu_id');
425
                 if ($product_data) {
429
                 if ($product_data) {