|
|
@ -87,7 +87,7 @@ class SearchService implements SearchServiceInterface |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$builder->select(''.$goodsTable.'.*')->addSelect([''.$goodsTable.'.sales as total_sales']); |
|
|
$builder->select(''.$goodsTable.'.*')->addSelect([''.$goodsTable.'.sales as total_sales']); |
|
|
$paginate = $builder->groupBy(''.$goodsTable.'.id')->paginate($params['pagesize']); |
|
|
|
|
|
|
|
|
$paginate = $builder->groupBy(''.$goodsTable.'.id')->inRandomOrder()->paginate($params['pagesize']); |
|
|
$goods = $paginate->toArray(); |
|
|
$goods = $paginate->toArray(); |
|
|
return ['has_more_pages' => $paginate->hasMorePages(), 'goods' => $goods['data']]; |
|
|
return ['has_more_pages' => $paginate->hasMorePages(), 'goods' => $goods['data']]; |
|
|
} |
|
|
} |
|
|
@ -137,7 +137,7 @@ class SearchService implements SearchServiceInterface |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
$paginate = $builder->groupBy(''.$storeTable.'.id')->paginate($params['pagesize']); |
|
|
|
|
|
|
|
|
$paginate = $builder->groupBy(''.$storeTable.'.id')->inRandomOrder()->paginate($params['pagesize']); |
|
|
$stores = $paginate->map(function ($item, $key) { |
|
|
$stores = $paginate->map(function ($item, $key) { |
|
|
$item->goods; |
|
|
$item->goods; |
|
|
return $item; |
|
|
return $item; |
|
|
|