作者 邓超

x

@@ -86,7 +86,7 @@ class AutoMail { @@ -86,7 +86,7 @@ class AutoMail {
86 $ids[] = $i+$id; 86 $ids[] = $i+$id;
87 } 87 }
88 $id = end($ids); 88 $id = end($ids);
89 - if($id<30000000){ 89 + if($id<($maxId-1000000)){
90 continue; 90 continue;
91 } 91 }
92 redis()->rPush('auto_check_ids',implode(',',$ids)); 92 redis()->rPush('auto_check_ids',implode(',',$ids));
@@ -46,7 +46,7 @@ class HotMail { @@ -46,7 +46,7 @@ class HotMail {
46 } 46 }
47 $id = end($ids); 47 $id = end($ids);
48 48
49 - if($id<25900000){ 49 + if($id<($maxId-1000000)){
50 continue; 50 continue;
51 } 51 }
52 52
@@ -4,6 +4,8 @@ namespace Controller; @@ -4,6 +4,8 @@ namespace Controller;
4 4
5 5
6 use Lib\Err; 6 use Lib\Err;
  7 +use Lib\Imap\ImapConfig;
  8 +use Lib\Imap\ImapPool;
7 use Lib\Mail\Mail; 9 use Lib\Mail\Mail;
8 use Lib\Mail\MailFun; 10 use Lib\Mail\MailFun;
9 use Model\folderSql; 11 use Model\folderSql;
@@ -157,27 +159,24 @@ class Folder extends Base { @@ -157,27 +159,24 @@ class Folder extends Base {
157 app()->e('folder_is_exist'); 159 app()->e('folder_is_exist');
158 } 160 }
159 161
160 - // 远程创建  
161 - $mail = new Mail(  
162 - $email['email'],  
163 - base64_decode($email['password']),  
164 - $email['imap']  
165 - ); 162 + $email['password'] = base64_decode($email['password']);
  163 + $email['host'] = $email['imap'];
  164 + $imap = ImapPool::get(new ImapConfig($email));
166 165
167 - if($mail->login()!=1){ 166 + if($imap->login()->isOk()){
168 app()->e('login_error_imap'); 167 app()->e('login_error_imap');
169 } 168 }
170 169
171 if($id){ 170 if($id){
172 // 远程创建 171 // 远程创建
173 - $ret = $mail->client->folderRename($folder['origin_folder'],$origin_folder); 172 + $ret = $imap->folder($folder['origin_folder'])->rename($origin_folder);
174 173
175 }else{ 174 }else{
176 // 远程创建 175 // 远程创建
177 - $ret = $mail->client->folderCreate($origin_folder); 176 + $ret = $imap->folder($origin_folder)->create();
178 } 177 }
179 178
180 - if($ret[0] === false){ 179 + if(!$ret){
181 app()->e($ret[1]); 180 app()->e($ret[1]);
182 } 181 }
183 182
@@ -256,19 +255,18 @@ class Folder extends Base { @@ -256,19 +255,18 @@ class Folder extends Base {
256 app()->e('folder_delete_exist_mail'); 255 app()->e('folder_delete_exist_mail');
257 } 256 }
258 257
259 - // 远程创建  
260 - $mail = new Mail(  
261 - $email['email'],  
262 - base64_decode($email['password']),  
263 - $email['imap']  
264 - ); 258 + $email['password'] = base64_decode($email['password']);
  259 + $email['host'] = $email['imap'];
  260 + $imap = ImapPool::get(new ImapConfig($email));
265 261
266 - if($mail->login()!=1){ 262 + if($imap->login()->isOk()){
267 app()->e('login_error_imap'); 263 app()->e('login_error_imap');
268 } 264 }
269 265
270 - // 远程创建  
271 - $ret = $mail->client->folderDelete($folder['origin_folder']); 266 + $f = $imap->folder($folder['origin_folder']);
  267 + if(!$f->delete()){
  268 + app()->e($f->getMessage());
  269 + }
272 270
273 $row = db()->delete(folderSql::$table,[ 271 $row = db()->delete(folderSql::$table,[
274 'id' => $folder['id'] 272 'id' => $folder['id']
@@ -2,8 +2,7 @@ @@ -2,8 +2,7 @@
2 2
3 namespace Controller; 3 namespace Controller;
4 4
5 -use Lib\Mail\Mail;  
6 -use Model\emailSql; 5 +
7 use Model\sendJobsSql; 6 use Model\sendJobsSql;
8 use Model\sendJobStatusSql; 7 use Model\sendJobStatusSql;
9 8