|
@@ -228,7 +228,8 @@ class VideoTask extends Command |
|
@@ -228,7 +228,8 @@ class VideoTask extends Command |
|
228
|
}
|
228
|
}
|
|
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
|
- $product_id = array_rand($product_all_id, 40);
|
231
|
+ $number = 40;
|
|
|
|
232
|
+ $product_id = array_rand($product_all_id, min(count($product_all_id, $number-count($productIds))));
|
|
232
|
$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();
|
|
233
|
}
|
234
|
}
|
|
234
|
}
|
235
|
}
|
|
@@ -241,7 +242,13 @@ class VideoTask extends Command |
|
@@ -241,7 +242,13 @@ class VideoTask extends Command |
|
241
|
if(count($data) > 13){
|
242
|
if(count($data) > 13){
|
|
242
|
break;
|
243
|
break;
|
|
243
|
}
|
244
|
}
|
|
244
|
- $data[] = ['url'=>getImageUrl($item->thumb['url']),'title'=>$item->title,'product_id'=>$item->id];
|
245
|
+ if (strpos($item->keyword_id, ','.$productKeyword->id.',') === false) {
|
|
|
|
246
|
+ //不包含
|
|
|
|
247
|
+ $productModel = new Product();
|
|
|
|
248
|
+ $keyword_id = $item->keyword_id . $productKeyword->id.',';
|
|
|
|
249
|
+ $productModel->edit(['keyword_id'=>$keyword_id],['id'=>$item->id]);
|
|
|
|
250
|
+ }
|
|
|
|
251
|
+ $data[] = ['url'=>getImageUrl($item->thumb['url']),'title'=>$item->title];
|
|
245
|
}
|
252
|
}
|
|
246
|
}
|
253
|
}
|
|
247
|
return $data;
|
254
|
return $data;
|