|
@@ -220,7 +220,7 @@ class VideoTask extends Command |
|
@@ -220,7 +220,7 @@ class VideoTask extends Command |
|
220
|
if (count($productIds)<7){
|
220
|
if (count($productIds)<7){
|
|
221
|
$product_all_id = Product::where("project_id", $project_id)->whereNotIn('id', $productIds)->where("status",Product::STATUS_ON)->pluck('id')->toArray();
|
221
|
$product_all_id = Product::where("project_id", $project_id)->whereNotIn('id', $productIds)->where("status",Product::STATUS_ON)->pluck('id')->toArray();
|
|
222
|
$number = 40;
|
222
|
$number = 40;
|
|
223
|
- $product_id = array_rand($product_all_id, min(count($product_all_id, $number-count($productIds))));
|
223
|
+ $product_id = array_rand($product_all_id, min($product_all_id, $number-count($productIds)));
|
|
224
|
$randomData = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get();
|
224
|
$randomData = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get();
|
|
225
|
$products = $productsQuery->merge($randomData);
|
225
|
$products = $productsQuery->merge($randomData);
|
|
226
|
}else{
|
226
|
}else{
|
|
@@ -229,7 +229,7 @@ class VideoTask extends Command |
|
@@ -229,7 +229,7 @@ class VideoTask extends Command |
|
229
|
}else{
|
229
|
}else{
|
|
230
|
$product_all_id = Product::where("project_id", $project_id)->where("status",Product::STATUS_ON)->pluck('id')->toArray();
|
230
|
$product_all_id = Product::where("project_id", $project_id)->where("status",Product::STATUS_ON)->pluck('id')->toArray();
|
|
231
|
$number = 40;
|
231
|
$number = 40;
|
|
232
|
- $product_id = array_rand($product_all_id, min(count($product_all_id, $number-count($productIds))));
|
232
|
+ $product_id = array_rand($product_all_id, min($product_all_id, $number-count($productIds)));
|
|
233
|
$products = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get();
|
233
|
$products = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get();
|
|
234
|
}
|
234
|
}
|
|
235
|
}
|
235
|
}
|