|
...
|
...
|
@@ -211,13 +211,17 @@ class VideoTask extends Command |
|
|
|
$productIds[] = $item->id;
|
|
|
|
}
|
|
|
|
if (count($productIds)<7){
|
|
|
|
$randomData = Product::where("project_id", $project_id)->where("status",1)->whereNotIn('id', $productIds)->inRandomOrder()->take(13-count($productIds))->get();
|
|
|
|
$product_all_id = Product::where("project_id", $project_id)->whereNotIn('id', $productIds)->where("status",1)->pluck('id')->toArray();
|
|
|
|
$product_id = array_rand($product_all_id, 13-count($productIds));
|
|
|
|
$randomData = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get();
|
|
|
|
$products = $productsQuery->merge($randomData);
|
|
|
|
}else{
|
|
|
|
$products = $productsQuery;
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$products = Product::where("project_id", $project_id)->where("status",1)->inRandomOrder()->take(13)->get();
|
|
|
|
$product_all_id = Product::where("project_id", $project_id)->where("status",1)->pluck('id')->toArray();
|
|
|
|
$product_id = array_rand($product_all_id, 13);
|
|
|
|
$products = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$data = [];
|
...
|
...
|
|