|
...
|
...
|
@@ -220,7 +220,7 @@ 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(count($product_all_id, $number-count($productIds))));
|
|
|
|
$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);
|
|
|
|
}else{
|
|
...
|
...
|
@@ -229,7 +229,7 @@ class VideoTask extends Command |
|
|
|
}else{
|
|
|
|
$product_all_id = Product::where("project_id", $project_id)->where("status",Product::STATUS_ON)->pluck('id')->toArray();
|
|
|
|
$number = 40;
|
|
|
|
$product_id = array_rand($product_all_id, min(count($product_all_id, $number-count($productIds))));
|
|
|
|
$product_id = array_rand($product_all_id, min($product_all_id, $number-count($productIds)));
|
|
|
|
$products = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get();
|
|
|
|
}
|
|
|
|
}
|
...
|
...
|
|