...
|
...
|
@@ -191,18 +191,24 @@ function sync($email_id){ |
|
|
if(!$folders){
|
|
|
return 3;
|
|
|
}
|
|
|
$folders = list_to_tree($folders);
|
|
|
|
|
|
$call = function ($email_id,$folder_id,$origin_folder) use ($mailServer){
|
|
|
// 同步父文件夹
|
|
|
$result = $mailServer->syncMail($email_id,$folder_id,$origin_folder);
|
|
|
_echo('同步文件夹('.$origin_folder.')邮件列表 '.(is_array($result)?count($result):'未同步'));
|
|
|
};
|
|
|
|
|
|
// $folders = list_to_tree($folders);
|
|
|
foreach ($folders as $folder){
|
|
|
try {
|
|
|
|
|
|
|
|
|
if(empty($folder['_child'])){
|
|
|
_echo('同步文件夹('.$folder['origin_folder'].')邮件列表');
|
|
|
// 同步父文件夹
|
|
|
$mailServer->syncMail($email_id,$folder['id'],$folder['origin_folder']);
|
|
|
$call($email_id,$folder['id'],$folder['origin_folder']);
|
|
|
}else{
|
|
|
foreach ($folder['_child'] as $item){
|
|
|
_echo('同步文件夹('.$item['origin_folder'].')邮件列表');
|
|
|
// 同步子文件夹
|
|
|
$mailServer->syncMail($email_id,$item['id'],$item['origin_folder']);
|
|
|
$call($email_id,$item['id'],$item['origin_folder']);
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|