正在显示
1 个修改的文件
包含
22 行增加
和
43 行删除
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | namespace Event; | 3 | namespace Event; |
4 | 4 | ||
5 | use Model\folderSql; | 5 | use Model\folderSql; |
6 | +use Model\listsSql; | ||
6 | use Swlib\Saber; | 7 | use Swlib\Saber; |
7 | use Swlib\SaberGM; | 8 | use Swlib\SaberGM; |
8 | 9 | ||
@@ -14,63 +15,42 @@ use Swlib\SaberGM; | @@ -14,63 +15,42 @@ use Swlib\SaberGM; | ||
14 | * @package Event | 15 | * @package Event |
15 | */ | 16 | */ |
16 | class syncMail { | 17 | class syncMail { |
18 | + /** | ||
19 | + * @var \Lib\Db|\Lib\DbPool | ||
20 | + */ | ||
21 | + private $db; | ||
17 | 22 | ||
18 | 23 | ||
19 | public function __construct($id,$header,$data) | 24 | public function __construct($id,$header,$data) |
20 | { | 25 | { |
21 | - $db = db(); | 26 | + $this->db = db(); |
27 | + | ||
28 | + // 是否是预热邮件 aicc专用 | ||
29 | + if(!empty($header['Aicc-Hot-Mail']) || !empty($header['aicc-hot-mail'])){ | ||
30 | + return $this->hot($id); | ||
31 | + } | ||
22 | 32 | ||
33 | + // 是否在指定文件夹内 | ||
34 | + $f = folderAlias($this->db->value(folderSql::first($data['folder_id'],'folder'))); | ||
35 | + if($f=='发件箱'){ | ||
23 | if(empty($data['to_name'])){ | 36 | if(empty($data['to_name'])){ |
24 | $data['to_name'] = []; | 37 | $data['to_name'] = []; |
25 | } | 38 | } |
26 | 39 | ||
27 | $data['to_name'] = is_array($data['to_name'])?$data['to_name']:json_decode($data['to_name']); | 40 | $data['to_name'] = is_array($data['to_name'])?$data['to_name']:json_decode($data['to_name']); |
28 | 41 | ||
29 | - // 是否在指定文件夹内 | ||
30 | - $f = $db->value(folderSql::first($data['folder_id'],'folder')); | ||
31 | - $f = folderAlias($f); | ||
32 | - if($f=='收件箱'){ | ||
33 | - $f = 's'; | ||
34 | - }elseif($f=='发件箱'){ | ||
35 | - $f = 'f'; | ||
36 | - }elseif($f=='垃圾箱'){ | ||
37 | - $f = 'l'; | ||
38 | - } | ||
39 | - if(in_array($f,['s','f','l'])){ | ||
40 | - // 是否是预热邮件 aicc专用 | ||
41 | - if(!empty($header['Aicc-Hot-Mail']) || !empty($header['aicc-hot-mail'])){ | ||
42 | - $is_hot = 1; | ||
43 | - } | ||
44 | - | ||
45 | - if(empty($is_hot)){ | ||
46 | - if($f=='f'){ | ||
47 | $w = ['email' => array_column($data['to_name'],'email')]; | 42 | $w = ['email' => array_column($data['to_name'],'email')]; |
48 | }else{ | 43 | }else{ |
49 | $w = ['email' =>$data['from']]; | 44 | $w = ['email' =>$data['from']]; |
50 | } | 45 | } |
51 | - | ||
52 | - if($db->count('select count(*) from `hot_mail` where '.dbWhere($w))){ | ||
53 | - $is_hot = 1; | ||
54 | - } | 46 | + // 是否在 预热邮箱中 |
47 | + if($this->db->count('select count(*) from `hot_mail` where '.dbWhere($w))){ | ||
48 | + return $this->hot($id); | ||
55 | } | 49 | } |
56 | 50 | ||
57 | - if(!empty($is_hot)){ | ||
58 | - try { | ||
59 | - // 记录日志 | ||
60 | - logs('识别到aicc预热邮件 '.$id.'-'.$data['email_id'].'-'.$data['from'],LOG_PATH.'/hot-mail.log'); | ||
61 | - | ||
62 | - $db->throw()->insert('fob_hot_mail',[ | ||
63 | - 'lists_id' => $id, | ||
64 | - 'email_id' => $data['email_id'], | ||
65 | - 'hot_form' => $data['from'], | ||
66 | - 'folder' => $f | ||
67 | - ],false); | ||
68 | - | ||
69 | - }catch (\Throwable $exception){ | ||
70 | - logs($exception->getMessage()); | ||
71 | - } | ||
72 | - }else{ | ||
73 | - if($f == 's'){ | 51 | + |
52 | + // 不是预热邮箱 | ||
53 | + if($f=='收件箱'){ | ||
74 | // mimecast@wsa.aero | 54 | // mimecast@wsa.aero |
75 | $filterEmail = ['mimecast@wsa.aero']; | 55 | $filterEmail = ['mimecast@wsa.aero']; |
76 | // 邮件过滤 这些邮箱都是系统邮箱 | 56 | // 邮件过滤 这些邮箱都是系统邮箱 |
@@ -92,13 +72,12 @@ class syncMail { | @@ -92,13 +72,12 @@ class syncMail { | ||
92 | } | 72 | } |
93 | 73 | ||
94 | 74 | ||
95 | - | ||
96 | - } | ||
97 | } | 75 | } |
98 | 76 | ||
99 | } | 77 | } |
100 | 78 | ||
101 | - | 79 | + private function hot($id){ |
80 | + return $this->db->update(listsSql::$table,['is_hots'=>1],dbWhere(['id'=>$id])); | ||
102 | } | 81 | } |
103 | 82 | ||
104 | /** | 83 | /** |
-
请 注册 或 登录 后发表评论