|
...
|
...
|
@@ -228,7 +228,8 @@ class VideoTask extends Command |
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$product_all_id = Product::where("project_id", $project_id)->where("status",Product::STATUS_ON)->pluck('id')->toArray();
|
|
|
|
$product_id = array_rand($product_all_id, 40);
|
|
|
|
$number = 40;
|
|
|
|
$product_id = array_rand($product_all_id, min(count($product_all_id, $number-count($productIds))));
|
|
|
|
$products = Product::where("project_id", $project_id)->whereIn("id", $product_id)->get();
|
|
|
|
}
|
|
|
|
}
|
|
...
|
...
|
@@ -241,7 +242,13 @@ class VideoTask extends Command |
|
|
|
if(count($data) > 13){
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
$data[] = ['url'=>getImageUrl($item->thumb['url']),'title'=>$item->title,'product_id'=>$item->id];
|
|
|
|
if (strpos($item->keyword_id, ','.$productKeyword->id.',') === false) {
|
|
|
|
//不包含
|
|
|
|
$productModel = new Product();
|
|
|
|
$keyword_id = $item->keyword_id . $productKeyword->id.',';
|
|
|
|
$productModel->edit(['keyword_id'=>$keyword_id],['id'=>$item->id]);
|
|
|
|
}
|
|
|
|
$data[] = ['url'=>getImageUrl($item->thumb['url']),'title'=>$item->title];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $data;
|
...
|
...
|
|