正在显示
1 个修改的文件
包含
7 行增加
和
7 行删除
| @@ -27,18 +27,18 @@ class CategoryController extends BaseController | @@ -27,18 +27,18 @@ class CategoryController extends BaseController | ||
| 27 | } | 27 | } |
| 28 | $this->map['project_id'] = $this->user['project_id']; | 28 | $this->map['project_id'] = $this->user['project_id']; |
| 29 | $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']; |
| 30 | - $data = $category->list($this->map,'id',$filed); | ||
| 31 | - if(!empty($data)){ | ||
| 32 | - $list = array(); | ||
| 33 | - foreach ($data as $v){ | 30 | + $list = $category->list($this->map,'id',$filed); |
| 31 | + if(!empty($list)){ | ||
| 32 | + $data = array(); | ||
| 33 | + foreach ($list as $v){ | ||
| 34 | $v = (array)$v; | 34 | $v = (array)$v; |
| 35 | if ($v['pid'] == 0) { | 35 | if ($v['pid'] == 0) { |
| 36 | - $v['sub'] = _get_child($v['id'], $data); | ||
| 37 | - $list[] = $v; | 36 | + $v['sub'] = _get_child($v['id'], $list); |
| 37 | + $data[] = $v; | ||
| 38 | } | 38 | } |
| 39 | } | 39 | } |
| 40 | } | 40 | } |
| 41 | - return $this->response('success',Code::SUCCESS,$list); | 41 | + return $this->response('success',Code::SUCCESS,$data); |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | public function info(Request $request, CategoryLogic $logic){ | 44 | public function info(Request $request, CategoryLogic $logic){ |
-
请 注册 或 登录 后发表评论