|
...
|
...
|
@@ -220,9 +220,12 @@ class VideoTask extends Command |
|
|
|
if (count($productIds)<7){
|
|
|
|
$product_all_id = Product::where("project_id", $project_id)->whereNotIn('id', $productIds)->where("status",Product::STATUS_ON)->pluck('id')->toArray();
|
|
|
|
$number = 40;
|
|
|
|
$product_id = array_rand($product_all_id, min($product_all_id, $number-count($productIds)));
|
|
|
|
$randomData = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get();
|
|
|
|
$products = $productsQuery->merge($randomData);
|
|
|
|
$array_count = count($product_all_id);
|
|
|
|
if ($array_count > 0) {
|
|
|
|
$product_id = array_rand($product_all_id, min($array_count, $number - count($productIds)));
|
|
|
|
$randomData = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get();
|
|
|
|
$products = $productsQuery->merge($randomData);
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$products = $productsQuery;
|
|
|
|
}
|
...
|
...
|
|