作者 lyh

gx

... ... @@ -67,9 +67,10 @@ class Category extends Base
* @date 2023/4/28
*/
public function getProductNum($cate_id){
$str = [];
$str[] = $cate_id;
$cate_ids = $this->getAllSub($cate_id,$str);
$count = CategoryRelated::whereIn('cate_id',$cate_ids)->count();
$productArr = CategoryRelated::whereIn('cate_id',$cate_ids)->pluck('product_id')->toArray();
$count = count($productArr);
return $count;
}
}
... ...