作者 邓超

x

@@ -38,6 +38,7 @@ class HotMail { @@ -38,6 +38,7 @@ class HotMail {
38 array_map([$this,'moveMail'],$fob); 38 array_map([$this,'moveMail'],$fob);
39 } 39 }
40 40
  41 + echo '已执行完成'.PHP_EOL;
41 } 42 }
42 43
43 /** 44 /**
@@ -47,6 +48,7 @@ class HotMail { @@ -47,6 +48,7 @@ class HotMail {
47 * @time 2024/7/18 14:06 48 * @time 2024/7/18 14:06
48 */ 49 */
49 private function moveMail(string $email){ 50 private function moveMail(string $email){
  51 + echo '正在处理 '.$email."\n";
50 // 读取邮箱在表里的id 52 // 读取邮箱在表里的id
51 $email_id = db()->value(sprintf("select `id` from `%s` where `email` = '%s' limit 1",\Model\emailSql::$table, $email)); 53 $email_id = db()->value(sprintf("select `id` from `%s` where `email` = '%s' limit 1",\Model\emailSql::$table, $email));
52 54
@@ -88,13 +90,15 @@ class HotMail { @@ -88,13 +90,15 @@ class HotMail {
88 private function findList(Data $data, int $p = 1){ 90 private function findList(Data $data, int $p = 1){
89 $lists = db()->all( 91 $lists = db()->all(
90 sprintf( 92 sprintf(
91 - "select `id`,`folder_id`,`email_id`,`%s` from `lists` left join `fob_hot_mail` on `fob_hot_mail`.`lists_id` = `lists`.`id` where `email_id` = %d and `folder_id` = %d and `fob_hot_mail`.`lists_id` is null order by `id` asc limit 1000 offset ".(($p-1)*1000), 93 + "select `id`,`folder_id`,`lists`.`email_id`,`%s` from `lists` left join `fob_hot_mail` on `fob_hot_mail`.`lists_id` = `lists`.`id` where `lists`.`email_id` = %d and `folder_id` = %d and `fob_hot_mail`.`lists_id` is null order by `id` asc limit 1000 offset ".(($p-1)*1000),
92 $data->type=='s' ? 'from':'to_name', // 收件箱查询 from字段 发件箱 查询 to_name字段 94 $data->type=='s' ? 'from':'to_name', // 收件箱查询 from字段 发件箱 查询 to_name字段
93 $data->email_id, 95 $data->email_id,
94 $data->folder_id 96 $data->folder_id
95 ) 97 )
96 ); 98 );
  99 +
97 if($lists){ 100 if($lists){
  101 + echo '找到邮件 '.count($lists)."\n";
98 // 处理数据 102 // 处理数据
99 foreach ($lists as $list){ 103 foreach ($lists as $list){
100 $list['folder'] = $data->type; 104 $list['folder'] = $data->type;
@@ -115,6 +119,7 @@ class HotMail { @@ -115,6 +119,7 @@ class HotMail {
115 * @time 2024/7/18 15:25 119 * @time 2024/7/18 15:25
116 */ 120 */
117 private function insertData(array $data){ 121 private function insertData(array $data){
  122 +
118 $isInsert = false; 123 $isInsert = false;
119 if($data['folder'] == 's'){ 124 if($data['folder'] == 's'){
120 // 收件箱 匹配 from 字段 125 // 收件箱 匹配 from 字段
@@ -141,7 +146,7 @@ class HotMail { @@ -141,7 +146,7 @@ class HotMail {
141 db()->insert('fob_hot_mail',[ 146 db()->insert('fob_hot_mail',[
142 'lists_id' => $data['id'], 147 'lists_id' => $data['id'],
143 'email_id' => $data['email_id'], 148 'email_id' => $data['email_id'],
144 - 'hot_form' => $data['from'], 149 + 'hot_form' => $data['from']??'',
145 'folder' => $data['folder'] 150 'folder' => $data['folder']
146 ],false); 151 ],false);
147 } 152 }