正在显示
1 个修改的文件
包含
5 行增加
和
1 行删除
| @@ -275,7 +275,11 @@ class VideoTask extends Command | @@ -275,7 +275,11 @@ class VideoTask extends Command | ||
| 275 | } | 275 | } |
| 276 | }else{ | 276 | }else{ |
| 277 | $product_all_id = Product::where('thumb','!=',null)->where("status",Product::STATUS_ON)->inRandomOrder()->take(20)->pluck('id')->toArray(); | 277 | $product_all_id = Product::where('thumb','!=',null)->where("status",Product::STATUS_ON)->inRandomOrder()->take(20)->pluck('id')->toArray(); |
| 278 | - $products = Product::whereIn("id", $product_all_id)->orderByRaw(DB::raw("FIELD(id, " . implode(',', $product_all_id) . ")"))->get(); | 278 | + if(empty($product_all_id)){ |
| 279 | + $products = []; | ||
| 280 | + }else{ | ||
| 281 | + $products = Product::whereIn("id", $product_all_id)->orderByRaw(DB::raw("FIELD(id, " . implode(',', $product_all_id) . ")"))->get(); | ||
| 282 | + } | ||
| 279 | } | 283 | } |
| 280 | $data = []; | 284 | $data = []; |
| 281 | if (!empty($products)){ | 285 | if (!empty($products)){ |
-
请 注册 或 登录 后发表评论