合并分支 'master-lyh-edit' 到 'master'
gx 查看合并请求 !614
正在显示
1 个修改的文件
包含
3 行增加
和
5 行删除
| @@ -154,11 +154,9 @@ class ProductController extends BaseController | @@ -154,11 +154,9 @@ class ProductController extends BaseController | ||
| 154 | if (isset($this->map['category_id']) && !empty($this->map['category_id'])) { | 154 | if (isset($this->map['category_id']) && !empty($this->map['category_id'])) { |
| 155 | $str[] = $this->map['category_id']; | 155 | $str[] = $this->map['category_id']; |
| 156 | $this->getAllSub($this->map['category_id'],$str); | 156 | $this->getAllSub($this->map['category_id'],$str); |
| 157 | - $query->where(function ($subQuery) use ($str) { | ||
| 158 | - foreach ($str as $v) { | ||
| 159 | - $subQuery->orWhereRaw("FIND_IN_SET(?, category_id) > 0", [$v]); | ||
| 160 | - } | ||
| 161 | - }); | 157 | + $categoryRelatedModel = new CategoryRelated(); |
| 158 | + $product_id_arr = $categoryRelatedModel->whereIn('cate_id',$str)->pluck('product_id')->toArray(); | ||
| 159 | + $query = $query->whereIn('id',$product_id_arr); | ||
| 162 | } | 160 | } |
| 163 | if(isset($this->map['title']) && !empty($this->map['title'])){ | 161 | if(isset($this->map['title']) && !empty($this->map['title'])){ |
| 164 | $query = $query->where('title','like','%'.$this->map['title'].'%'); | 162 | $query = $query->where('title','like','%'.$this->map['title'].'%'); |
-
请 注册 或 登录 后发表评论