From 0f63d12e6289cc7259f5d7a63c42324609828118 Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Sat, 14 Nov 2020 12:31:55 +0800 Subject: [PATCH] 20201112 --- application/master/controller/Journal.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) 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; } /**