作者 lyh

gx

@@ -40,7 +40,7 @@ class CategoryController extends BaseController @@ -40,7 +40,7 @@ class CategoryController extends BaseController
40 $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id 40 $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id
41 foreach ($list as $k =>$v){ 41 foreach ($list as $k =>$v){
42 $v['url'] = $this->user['domain'] . $v['route'].'/'; 42 $v['url'] = $this->user['domain'] . $v['route'].'/';
43 -// $v['product_num'] = Category::getProductNum($v['id']); 43 + $v['product_num'] = Category::getProductNum($v['id']);
44 $v['image_link'] = getImageUrl($v['image']); 44 $v['image_link'] = getImageUrl($v['image']);
45 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']); 45 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']);
46 $list[$k] = $v; 46 $list[$k] = $v;
@@ -53,15 +53,15 @@ class Category extends Base @@ -53,15 +53,15 @@ class Category extends Base
53 public static function getProductNum($cate_id){ 53 public static function getProductNum($cate_id){
54 $cate_ids = self::getChildIdsArr($cate_id); 54 $cate_ids = self::getChildIdsArr($cate_id);
55 $str = 0; 55 $str = 0;
56 - foreach ($cate_ids as $v){  
57 - $info = self::where('pid',$v)->first();  
58 - if($info){  
59 - continue;  
60 - }else{  
61 - $count = Product::where('category_id','like','%,'.$v.',%')->count();  
62 - $str = $str+$count;  
63 - }  
64 - } 56 +// foreach ($cate_ids as $v){
  57 +// $info = self::where('pid',$v)->first();
  58 +// if($info){
  59 +// continue;
  60 +// }else{
  61 +// $count = Product::where('category_id','like','%,'.$v.',%')->count();
  62 +// $str = $str+$count;
  63 +// }
  64 +// }
65 return $str; 65 return $str;
66 } 66 }
67 } 67 }