正在显示
1 个修改的文件
包含
4 行增加
和
9 行删除
| @@ -53,15 +53,10 @@ class Category extends Base | @@ -53,15 +53,10 @@ 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 | + $count = Product::where('category_id','like','%,'.$v.',%')->count(); | ||
| 58 | + $str = $str+$count; | ||
| 59 | + } | ||
| 65 | return $str; | 60 | return $str; |
| 66 | } | 61 | } |
| 67 | } | 62 | } |
-
请 注册 或 登录 后发表评论