|
@@ -196,24 +196,24 @@ class VideoTask extends Command |
|
@@ -196,24 +196,24 @@ class VideoTask extends Command |
|
196
|
/**
|
196
|
/**
|
|
197
|
* 关键词聚合页-推荐&热门产品
|
197
|
* 关键词聚合页-推荐&热门产品
|
|
198
|
*/
|
198
|
*/
|
|
199
|
- public function getRecommendAndHotProducts($project,$route): ?array
|
199
|
+ public function getRecommendAndHotProducts($project_id,$route): ?array
|
|
200
|
{
|
200
|
{
|
|
201
|
$productIds = [];
|
201
|
$productIds = [];
|
|
202
|
- $productKeyword = Keyword::where("project_id",$project->id)->where("route",$route)->first();
|
202
|
+ $productKeyword = Keyword::where("project_id",$project_id)->where("route",$route)->first();
|
|
203
|
if (!empty($productKeyword)){
|
203
|
if (!empty($productKeyword)){
|
|
204
|
- $productsQuery = Product::where("project_id", $project->id)->where("status",1)->where("keyword_id","like","%,".$productKeyword->id.",%")->limit(7)->get();
|
204
|
+ $productsQuery = Product::where("project_id", $project_id)->where("status",1)->where("keyword_id","like","%,".$productKeyword->id.",%")->limit(7)->get();
|
|
205
|
if (!empty($productsQuery)){
|
205
|
if (!empty($productsQuery)){
|
|
206
|
foreach ($productsQuery as $item){
|
206
|
foreach ($productsQuery as $item){
|
|
207
|
$productIds[] = $item->id;
|
207
|
$productIds[] = $item->id;
|
|
208
|
}
|
208
|
}
|
|
209
|
if (count($productIds)<7){
|
209
|
if (count($productIds)<7){
|
|
210
|
- $randomData = Product::where("project_id", $project->id)->where("status",1)->whereNotIn('id', $productIds)->inRandomOrder()->take(13-count($productIds))->get();
|
210
|
+ $randomData = Product::where("project_id", $project_id)->where("status",1)->whereNotIn('id', $productIds)->inRandomOrder()->take(13-count($productIds))->get();
|
|
211
|
$products = $productsQuery->merge($randomData);
|
211
|
$products = $productsQuery->merge($randomData);
|
|
212
|
}else{
|
212
|
}else{
|
|
213
|
$products = $productsQuery;
|
213
|
$products = $productsQuery;
|
|
214
|
}
|
214
|
}
|
|
215
|
}else{
|
215
|
}else{
|
|
216
|
- $products = Product::where("project_id", $project->id)->where("status",1)->inRandomOrder()->take(13)->get();
|
216
|
+ $products = Product::where("project_id", $project_id)->where("status",1)->inRandomOrder()->take(13)->get();
|
|
217
|
}
|
217
|
}
|
|
218
|
}
|
218
|
}
|
|
219
|
$data = [];
|
219
|
$data = [];
|