diff --git a/application/master/controller/Journal.php b/application/master/controller/Journal.php index bf0da7b..bd515af 100644 --- a/application/master/controller/Journal.php +++ b/application/master/controller/Journal.php @@ -322,10 +322,26 @@ class Journal extends Controller { $frag[] = $v; } } + $ff = []; foreach ($frag as $kk => $vv){ - $frag[$kk] = $this->getChieldarr($vv,$res); + $ff[] = $this->getpChieldarr($vv, $res); +// $frag[$kk] = $this->getChieldarr($vv,$res); } - return json(['code'=>0,'msg'=>'success','data'=>['parentList'=>$frag]]); + return json(['code'=>0,'msg'=>'success','data'=>['parentList'=>$ff]]); + } + + private function getpChieldarr($vv,$res){ + if($vv['is_final']==1){ + return $vv; + } + $frag = []; + $frag[] = $vv; + foreach ($res as $v){ + if($v['parent_id'] == $vv['journal_topic_id']){ + $frag[] = $this->getChieldarr($v, $res); + } + } + return $frag; } /**