作者 赵彬吉

update

@@ -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