...
|
...
|
@@ -38,6 +38,7 @@ class HotMail { |
|
|
array_map([$this,'moveMail'],$fob);
|
|
|
}
|
|
|
|
|
|
echo '已执行完成'.PHP_EOL;
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -47,6 +48,7 @@ class HotMail { |
|
|
* @time 2024/7/18 14:06
|
|
|
*/
|
|
|
private function moveMail(string $email){
|
|
|
echo '正在处理 '.$email."\n";
|
|
|
// 读取邮箱在表里的id
|
|
|
$email_id = db()->value(sprintf("select `id` from `%s` where `email` = '%s' limit 1",\Model\emailSql::$table, $email));
|
|
|
|
...
|
...
|
@@ -88,13 +90,15 @@ class HotMail { |
|
|
private function findList(Data $data, int $p = 1){
|
|
|
$lists = db()->all(
|
|
|
sprintf(
|
|
|
"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),
|
|
|
"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),
|
|
|
$data->type=='s' ? 'from':'to_name', // 收件箱查询 from字段 发件箱 查询 to_name字段
|
|
|
$data->email_id,
|
|
|
$data->folder_id
|
|
|
)
|
|
|
);
|
|
|
|
|
|
if($lists){
|
|
|
echo '找到邮件 '.count($lists)."\n";
|
|
|
// 处理数据
|
|
|
foreach ($lists as $list){
|
|
|
$list['folder'] = $data->type;
|
...
|
...
|
@@ -115,6 +119,7 @@ class HotMail { |
|
|
* @time 2024/7/18 15:25
|
|
|
*/
|
|
|
private function insertData(array $data){
|
|
|
|
|
|
$isInsert = false;
|
|
|
if($data['folder'] == 's'){
|
|
|
// 收件箱 匹配 from 字段
|
...
|
...
|
@@ -141,7 +146,7 @@ class HotMail { |
|
|
db()->insert('fob_hot_mail',[
|
|
|
'lists_id' => $data['id'],
|
|
|
'email_id' => $data['email_id'],
|
|
|
'hot_form' => $data['from'],
|
|
|
'hot_form' => $data['from']??'',
|
|
|
'folder' => $data['folder']
|
|
|
],false);
|
|
|
}
|
...
|
...
|
|