作者 lyh

变更数据

@@ -361,9 +361,13 @@ class TranslateController extends BaseController @@ -361,9 +361,13 @@ class TranslateController extends BaseController
361 Cache::put('product_category_trans',$catelists,3600 * 24); 361 Cache::put('product_category_trans',$catelists,3600 * 24);
362 } 362 }
363 $ids = $this->getCategoryWithChildrenIds($catelists,$v['source_id']); 363 $ids = $this->getCategoryWithChildrenIds($catelists,$v['source_id']);
  364 + if (empty($ids) || !is_array($ids)) {
  365 + // 处理空值情况,返回0或者默认值
  366 + $count = 0;
  367 + } else {
364 $cateRelateModel = new CategoryRelated(); 368 $cateRelateModel = new CategoryRelated();
365 - $product_ids = $cateRelateModel->whereIn('id',$ids)->distinct(true)->value('product_id');  
366 - $count = count($product_ids); 369 + $count = $cateRelateModel->whereIn('id', $ids)->distinct(true)->count();
  370 + }
367 } 371 }
368 $this->pageSixList($data,$count,$v,1,15); 372 $this->pageSixList($data,$count,$v,1,15);
369 break; 373 break;