作者 邓超

x

@@ -39,42 +39,18 @@ class AutoMail { @@ -39,42 +39,18 @@ class AutoMail {
39 $this->fids = $this->db->all("select `id` from `folders` where `folder` = '收件箱'"); 39 $this->fids = $this->db->all("select `id` from `folders` where `folder` = '收件箱'");
40 $this->fids = array_column($this->fids,'id'); 40 $this->fids = array_column($this->fids,'id');
41 41
42 - $filter = '2 Automatic reply  
43 -2 Delivery  
44 -2 Automatische Antwort  
45 -2 Undeliverable  
46 -2 Failure  
47 -2 Undelivered  
48 -1 noreply  
49 -1 postmaster  
50 -1 email-notifications  
51 -1 mailer-daemon  
52 -1 no-reply  
53 -2 自动回复  
54 -2 Returned mail  
55 -2 Autosvar  
56 -2 Out Of Office Re  
57 -2 Change_of_email_address  
58 -2 delivered  
59 -2 automatique  
60 -2 Reply auto  
61 -2 automatic  
62 -2 Request received  
63 -2 Automatisch  
64 -2 Unzustellbar  
65 -2 Notification  
66 -2 Invitation  
67 -2 Automatyczna  
68 -2 自動回覆  
69 -2 expired';  
70 - $filter = explode("\n",$filter);  
71 - foreach ($filter as $f) {  
72 - if (!$f) continue; 42 + $filter = @file_get_contents('https://fob.ai.cc/api/mail/ai_inbox_filter/'.md5('aicc.'.date('ymdh')));
  43 + $filter = @json_decode($filter,true);
  44 + if(!is_array($filter)){
  45 + return 0;
  46 + }
  47 + array_map(function ($v){
73 $this->filter[] = [ 48 $this->filter[] = [
74 - intval(mb_substr($f, 0, 1)),  
75 - trim(mb_substr($f, 1, 99)), 49 + $v['type'],
  50 + $v['text'],
76 ]; 51 ];
77 - } 52 + },$filter[0]);
  53 +
78 54
79 if(redis()->add('auto_mail_sync2',1,60)){ 55 if(redis()->add('auto_mail_sync2',1,60)){
80 echo '正在计算数据'; 56 echo '正在计算数据';
@@ -86,7 +62,7 @@ class AutoMail { @@ -86,7 +62,7 @@ class AutoMail {
86 $ids[] = $i+$id; 62 $ids[] = $i+$id;
87 } 63 }
88 $id = end($ids); 64 $id = end($ids);
89 - if($id<($maxId-1000000)){ 65 + if($id<($maxId-500000)){
90 continue; 66 continue;
91 } 67 }
92 redis()->rPush('auto_check_ids',implode(',',$ids)); 68 redis()->rPush('auto_check_ids',implode(',',$ids));
@@ -142,32 +118,11 @@ class AutoMail { @@ -142,32 +118,11 @@ class AutoMail {
142 118
143 } 119 }
144 120
145 -\Co\run(function (){  
146 - include_once "../vendor/autoload.php";  
147 -  
148 -// while(1){  
149 - new AutoMail();  
150 -});  
151 -  
152 -  
153 -//swoole_set_process_name('auto-reply-run-man');  
154 -//  
155 -//$pm = new Swoole\Process\Manager();  
156 -//  
157 -//$pm->addBatch(3,function (){  
158 -//  
159 -// swoole_set_process_name('auto-reply-email-run');  
160 -//  
161 -// include_once "../vendor/autoload.php";  
162 -//  
163 -//// while(1){  
164 -// new AutoMail();  
165 -// // 执行完了暂停5分钟在执行  
166 -// sleep(40);  
167 -//// }  
168 -//  
169 -//},true);  
170 -//  
171 -//$pm->start(); 121 +
  122 +include_once "../vendor/autoload.php";
  123 +
  124 +
  125 +new AutoMail();
  126 +
172 127
173 128