作者 lyh

gx

... ... @@ -27,18 +27,18 @@ class CategoryController extends BaseController
}
$this->map['project_id'] = $this->user['project_id'];
$filed = ['id', 'project_id', 'pid', 'title', 'image', 'keywords', 'describe', 'status','created_at'];
$data = $category->list($this->map,'id',$filed);
if(!empty($data)){
$list = array();
foreach ($data as $v){
$list = $category->list($this->map,'id',$filed);
if(!empty($list)){
$data = array();
foreach ($list as $v){
$v = (array)$v;
if ($v['pid'] == 0) {
$v['sub'] = _get_child($v['id'], $data);
$list[] = $v;
$v['sub'] = _get_child($v['id'], $list);
$data[] = $v;
}
}
}
return $this->response('success',Code::SUCCESS,$list);
return $this->response('success',Code::SUCCESS,$data);
}
public function info(Request $request, CategoryLogic $logic){
... ...