...
|
...
|
@@ -146,47 +146,47 @@ class Mail { |
|
|
$pid = $db->value(folderSql::has(['uuid'=>md5($email_id.$folder['pname'])]));
|
|
|
$pid = $pid ? $pid : 0;
|
|
|
// try {
|
|
|
$folder_name = '';
|
|
|
// 已发送
|
|
|
if(in_array('Send',$folder['check'])){
|
|
|
$folder_name = folderAlias('Send');
|
|
|
}
|
|
|
// 草稿
|
|
|
elseif(in_array('Drafts',$folder['check'])){
|
|
|
$folder_name = folderAlias('Drafts');
|
|
|
}
|
|
|
// 垃圾
|
|
|
elseif(in_array('Junk',$folder['check'])){
|
|
|
$folder_name = folderAlias('Junk');
|
|
|
}
|
|
|
// 回收站
|
|
|
elseif(in_array('Trash',$folder['check'])){
|
|
|
$folder_name = folderAlias('Trash');
|
|
|
}
|
|
|
$folder_name = '';
|
|
|
// 已发送
|
|
|
if(in_array('Send',$folder['check'])){
|
|
|
$folder_name = folderAlias('Send');
|
|
|
}
|
|
|
// 草稿
|
|
|
elseif(in_array('Drafts',$folder['check'])){
|
|
|
$folder_name = folderAlias('Drafts');
|
|
|
}
|
|
|
// 垃圾
|
|
|
elseif(in_array('Junk',$folder['check'])){
|
|
|
$folder_name = folderAlias('Junk');
|
|
|
}
|
|
|
// 回收站
|
|
|
elseif(in_array('Trash',$folder['check'])){
|
|
|
$folder_name = folderAlias('Trash');
|
|
|
}
|
|
|
|
|
|
if(!$folder_name){
|
|
|
$fn = explode('/',$folder['parseFolder']);
|
|
|
$folder_name = folderAlias(end($fn));
|
|
|
}
|
|
|
if(!$db->count(folderSql::has(['uuid'=>$uuid]))){
|
|
|
$db->insert(folderSql::$table,[
|
|
|
'email_id' => $email_id,
|
|
|
'folder' => folderAlias($folder_name),
|
|
|
'origin_folder' => $folder['folder'],
|
|
|
'uuid' => $uuid,
|
|
|
'pid' => $pid
|
|
|
],false);
|
|
|
}else{
|
|
|
$db->update(folderSql::$table,[
|
|
|
'email_id' => $email_id,
|
|
|
'folder' => folderAlias($folder_name),
|
|
|
'origin_folder' => $folder['folder'],
|
|
|
'uuid' => $uuid,
|
|
|
'pid' => $pid
|
|
|
],dbWhere(['email_id' => $email_id,'uuid' => $uuid]),false);
|
|
|
}
|
|
|
if(!$folder_name){
|
|
|
$fn = explode('/',$folder['parseFolder']);
|
|
|
$folder_name = folderAlias(end($fn));
|
|
|
}
|
|
|
if(!$db->count(folderSql::has(['uuid'=>$uuid]))){
|
|
|
$db->insert(folderSql::$table,[
|
|
|
'email_id' => $email_id,
|
|
|
'folder' => folderAlias($folder_name),
|
|
|
'origin_folder' => $folder['folder'],
|
|
|
'uuid' => $uuid,
|
|
|
'pid' => $pid
|
|
|
],false);
|
|
|
}else{
|
|
|
$db->update(folderSql::$table,[
|
|
|
'email_id' => $email_id,
|
|
|
'folder' => folderAlias($folder_name),
|
|
|
'origin_folder' => $folder['folder'],
|
|
|
'uuid' => $uuid,
|
|
|
'pid' => $pid
|
|
|
],dbWhere(['email_id' => $email_id,'uuid' => $uuid]),false);
|
|
|
}
|
|
|
// }catch (\Throwable $e){
|
|
|
// 这里就不处理失败了
|
|
|
// 这里就不处理失败了
|
|
|
// }
|
|
|
|
|
|
unset($folders[$fk]);
|
...
|
...
|
@@ -282,7 +282,8 @@ class Mail { |
|
|
|
|
|
$uids = array_column($uids,'UID');
|
|
|
foreach ($uids as $k=>$uid){
|
|
|
if($db->cache(86400*30)->value(listsSql::first(dbWhere(['email_id'=>$email_id,'folder_id'=>$folder_id,'uid'=>$uid]),'count(*) as c'))){
|
|
|
if($db->cache(86400*30,false)->value(listsSql::first(dbWhere(['email_id'=>$email_id,'folder_id'=>$folder_id,'uid'=>$uid]),'count(*) as c'))){
|
|
|
|
|
|
unset($uids[$k]);
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -444,7 +445,7 @@ class Mail { |
|
|
if(php_sapi_name()=='cli'){
|
|
|
go(function ($id,$header,$data){
|
|
|
new syncMail($id,$header,$data);
|
|
|
},
|
|
|
},
|
|
|
...[$id,$header,$data]
|
|
|
);
|
|
|
}
|
...
|
...
|
|