作者 邓超

x

... ... @@ -161,7 +161,7 @@ class SyncMail {
// 删除以前的
$this->db->delete(folderSql::$table,['uuid.notin'=>$uuids,'email_id'=>$this->emailId()]);
}
_echo($this->emailId().' ===> 文件夹同步成功');
if($this->isStop) return;
... ... @@ -176,7 +176,10 @@ class SyncMail {
// 是否有邮件 有邮件才继续
if ($folder->getTotal()){
$this->mail($folder);
$num = $this->mail($folder);
if($num){
_echo($this->emailId().' ===> '.$folder->getName().' ===> '.$num);
}
}
// 更新数量
... ... @@ -229,7 +232,8 @@ class SyncMail {
* @author:dc
* @time 2024/9/26 11:10
*/
public function mail(string|\Lib\Imap\Request\Folder $folder, array $uids = [],$isBody = false){
public function mail(string|\Lib\Imap\Request\Folder $folder, array $uids = [],$isBody = false):int {
$sync_number = 0;
if(is_string($folder)){
$folder = $this->imap->folder($folder)->exec();
}
... ... @@ -244,7 +248,7 @@ class SyncMail {
}else{
$p=1;
while (1){
if($this->isStop) return;
if($this->isStop) return $sync_number;
$uids = $msg->forPage($p)->getUids();
if($uids){
$p++;
... ... @@ -258,6 +262,7 @@ class SyncMail {
if(!$uids) continue;
$lists = $msg->uid($uids)->get()->all();
$sync_number += count($lists);
// 没有数据就跳出
if($lists){
$this->saveMail($folder_id,$lists,$isBody);
... ... @@ -271,6 +276,7 @@ class SyncMail {
}
return $sync_number;
}
/**
... ...