作者 邓超

1

@@ -43,13 +43,29 @@ class Folder extends Base { @@ -43,13 +43,29 @@ class Folder extends Base {
43 ); 43 );
44 44
45 $data = []; 45 $data = [];
46 - foreach ($folders as $k=>$folder){  
47 - if (empty($data[$emails[$folder['email_id']]])){  
48 - $data[$emails[$folder['email_id']]] = []; 46 + foreach ($emails as $eid=>$email){
  47 + if (empty($data[$email])){
  48 + $data[$email] = [];
  49 + }
  50 +
  51 + foreach ($folders as $k=>$folder){
  52 + if($folder['email_id'] == $eid){
  53 + unset($folder['email_id']);
  54 + $data[$email][$k] = $folder;
  55 + }
  56 + }
  57 + // 没有存在数据
  58 + if(!$data[$email]){
  59 + $data[$email][] = [
  60 + 'folder' => folderAlias('INBOX'),
  61 + 'id' => 0,
  62 + 'exsts' => 0,
  63 + 'unseen' => 0,
  64 + 'pid' => 0
  65 + ];
49 } 66 }
50 - $data[$emails[$folder['email_id']]][$k] = $folder;  
51 - unset($data[$emails[$folder['email_id']]][$k]['email_id']);  
52 } 67 }
  68 +
53 $folders = $data;$data = null; 69 $folders = $data;$data = null;
54 70
55 foreach ($folders as $f=>$folder){ 71 foreach ($folders as $f=>$folder){