作者 邓超

x

@@ -225,17 +225,16 @@ function sync($email_id){ @@ -225,17 +225,16 @@ function sync($email_id){
225 // $folders = list_to_tree($folders); 225 // $folders = list_to_tree($folders);
226 foreach ($folders as $folder){ 226 foreach ($folders as $folder){
227 try { 227 try {
228 -  
229 -  
230 - if(empty($folder['_child'])){  
231 - $call($email_id,$folder['id'],$folder['origin_folder']);  
232 - }else{  
233 - foreach ($folder['_child'] as $item){  
234 - // 同步子文件夹  
235 - $call($email_id,$item['id'],$item['origin_folder']); 228 + $is = true;
  229 + foreach ($folders as $f){
  230 + // 是否存在下级
  231 + if($f['pid'] == $folder['id']){
  232 + $is = false;
236 } 233 }
237 } 234 }
238 235
  236 + if($is) $call($email_id,$folder['id'],$folder['origin_folder']);
  237 +
239 }catch (\Throwable $e){ 238 }catch (\Throwable $e){
240 logs( 239 logs(
241 $e->getMessage().$e->getTraceAsString(), 240 $e->getMessage().$e->getTraceAsString(),