正在显示
5 个修改的文件
包含
63 行增加
和
2 行删除
@@ -5,6 +5,7 @@ namespace Controller; | @@ -5,6 +5,7 @@ namespace Controller; | ||
5 | use Lib\Mail\Mail; | 5 | use Lib\Mail\Mail; |
6 | use Lib\Mail\MailFun; | 6 | use Lib\Mail\MailFun; |
7 | use Lib\Verify; | 7 | use Lib\Verify; |
8 | +use Model\bodySql; | ||
8 | use Model\emailSql; | 9 | use Model\emailSql; |
9 | use Model\folderSql; | 10 | use Model\folderSql; |
10 | use Model\listsSql; | 11 | use Model\listsSql; |
@@ -358,6 +359,53 @@ class Home extends Base { | @@ -358,6 +359,53 @@ class Home extends Base { | ||
358 | } | 359 | } |
359 | 360 | ||
360 | 361 | ||
362 | + /** | ||
363 | + * @author:dc | ||
364 | + * @time 2023/4/1 9:24 | ||
365 | + */ | ||
366 | + public function info(){ | ||
367 | + $id = app()->request('id',0,'intval'); | ||
368 | + // 没有,说明没有同步过来 | ||
369 | + $email = $this->getEmail(); | ||
370 | + $data = db()->first(listsSql::first(dbWhere(['id'=>$id,'email_id'=>$email['id']]))); | ||
371 | + | ||
372 | + if($data){ | ||
373 | + $sync_num = 0; | ||
374 | + | ||
375 | + HOME_INFO_BODY: | ||
376 | + // 循环几次 | ||
377 | + if($sync_num < 1){ | ||
378 | + $body = db()->first(bodySql::first($id)); | ||
379 | + if($body){ | ||
380 | + return [ | ||
381 | + 'data' => [ | ||
382 | + 'info' => $data, | ||
383 | + 'body' => json_decode($body['text_html'],true) | ||
384 | + ] | ||
385 | + ]; | ||
386 | + } | ||
387 | + | ||
388 | + $mail = new Mail($email['email'],base64_decode($email['passwird']),$email['imap']); | ||
389 | + | ||
390 | + if($mail->login()){ | ||
391 | + | ||
392 | + $folder = db()->value(folderSql::first(dbWhere(['id'=>$data['folder_id']]),'origin_folder')); | ||
393 | + if($folder){ | ||
394 | + $ret = $mail->syncBody($folder,$data['uid'],$id); | ||
395 | + $sync_num++; | ||
396 | + if($ret === true){ | ||
397 | + goto HOME_INFO_BODY; | ||
398 | + } | ||
399 | + } | ||
400 | + | ||
401 | + } | ||
402 | + } | ||
403 | + } | ||
404 | + | ||
405 | + app()->e('mail_body_error'); | ||
406 | + | ||
407 | + } | ||
408 | + | ||
361 | 409 | ||
362 | } | 410 | } |
363 | 411 |
@@ -319,6 +319,16 @@ function folderAlias($folder){ | @@ -319,6 +319,16 @@ function folderAlias($folder){ | ||
319 | 'Drafts' => '草稿箱', | 319 | 'Drafts' => '草稿箱', |
320 | 'Junk' => '垃圾箱', | 320 | 'Junk' => '垃圾箱', |
321 | 'Deleted Messages' => '回收站', | 321 | 'Deleted Messages' => '回收站', |
322 | + | ||
323 | + '垃圾邮件' => '垃圾箱', | ||
324 | + '已删除' => '回收站', | ||
325 | + '已发送' => '发件箱', | ||
326 | + | ||
327 | + '垃圾桶' => '垃圾箱', | ||
328 | + '垃圾郵件' => '垃圾箱', | ||
329 | + '寄件備份' => '发件箱', | ||
330 | + '草稿' => '草稿箱', | ||
331 | + | ||
322 | ]; | 332 | ]; |
323 | 333 | ||
324 | 334 |
@@ -323,7 +323,7 @@ class Mail { | @@ -323,7 +323,7 @@ class Mail { | ||
323 | $description = ''; | 323 | $description = ''; |
324 | foreach ($body as $key=>$item){ | 324 | foreach ($body as $key=>$item){ |
325 | if(!$description && in_array($item['type'],['text/html','text/plain'])){ | 325 | if(!$description && in_array($item['type'],['text/html','text/plain'])){ |
326 | - $description = mb_substr(trim(strip_tags($item['body'])),0,190); | 326 | + $description = mb_substr(trim(str_replace(["\n",' ',"\\n"," "],'',strip_tags($item['body']))),0,190); |
327 | } | 327 | } |
328 | if(!empty($body[$key]['body'])){ | 328 | if(!empty($body[$key]['body'])){ |
329 | $body[$key]['body'] = base64_encode($body[$key]['body']); | 329 | $body[$key]['body'] = base64_encode($body[$key]['body']); |
@@ -17,6 +17,8 @@ return [ | @@ -17,6 +17,8 @@ return [ | ||
17 | 'login' => [\Controller\Login::class, 'login'], | 17 | 'login' => [\Controller\Login::class, 'login'], |
18 | // 邮件列表 | 18 | // 邮件列表 |
19 | 'lists' => [\Controller\Home::class, 'lists'], | 19 | 'lists' => [\Controller\Home::class, 'lists'], |
20 | + // 邮件详情 | ||
21 | + 'info' => [\Controller\Home::class, 'info'], | ||
20 | // 邮件文件夹 | 22 | // 邮件文件夹 |
21 | 'folder' => [\Controller\Folder::class, 'lists'], | 23 | 'folder' => [\Controller\Folder::class, 'lists'], |
22 | // 创建文件夹 | 24 | // 创建文件夹 |
-
请 注册 或 登录 后发表评论