作者 邓超

x

  1 +<?php
  2 +
  3 +/**
  4 + * 检查邮件同步时出现的空数据,很奇怪
  5 + * 定时任务,每1小时执行一次
  6 + */
  7 +
  8 +require_once "../vendor/autoload.php";
  9 +
  10 +
  11 +$id = redis()->get('empty_subject_check',185163874);
  12 +while($id){
  13 +
  14 + $list = db()->first(\Model\listsSql::first('`id` > '.$id.' and `subject` = ""','`id`,`email_id`,`folder_id`,`uid`'));
  15 + if(!$list){
  16 + break;
  17 + }
  18 + $id = $list['id']??0;
  19 +
  20 + echo $id."\n";
  21 +
  22 + $email = db()->first(\Model\emailSql::first($list['email_id']));
  23 +
  24 +
  25 + $folder = db()->first(\Model\folderSql::first($list['folder_id']));
  26 + if(!$folder){continue;}
  27 +
  28 + $config = (new \Lib\Imap\ImapConfig())
  29 + // ->debug()
  30 + ->setEmail($email['email'])
  31 + ->setPassword(base64_decode($email['password']))
  32 + ->setHost($email['imap']);
  33 +
  34 + $imap = \Lib\Imap\ImapPool::get($config);
  35 + //$imap->debug();
  36 + $login = $imap->login();
  37 + if($login->isOk()){
  38 + (new \Service\SyncMail($email,$imap))->mail($folder['origin_folder'],[$list['uid']]);
  39 + }
  40 +
  41 +}
  42 +
  43 +redis()->get('empty_subject_check',$id);
  44 +
  45 +exit;
@@ -16,6 +16,9 @@ class Test { @@ -16,6 +16,9 @@ class Test {
16 16
17 17
18 public function home(){ 18 public function home(){
  19 + return '<iframe src="https://fob.ai.cc/33a9293e4314ea12ebfed9c60ab39f2d" style="width: 100%; height: 1000px;"></iframe>';
  20 + return '<iframe src="http://local.admin.hagro.cn/33a9293e4314ea12ebfed9c60ab39f2d" style="width: 100%; height: 1000px;"></iframe>';
  21 +
19 if(app()->request('sign')!='s1'){ 22 if(app()->request('sign')!='s1'){
20 http_response_code(404); 23 http_response_code(404);
21 app()->e(404,404); 24 app()->e(404,404);
@@ -58,6 +61,7 @@ class Test { @@ -58,6 +61,7 @@ class Test {
58 }else{ 61 }else{
59 echo $msg->body->getText(); 62 echo $msg->body->getText();
60 } 63 }
  64 +// $msg->header->getRaw()
61 // echo $msg->body->getAttachment(); 65 // echo $msg->body->getAttachment();
62 // foreach ($msg->body->getAttachment() as $attachment){ 66 // foreach ($msg->body->getAttachment() as $attachment){
63 // header("Content-Type:".$attachment->getFileType()); 67 // header("Content-Type:".$attachment->getFileType());