|
...
|
...
|
@@ -217,7 +217,7 @@ class VideoTask extends Command |
|
|
|
}
|
|
|
|
if (count($productIds)<7){
|
|
|
|
$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));
|
|
|
|
$product_id = array_rand($product_all_id, 30-count($productIds));
|
|
|
|
$randomData = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get();
|
|
|
|
$products = $productsQuery->merge($randomData);
|
|
|
|
}else{
|
|
...
|
...
|
@@ -225,19 +225,23 @@ class VideoTask extends Command |
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$product_all_id = Product::where("project_id", $project_id)->where("status",1)->pluck('id')->toArray();
|
|
|
|
$product_id = array_rand($product_all_id, 13);
|
|
|
|
$product_id = array_rand($product_all_id, 30);
|
|
|
|
$products = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$data = [];
|
|
|
|
if (!empty($products)){
|
|
|
|
foreach ($products as $item){
|
|
|
|
$data[] = ['url'=>!empty($item->thumb) && $item->thumb['url'] != "" ? getImageUrl($item->thumb['url']) : "",'title'=>$item->title];
|
|
|
|
if(empty($item->thumb) || ($item->thumb['url'] == "")){
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if(count($data) > 13){
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
$data[] = ['url'=>getImageUrl($item->thumb['url']),'title'=>$item->title];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
...
|
...
|
|