gorden 7 сар өмнө
parent
commit
193c4fd7dd

+ 7 - 6
app/admin/service/goods/GoodsService.php

@@ -519,9 +519,9 @@ class GoodsService
         $data = array_merge($data,$categorys);
 
         foreach ($categorys as $category){
-            if(empty($category['category_super_path'])){
+            // if(empty($category['category_super_path'])){
                 $category['category_super_path'] = '#'.$category['id'].'#';
-            }
+            // }
             $subCategory = SysCategory::where('category_super_path','like','%'.$category['category_super_path'].'%')
                 ->where('category_status','ACTIVED')
                 ->select('category_id as id','category_name as name','category_super_id as pid','category_super_path')
@@ -535,7 +535,7 @@ class GoodsService
         $goods = Goods::with('sku')
             ->whereIn('join_goods_category_id',$goodsCategoryIds)
             ->where('goods_status','ON')
-            ->select('goods_id','goods_id as id','goods_name as name','join_goods_category_id as pid','goods_attribute_json')
+            ->select('goods_id','goods_id as id','goods_name as name','join_goods_category_id as pid','goods_attribute_json','goods_classify')
             ->orderBy('goods_sort','DESC')
             ->orderBy('goods_addtimes','DESC')
             ->get()
@@ -548,13 +548,14 @@ class GoodsService
 
                         $skuName = '';
                         foreach ($good['sku'][$key]['goods_sku_specs_json'] as $specsKey => $skuSpecs) {
+                            $keyStr = ($specsKey  == '规格') ? '' : ($specsKey.':');
                             if (is_array($skuSpecs)) {
-                                $skuName = $skuName . ' ' . implode(' ', $skuSpecs) . ';';
+                                $skuName = $skuName  .$keyStr . ' ' . implode(' ', $skuSpecs) . '; ';
                             } else {
-                                $skuName = $skuName . ' ' . $skuSpecs . ';';
+                                $skuName = $skuName .$keyStr . ' ' . $skuSpecs . '; ';
                             }
                         }
-                        $good['sku'][$key]['sku_name'] = rtrim($skuName,';');
+                        $good['sku'][$key]['sku_name'] = rtrim($skuName,'; ');
                     }
                 }
             } else {