正在显示
1 个修改的文件
包含
10 行增加
和
4 行删除
| @@ -161,7 +161,7 @@ class SyncMail { | @@ -161,7 +161,7 @@ class SyncMail { | ||
| 161 | // 删除以前的 | 161 | // 删除以前的 |
| 162 | $this->db->delete(folderSql::$table,['uuid.notin'=>$uuids,'email_id'=>$this->emailId()]); | 162 | $this->db->delete(folderSql::$table,['uuid.notin'=>$uuids,'email_id'=>$this->emailId()]); |
| 163 | } | 163 | } |
| 164 | - | 164 | + _echo($this->emailId().' ===> 文件夹同步成功'); |
| 165 | if($this->isStop) return; | 165 | if($this->isStop) return; |
| 166 | 166 | ||
| 167 | 167 | ||
| @@ -176,7 +176,10 @@ class SyncMail { | @@ -176,7 +176,10 @@ class SyncMail { | ||
| 176 | 176 | ||
| 177 | // 是否有邮件 有邮件才继续 | 177 | // 是否有邮件 有邮件才继续 |
| 178 | if ($folder->getTotal()){ | 178 | if ($folder->getTotal()){ |
| 179 | - $this->mail($folder); | 179 | + $num = $this->mail($folder); |
| 180 | + if($num){ | ||
| 181 | + _echo($this->emailId().' ===> '.$folder->getName().' ===> '.$num); | ||
| 182 | + } | ||
| 180 | } | 183 | } |
| 181 | 184 | ||
| 182 | // 更新数量 | 185 | // 更新数量 |
| @@ -229,7 +232,8 @@ class SyncMail { | @@ -229,7 +232,8 @@ class SyncMail { | ||
| 229 | * @author:dc | 232 | * @author:dc |
| 230 | * @time 2024/9/26 11:10 | 233 | * @time 2024/9/26 11:10 |
| 231 | */ | 234 | */ |
| 232 | - public function mail(string|\Lib\Imap\Request\Folder $folder, array $uids = [],$isBody = false){ | 235 | + public function mail(string|\Lib\Imap\Request\Folder $folder, array $uids = [],$isBody = false):int { |
| 236 | + $sync_number = 0; | ||
| 233 | if(is_string($folder)){ | 237 | if(is_string($folder)){ |
| 234 | $folder = $this->imap->folder($folder)->exec(); | 238 | $folder = $this->imap->folder($folder)->exec(); |
| 235 | } | 239 | } |
| @@ -244,7 +248,7 @@ class SyncMail { | @@ -244,7 +248,7 @@ class SyncMail { | ||
| 244 | }else{ | 248 | }else{ |
| 245 | $p=1; | 249 | $p=1; |
| 246 | while (1){ | 250 | while (1){ |
| 247 | - if($this->isStop) return; | 251 | + if($this->isStop) return $sync_number; |
| 248 | $uids = $msg->forPage($p)->getUids(); | 252 | $uids = $msg->forPage($p)->getUids(); |
| 249 | if($uids){ | 253 | if($uids){ |
| 250 | $p++; | 254 | $p++; |
| @@ -258,6 +262,7 @@ class SyncMail { | @@ -258,6 +262,7 @@ class SyncMail { | ||
| 258 | if(!$uids) continue; | 262 | if(!$uids) continue; |
| 259 | 263 | ||
| 260 | $lists = $msg->uid($uids)->get()->all(); | 264 | $lists = $msg->uid($uids)->get()->all(); |
| 265 | + $sync_number += count($lists); | ||
| 261 | // 没有数据就跳出 | 266 | // 没有数据就跳出 |
| 262 | if($lists){ | 267 | if($lists){ |
| 263 | $this->saveMail($folder_id,$lists,$isBody); | 268 | $this->saveMail($folder_id,$lists,$isBody); |
| @@ -271,6 +276,7 @@ class SyncMail { | @@ -271,6 +276,7 @@ class SyncMail { | ||
| 271 | 276 | ||
| 272 | } | 277 | } |
| 273 | 278 | ||
| 279 | + return $sync_number; | ||
| 274 | } | 280 | } |
| 275 | 281 | ||
| 276 | /** | 282 | /** |
-
请 注册 或 登录 后发表评论