作者 邓超

预热 逻辑

... ... @@ -86,7 +86,8 @@ class HotMail {
private function findList(Data $data, int $p = 1){
$lists = db()->all(
sprintf(
"select `id`,`folder_id`,`email_id`,`from` from `lists` where `id` > %d and `email_id` = %d and `folder_id` = %d and (select count(*) from `fob_hot_mail` where `lists`.`id` = `fob_hot_mail`.`lists_id`) = 0 order by `id` asc limit 1000 offset ".(($p-1)*1000),
"select `id`,`folder_id`,`email_id`,`%s` from `lists` where `id` > %d and `email_id` = %d and `folder_id` = %d and (select count(*) from `fob_hot_mail` where `lists`.`id` = `fob_hot_mail`.`lists_id`) = 0 order by `id` asc limit 1000 offset ".(($p-1)*1000),
$data->type=='s' ? 'from':'to_name', // 收件箱查询 from字段 发件箱 查询 to_name字段
$data->last_id,
$data->email_id,
$data->folder_id
... ... @@ -113,8 +114,26 @@ class HotMail {
* @time 2024/7/18 15:25
*/
private function insertData(array $data){
$isInsert = false;
if($data['folder'] == 's'){
// 收件箱 匹配 from 字段
$isInsert = in_array($data['from'],$this->shopkHotEmail);
}else{
// 发件箱 匹配 to_name字段
$to_name = is_array($data['to_name']) ? $data['to_name'] : @json_decode($data['to_name'],1);
if($to_name){
foreach ($to_name as $item){
// 找到了就退出去
if(in_array($item['email'],$this->shopkHotEmail)){
$isInsert = true;
break;
}
}
}
}
// 是预热 邮箱发来的邮件
if(in_array($data['from'],$this->shopkHotEmail)){
if($isInsert){
// 不存在 数据
if(db()->count("select count(*) from `fob_hot_mail` where `lists_id` = ".$data['id']) == 0){
db()->insert('fob_hot_mail',[
... ...