正在显示
1 个修改的文件
包含
2 行增加
和
5 行删除
| @@ -113,11 +113,8 @@ class ProductController extends BaseController | @@ -113,11 +113,8 @@ class ProductController extends BaseController | ||
| 113 | if (isset($this->map['category_id']) && !empty($this->map['category_id'])) { | 113 | if (isset($this->map['category_id']) && !empty($this->map['category_id'])) { |
| 114 | $str[] = $this->map['category_id']; | 114 | $str[] = $this->map['category_id']; |
| 115 | $str = $this->getAllSub($this->map['category_id'],$str); | 115 | $str = $this->getAllSub($this->map['category_id'],$str); |
| 116 | - $query->where(function ($subQuery) use ($str) { | ||
| 117 | - foreach ($str as $v) { | ||
| 118 | - $subQuery->orWhereRaw("FIND_IN_SET(?, category_id) > 0", [$v]); | ||
| 119 | - } | ||
| 120 | - }); | 116 | + $productArr = CategoryRelated::whereIn('cate_id',$str)->pluck('product_id')->toArray(); |
| 117 | + $query->whereIn('id',$productArr); | ||
| 121 | } | 118 | } |
| 122 | if(isset($this->map['title']) && !empty($this->map['title'])){ | 119 | if(isset($this->map['title']) && !empty($this->map['title'])){ |
| 123 | $query = $query->where('title','like','%'.$this->map['title'].'%'); | 120 | $query = $query->where('title','like','%'.$this->map['title'].'%'); |
-
请 注册 或 登录 后发表评论