作者 lyh

gx

@@ -25,9 +25,20 @@ class CategoryController extends BaseController @@ -25,9 +25,20 @@ class CategoryController extends BaseController
25 if(!empty($this->map['title'])){ 25 if(!empty($this->map['title'])){
26 $this->map['title'] = ['like','%'.$this->map['title'].'%']; 26 $this->map['title'] = ['like','%'.$this->map['title'].'%'];
27 } 27 }
  28 + $this->map['project_id'] = $this->user['project_id'];
28 $filed = ['id', 'project_id', 'pid', 'title', 'image', 'keywords', 'describe', 'status','created_at']; 29 $filed = ['id', 'project_id', 'pid', 'title', 'image', 'keywords', 'describe', 'status','created_at'];
29 - $data = $category->lists($this->map,$this->page,$this->row,$this->order,$filed);  
30 - return $this->response('success',Code::SUCCESS,$data); 30 + $data = $category->list($this->map,'id',$filed);
  31 + if(!empty($data)){
  32 + $list = array();
  33 + foreach ($data as $v){
  34 + $v = (array)$v;
  35 + if ($v['pid'] == 0) {
  36 + $v['sub'] = _get_child($v['id'], $data);
  37 + $list[] = $v;
  38 + }
  39 + }
  40 + }
  41 + return $this->response('success',Code::SUCCESS,$list);
31 } 42 }
32 43
33 public function info(Request $request, CategoryLogic $logic){ 44 public function info(Request $request, CategoryLogic $logic){
@@ -32,6 +32,7 @@ class ProductController extends BaseController @@ -32,6 +32,7 @@ class ProductController extends BaseController
32 if(isset($this->map['title']) && !empty($this->map['title'])){ 32 if(isset($this->map['title']) && !empty($this->map['title'])){
33 $this->map['title'] = ['like','%'.$this->map['title'].'%']; 33 $this->map['title'] = ['like','%'.$this->map['title'].'%'];
34 } 34 }
  35 + $this->map['project_id'] = $this->user['project_id'];
35 $filed = ['id', 'project_id', 'title', 'thumb', 'product_type' , 'route' ,'category_id', 'keyword_id', 'status', 'created_uid', 'created_at', 'updated_at']; 36 $filed = ['id', 'project_id', 'title', 'thumb', 'product_type' , 'route' ,'category_id', 'keyword_id', 'status', 'created_uid', 'created_at', 'updated_at'];
36 $lists = $product->lists($this->map,$this->page,$this->row,$this->order,$filed); 37 $lists = $product->lists($this->map,$this->page,$this->row,$this->order,$filed);
37 if(!empty($lists['list'])){ 38 if(!empty($lists['list'])){