正在显示
2 个修改的文件
包含
5 行增加
和
0 行删除
| @@ -34,6 +34,9 @@ class ProductController extends BaseController | @@ -34,6 +34,9 @@ class ProductController extends BaseController | ||
| 34 | $ids = CategoryRelated::where('cate_id', $this->param['category_id'])->pluck('product_id')->toArray(); | 34 | $ids = CategoryRelated::where('cate_id', $this->param['category_id'])->pluck('product_id')->toArray(); |
| 35 | $map[] = ['id', 'in', $ids]; | 35 | $map[] = ['id', 'in', $ids]; |
| 36 | } | 36 | } |
| 37 | + if(!empty($this->param['status'])){ | ||
| 38 | + $map[] = ['status', $this->param['status']]; | ||
| 39 | + } | ||
| 37 | $sort = ['id' => 'desc']; | 40 | $sort = ['id' => 'desc']; |
| 38 | $data = $logic->getList($map, $sort, ['id', 'title', 'thumb', 'category_id', 'keywords', 'status', 'created_at', 'updated_at']); | 41 | $data = $logic->getList($map, $sort, ['id', 'title', 'thumb', 'category_id', 'keywords', 'status', 'created_at', 'updated_at']); |
| 39 | return $this->success($data); | 42 | return $this->success($data); |
| @@ -32,6 +32,7 @@ class ProductLogic extends BaseLogic | @@ -32,6 +32,7 @@ class ProductLogic extends BaseLogic | ||
| 32 | $v['category_id_text'][] =(new CategoryLogic())->getCacheInfo($category_id)['title']??''; | 32 | $v['category_id_text'][] =(new CategoryLogic())->getCacheInfo($category_id)['title']??''; |
| 33 | } | 33 | } |
| 34 | $v['category_id_text'] = Arr::arrToSet($v['category_id_text'], 'trim'); | 34 | $v['category_id_text'] = Arr::arrToSet($v['category_id_text'], 'trim'); |
| 35 | + $v['status_text'] = Product::statusMap()[$v['status']] ?? ''; | ||
| 35 | } | 36 | } |
| 36 | return $this->success($data); | 37 | return $this->success($data); |
| 37 | } | 38 | } |
| @@ -43,6 +44,7 @@ class ProductLogic extends BaseLogic | @@ -43,6 +44,7 @@ class ProductLogic extends BaseLogic | ||
| 43 | $info['category_id_text'][] = (new CategoryLogic())->getCacheInfo($category_id)['title'] ?? ''; | 44 | $info['category_id_text'][] = (new CategoryLogic())->getCacheInfo($category_id)['title'] ?? ''; |
| 44 | } | 45 | } |
| 45 | $info['category_id_text'] = Arr::arrToSet($info['category_id_text'], 'trim'); | 46 | $info['category_id_text'] = Arr::arrToSet($info['category_id_text'], 'trim'); |
| 47 | + $info['status_text'] = Product::statusMap()[$info['status']] ?? ''; | ||
| 46 | return $this->success($info); | 48 | return $this->success($info); |
| 47 | } | 49 | } |
| 48 | 50 |
-
请 注册 或 登录 后发表评论